When developing a simple PHP framework, what security issues need attention?

Source: Internet
Author: User
I think it is the simplest PHPmvc framework to use a URL routing function to match the name of the controller and method in the URL. If method_exists is used, the controller of the new controller will use call_user_func_array to execute the method, otherwise, the controller of error is introduced, and each controlle... I think it is the simplest PHP mvc framework. The URL routing function is used to match the name of the controller and method in the URL. If method_exists is used, the controller of new and call_user_func_array is used to execute the method, otherwise, an error controller is introduced. In each controller, you can use require to introduce the model and then use require to introduce tpl. This is my simplest PHP framework idea, what security issues should we pay attention?

Reply content:

I think it is the simplest PHP mvc framework. The URL routing function is used to match the name of the controller and method in the URL. If method_exists is used, the controller of new and call_user_func_array is used to execute the method, otherwise, an error controller is introduced. In each controller, you can use require to introduce the model and then use require to introduce tpl. This is my simplest PHP framework idea, what security issues should we pay attention?

  • Path Problem. You cannot use a url to call an application's external file, such/etc/passwd

  • Data filtering,Never trust any user input. Use of all input datahtmlspecialcharsFilter and import data to the database.

  • Database, replaced by PDOmysql_xxxx, Use parameter binding to process external data (if the database only uses mysql, you can also usemysqliExtension)

Aboutcall_user_func_arrayDrupal was previously recruited for security issues.

Http://blog.knownsec.com/2014/10/drupal__callback_nightmare/

requireThis vulnerability may cause file inclusion.

Http://www.neatstudio.com/show-1123-1.shtml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.