SkipNavigation
US-CERT
American Flag
  Vulnerability
Notes
Database

Search Vulnerability Notes

Vulnerability Notes Help Information


 
 View Notes By
  Name

ID Number

CVE Name

Date Public

Date Published

Date Updated

Severity Metric



 Other Documents
  Technical Alerts

Technical Bulletins

Alerts

Security Tips

 

Vulnerability Note VU#929115

PHP fails to properly parse the headers of HTTP POST requests

Overview

A vulnerability has been discovered in PHP. This vulnerability could be used by a remote attacker to execute arbitrary code or crash PHP and/or the web server.

I. Description

PHP is a popular scripting language in widespread use. For more information about PHP, see http://www.php.net/manual/en/faq.general.php.

The vulnerability occurs in the portion of PHP code responsible for handling file uploads, specifically multipart/form-data. By sending a specially crafted POST request to the web server, an attacker can corrupt the internal data structures used by PHP. Specifically, an intruder can cause an improperly initialized memory structure to be freed. In most cases, an intruder can use this flaw to crash PHP or the web server. Under some circumstances, an intruder may be able to take advantage of this flaw to execute arbitrary code with the privileges of the web server.

You may be aware that freeing memory at inappropriate times in some implementations of malloc and free does not usually result in the execution of arbitrary code. However, because PHP utilizes its own memory management system, the implementation of malloc and free is irrelevant to this problem.

Stefan Esser of e-matters GmbH has indicated that intruders cannot execute code on x86 systems. However, we encourage system administrators to apply patches on x86 systems as well to guard against denial-of-service attacks and as-yet-unknown attack techniques that may permit the execution of code on x86 architectures.

This vulnerability was discovered by e-matters GmbH and is described in detail in their advisory. The PHP Group has also issued an advisory. A list of vendors contacted by the CERT/CC and their status regarding this vulnerability is available in VU#929115.

Although this vulnerability only affects PHP 4.2.0 and 4.2.1, e-matters GmbH has previously identified vulnerabilities in older versions of PHP. If you are running older versions of PHP, we encourage you to review http://security.e-matters.de/advisories/012002.html.

II. Impact

A remote attacker can execute arbitrary code on a vulnerable system. An attacker may not be able to execute code on x86 architectures due to the way the stack is structured. However, an attacker can leverage this vulnerability to crash PHP and/or the web server running on an x86 architecture.

III. Solution

Apply a patch from your vendor
Appendix A contains information provided by vendors for this advisory. As vendors report new information to the CERT/CC, we will update this section and note the changes in our revision history. If a particular vendor is not listed below, we have not received their comments. Please contact your vendor directly.

Upgrade to the latest version of PHP

If a patch is not available from your vendor, upgrade to version 4.2.2.

Deny POST requests

Until patches or an update can be applied, you may wish to deny POST requests. The following workaround is taken from the PHP Security Advisory:

      If the PHP applications on an affected web server do not rely on HTTP POST input from user agents, it is often possible to deny POST requests on the web server.

      In the Apache web server, for example, this is possible with the following code included 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 contradicting the example given above.

Disable vulnerable service

Until you can upgrade or apply patches, you may wish to disable PHP. As a best practice, the CERT/CC recommends disabling all services that are not explicitly required. Before deciding to disable PHP, carefully consider your service requirements.


Systems Affected

VendorStatusDate Updated
3ComUnknown22-Jul-2002
AlcatelUnknown22-Jul-2002
Apple Computer Inc.Not Vulnerable22-Jul-2002
AT&TUnknown22-Jul-2002
BSDIUnknown22-Jul-2002
Cisco Systems Inc.Unknown22-Jul-2002
Compaq Computer CorporationUnknown22-Jul-2002
Computer AssociatesUnknown22-Jul-2002
ConectivaNot Vulnerable23-Jul-2002
Cray Inc.Not Vulnerable22-Jul-2002
Data GeneralUnknown22-Jul-2002
DebianVulnerable22-Jul-2002
F5 NetworksNot Vulnerable23-Jul-2002
FreeBSDVulnerable22-Jul-2002
FujitsuUnknown22-Jul-2002
Guardian Digital Inc. Unknown22-Jul-2002
Guardian Digital Inc. Not Vulnerable22-Jul-2002
Hewlett-Packard CompanyNot Vulnerable25-Jul-2002
IBMNot Vulnerable22-Jul-2002
IntelUnknown22-Jul-2002
Juniper NetworksUnknown22-Jul-2002
LachmanUnknown22-Jul-2002
Lotus SoftwareUnknown22-Jul-2002
Lucent TechnologiesUnknown22-Jul-2002
MandrakeSoftVulnerable22-Jul-2002
Microsoft CorporationNot Vulnerable22-Jul-2002
MultinetUnknown22-Jul-2002
NEC CorporationUnknown22-Jul-2002
NetBSDUnknown22-Jul-2002
Network ApplianceNot Vulnerable22-Jul-2002
Nortel NetworksUnknown22-Jul-2002
OpenBSDUnknown22-Jul-2002
Oracle CorporationUnknown22-Jul-2002
PHP Development TeamVulnerable22-Jul-2002
Red Hat Inc.Not Vulnerable22-Jul-2002
SequentUnknown22-Jul-2002
SGIUnknown24-Jul-2002
Sony CorporationUnknown22-Jul-2002
Sun Microsystems Inc.Unknown22-Jul-2002
SuSE Inc.Not Vulnerable22-Jul-2002
The SCO Group (SCO Linux)Not Vulnerable22-Jul-2002
TrustixNot Vulnerable24-Jul-2002
Unisphere NetworksUnknown22-Jul-2002
UnisysUnknown22-Jul-2002
Wind River Systems Inc.Unknown22-Jul-2002
Xerox CorporationNot Vulnerable30-May-2003

References


http://www.php.net/release_4_2_2.php
http://online.securityfocus.com/archive/1/283532
http://online.securityfocus.com/archive/1/283533
http://www.securityfocus.com/bid/5278

Credit

Thanks to e-matters Security for reporting this vulnerability.

This document was written by Ian A Finlay.

Other Information

Date Public07/22/2002
Date First Published07/22/2002 10:59:30 AM
Date Last Updated05/30/2003
CERT AdvisoryCA-2002-21
CVE NameCAN-2002-0717
US-CERT Technical Alerts 
Metric42.53
Document Revision35

If you have feedback, comments, or additional information about this vulnerability, please send us email.
 

 
Page Corner Image
Copyright 2002 Carnegie Mellon University
Disclaimers and copyright information
Get Adobe Reader Get Adobe Reader