Web Sites Open to Attack From PHP Scripting Holes

Update: The PHP Group released fixes PHP 5.4.3 and PHP 5.3.13 Tuesday evening, available for download here.

Two separate flaws in the PHP scripting language found in a large majority of Web sites have been seen being exploited in the wild by attackers.

The first vulnerability, which was privately disclosed to the PHP Group in January, could allow attackers to steal source code or insert malware. The exploit works by modifying how PHP setups parse query string parameters from PHP files in a Common Gateway Interface (CGI) configuration.

The hole makes it possible to interpret URL query strings that contain the "-" character as a command line switch. Hackers can use that flaw to access the source code or run a specially crafted remote code execution attack.

The attacks currently are active. Security firm Trustwave SpiderLabs reported yesterday seeing the PHP attack being exploited via its honeypot, which is set to monitor Web attacks.

According to the PHP Group, organizations can easily check to see if their Web site is vulnerable to attack.

"If you are using Apache mod_cgi to run PHP you may be vulnerable," wrote the PHP Group in a message on its Web site. "To see if you are, just add ?-s to the end of any of your URLs. If you see your source code, you are vulnerable. If your site renders normally, you are not."

While the vulnerability was privately disclosed to the PHP Group, the issue became public when the flaw was accidently leaked online.

"Making a bad week worse, we had a bug in our bug system that toggled the private flag of a bug report to public on a comment to the bug report causing this issue to go public before we had time to test solutions to the level we would like," said the PHP Group.

In response to the information leak, the PHP Group released PHP 5.3.12 and PHP 5.4.2 as emergency fixes. However, shortly after release, it was discovered that the updates could be easily bypassed. "The security emergency release to fix the PHP CGI RCE (that was tested for days...) does not fix anything at all," wrote Stefan Esser, creator of the Suhosin PHP security extension, in a Twitter message.

Still, the PHP Group advises that organizations apply the flawed updates and test their system to see if they are still vulnerable. If so, a workaround can be found here.

An additional PHP update is scheduled to be released sometime today.

"Another set of releases are planned for Tuesday, May, 8th," said the PHP Group. "These releases will fix the CGI flaw and another CGI-related issue in apache_request_header (5.4 only)."

About the Author

Chris Paoli (@ChrisPaoli5) is the associate editor for Converge360.