Sometimes, your business may involve the security of PHP Exploitation programs. When you encounter an audit task, do you know how to perform the search? This series will take you into PHP and help you understand it in a certain program, so that you can know when conducting security audit
Sometimes, your business may involve the security of PHP Exploitation programs. When you encounter an audit task, do you know how to perform the search? This series will take you into PHP and help you understand it in a certain program, so that you know what to look for during security audit.
Part 1 describes how to configure register_globals.
Entry knowledge
I would like to assume that you have a rough understanding of PHP syntax and can at least write programs like "Hello World. If you do not have the basic knowledge, first learn the PHP manual and some basic PHP tutorials (see references ). Many publishers have good books on PHP. It is recommended that beginners first read books or recipes at the beginning.
Audits accurate copies of production environments. You do not need to copy the hardware, but make sure that the software version is as complete as possible. The PHP configuration must be exactly matched. this is specified in the php. ini file, in the Apache command of the. htaccess file, or in httpd. conf. You need to prepare a separate environment because you will display and record errors that may contain sensitive passwords and other information. In addition, you will try to interrupt the security of your site, which you have avoided in the motion exploitation program.
The first step is to change the PHP error_reporting settings to E_ALL. After the setting is changed, PHP reports a warning message whenever the app does not initialize the variable, visit the wrong file, or generate other (most) harmless errors, but there is also the possibility that this is an ambush attack vector. These errors generally indicate that programming is hasty, so if this is your code, you can clear them.
This setting is as follows:
Error_reporting = E_ALL
If you do not know where the php. ini file is, you can use the. php script that contains the following text to search for it:
Phpinfo ();
The value may be changed, but/usr/local/lib/php. ini is the majority of UNIX? Public position on the system, C: \ php. ini or C: \ WINDOWS \ php. ini is the majority of Microsoft? Windows? Public position on the system. If the file does not exist, create a file and type the preceding error_reporting line in the file. After modifying the php. ini file, you need to restart the Web server to enable the new settings in PHP.
If you have not created a phpinfo () page before, you can create it now. The second important part of the label is "configuration", which contains a lot of useful information about how to set PHP. This part contains three columns: set name, local value, and xmaster value. The main value is the value set globally for all php scripts on your machine using the PHP. ini command. The local value is valid for the current script. It may be affected by:. htaccess settings, httpd. conf Or The settings in section and the ini_set call in the PHP script. At runtime, only some settings can be changed. For more information, see The PHP manual in reference materials.
The other two settings that need to be customized are display_errors and log_errors. You must enable either or both of the two settings. Log_errors notifies PHP to record attention, warnings, or errors in the file. display_errors displays the recorded attention, warnings, and errors on the screen. They are not mutually exclusive. At least one of them can be enabled to effectively invent programming errors that may lead to security vulnerabilities.