WelcomeEnterpriseSmall BusinessHome & Home OfficePartnersAbout Symantec

PHP multipart/form-data POST parsing error allows arbitrary code

Risk
High

Date Discovered
07-22-2002

Description
A vulnerability exists in the PHP parsing code that handles file uploads (multipart/form-data). By sending a specially crafted POST request to the Web server that corrupts the internal data structures used by PHP, a remote attacker can run arbitrary code with privileges of the Web server and, potentially, gain privileged access.

PHP is a popular HTML-embedded scripting language used to create dynamically generated Web pages.

PHP versions starting with 4.2.0 contain updated multipart/form-data handler code to intelligently parse HTTP POST request headers and differentiate variables and files sent by the user agent in a multipart/form-data request. The parser, however, fails to provide sufficient input checking in the way the mime headers are processed. Anyone who can send HTTP POST requests to an affected Web server can exploit the vulnerability to compromise the web server and, under certain conditions, gain privileged access.


PHP running on x86 platforms is currently verified to be safe from the execution of arbitrary code. However, the vulnerability can still be exploited against x86 platforms to crash PHP and, in most cases, the Web server.

Platforms Affected
Multiple

Components Affected
Apache Software Foundation PHP 4.2.0, 4.2.1

Recommendations
Upgrade: Upgrade to latest version of PHP
The vendor has announced that a fixed version is forthcoming or is doing research to determine product/version vulnerability to the issue. Upgrading to latest version of PHP fixes this vulnerability.

Current versions of PHP are available for download from:
http://www.php.net/downloads.php

Workaround: PHP multipart/form-data POST handler error workaround
If you are unable or unwilling to upgrade to PHP 4.2.2 or later and the PHP applications on an affected web server do not rely on HTTP POST input from user agents, you can deny POST requests on the Web server.

For example, in the Apache Web server you can deny POST requests by including following code in the main configuration file or a top-level .htaccess file:

< Limit POST >
     Order deny,allow
     Deny from all
< /Limit>

Note that an existing configuration and/or .htaccess file may have parameters that contradict this example.

References
Source: CERT CA-2002-21
URL: http://www.cert.org/advisories/CA-2002-21.html

Source: CERT CERT Vulnerability Note VU#929115
URL: http://www.kb.cert.org/vuls/id/929115

Source: Apache Software Foundation PHP Security Advisory: Vulnerability in PHP versions 4.2.0 and 4.2.1
URL: http://www.php.net/release_4_2_2.php


Copyright (c) 2008 by Symantec Corp.
Permission to redistribute this alert electronically is granted as long as it is not edited in any way unless authorized by Symantec Security Response. Reprinting the whole or part of this alert in any medium other than electronically requires permission from secure@symantec.com.

Disclaimer
The information in the advisory is believed to be accurate at the time of publishing based on currently available information. Use of the information constitutes acceptance for use in an AS IS condition. There are no warranties with regard to this information. Neither the author nor the publisher accepts any liability for any direct, indirect, or consequential loss or damage arising from use of, or reliance on, this information.

Symantec, Symantec products, Symantec Security Response, and secure@symantec.com are registered trademarks of Symantec Corp. and/or affiliated companies in the United States and other countries. All other registered and unregistered trademarks represented in this document are the sole property of their respective companies/owners.