The PHP magic_quotes_gpc is a process that automatically escapes all the incoming data to the PHP script. The details about PHP magic_quotes_gpc can be viewed using phpinfo(). If an attacker successfully executes phpinfo(), he will be able to view all the details about the server. So it is recommended to disable phpinfo() in PHP.
Example
The following code is the example of vulnerable php.ini. Here, magic_quotes_gpc is set as on.
magic_quotes_gpc=on
If server configuration is accessible. Then, it will be available in .htaccess.
php_flagmagic_quotes_gpcon
Impact
The impacts include:-
An attacker can get access to sensitive information about the server like physical paths, environment variables, and the full PHP configuration settings. The attacker can use this information to exploit the server and can compromise the application completely.
Mitigation / Precaution
Beagle recommends the following fixes:-
Disable phpinfo() from PHP present in the server.
Update PHP to the latest version or try to at least use the PHP version 5.4. In version 5.4 and above, magic_quotes_gpc is removed for improving the security of the server and the application.
If you are using older versions of PHP (before 5.4), set magic_quotes_gpc as off in both .htaccess and php.ini. The below code is to be added in php.ini.
magic_quotes_gpc=off
The below code is to be added in .htaccess:-
php_flagmagic_quotes_gpcoff
Check your website security today and
identify vulnerabilities before hackers exploit them.