__________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Center ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN Multiple PHP Vulnerabilities [Internet Security Systems Security Alert] February 28, 2002 16:00 GMT Number M-049 ______________________________________________________________________________ PROBLEM: Multiple buffer overflow vulnerabilities have been discovered in the PHP (Hypertext Preprocessor) scripting language. These flaws affect the way PHP handles multipart/form-data POST requests. PLATFORM: PHP version 3.0.10-3.0.18 PHP version 4.0.1-4.03pl1 PHP version 4.0.2-4.05 PHP version 4.0.6-4.0.7RC2 PHP version 4.0.7RC3-4.1.1 DAMAGE: If exploited, an attacker could execute arbitrary code on the victim/s system. SOLUTION: Apply available patches or workaround listed in this advisory. ______________________________________________________________________________ VULNERABILITY The risk is HIGH. X-Force has verified that a functional ASSESSMENT: exploit for one of the vulnerabilities exists and may be actively circulating in the computer underground. ______________________________________________________________________________ LINKS: CIAC BULLETIN: http://www.ciac.org/ciac/bulletins/m-049.shtml ORIGINAL BULLETIN: http://www.iss.net/security_center/alerts/advise112.php PATCHES: http://www.php.net/downloads.php ______________________________________________________________________________ [***** Start Internet Security Systems Security Alert *****] Internet Security Systems Security Alert February 27, 2002 Multiple PHP Vulnerabilities: Remote Compromise Exploit in Circulation Synopsis: ISS X-Force has learned of multiple buffer overflow vulnerabilities present in the PHP (Hypertext Preprocessor) scripting language. PHP is a popular server-side scripting language that is used heavily throughout the Internet. PHP is most commonly used in Apache Web server environments, but it is supported by all major Web servers and operating systems. X-Force has verified that a functional exploit for one of the vulnerabilities exists and may be actively circulating in the computer underground. Impact: Netcraft reports that as of January 2002, there are over 20.8 million active Apache installations, which account for 57% of the sites surveyed. Secure Space reports that PHP is the most popular Apache module available and there are over 1.44 million active installations. Affected Platforms: PHP version 3.0.10-3.0.18 PHP version 4.0.1-4.03pl1 PHP version 4.0.2-4.05 PHP version 4.0.6-4.0.7RC2 PHP version 4.0.7RC3-4.1.1 The PHP 4.2.0-dev distribution is not vulnerable. Description: The PHP project began as an Apache Software Foundation project as a powerful, cross- platform, server-side, embedded scripting language. PHP code is included inline among common HTML scripting, and its commands are executed on the server, unlike JavaScript, which is executed on the client. PHP is an attractive alternative for Web developers who are interested in creating dynamic content because it is considered easy to work with, very fast, and extremely flexible. PHP supports file uploads via HTTP POST by any RFC-1867 compliant Web browser. This feature allows Web site visitors to upload files, scripting, or any type of content to the server, where it can then be stored, displayed, or operated upon, depending on the design of the server. This feature is considered a potential security risk and many security mechanisms have been added to PHP over time to limit its abuse. Multiple buffer overflow vulnerabilities exist within the HTTP POST file upload functionality. To successfully exploit these vulnerabilities, attackers must upload a PHP form containing specially crafted MIME encoded data. In the exploit X-Force has analyzed, this data is passed in a buffer to a routine that locates the MIME boundary. A pointer is set to point to the end of the boundary, and then the "Content- disposition" header is parsed. A logic flaw in the parsing routine may cause PHP to miscalculate the remaining byte count within the allocated buffer. Under certain circumstances, this may lead to a one-byte overflow within the heap memory management data. Heap overflows are inherently difficult to exploit because the nature of the memory heap is much more dynamic then that of the stack. The environment of the heap management system must be favorable to the attacker to successfully exploit this vulnerability. Web servers are constantly allocating more memory dynamically and are serving many clients at any given time. This environment is quite chaotic and decreases the chances of successful exploitation in real-world conditions. X-Force has analyzed and tested a functional exploit. This exploit is believed to be circulating in the underground community and in use to a limited degree. It contains nine separate exploit vectors for versions of Debian and Red Hat Linux running various versions of Apache Web server and PHP. X-Force predicts newer versions of this exploit may support exploit vectors covering additional operating systems. Recommendations: The exploit that X-Force has analyzed appears to be an early version, and is somewhat unreliable. X-Force has been able to compromise remote servers with this current exploit in a lab environment. Newer and more effective versions may be circulating as well. The maintainers of PHP have updated the PHP CVS source code repository to fix this vulnerability. X-Force recommends that Web site administrators upgrade to the latest versions available for their PHP distributions. PHP downloads are available at: http://www.php.net/downloads.php The vulnerability associated with the exploit has been fixed in the file "php4/main/rfc1867.c". PHP4 administrators should verify that the revision of this file is 1.71.2.1 or higher. The latest PHP version 4.1.2 packages contain the patched version of "rfc1867.c". As a workaround, the file upload support can be disabled on Web servers running PHP 4.0.3 or above. Open the php.ini file and modify the line file_uploads = On to file_uploads = Off. After modifying the php.ini file, the Web server must be restarted if PHP is running as module. An X-Press Update for RealSecure Network Sensor will be available soon to provide detection support for these vulnerabilities. An Internet Scanner Flex Check will be released today to find vulnerable versions of PHP. These updates will be available at the ISS Download Center at: http://www.iss.net/download Additional Information: Advisory: PHP remote vulnerabilities, http://security.e-matters.de/advisories/012002.html PHP Downloads, http://www.php.net/downloads.php Apache Module Report, http://www.securityspace.com/s_survey/data/man.200201/apachemods.html Netcraft, http://www.netcraft.com ISS X-Force Database, http://www.iss.net/security_center/static/8281.php ISS Download Center, http://www.iss.net/download This alert is available at: http://www.iss.net/security_center/alerts/advise112.php Credits: ISS would like to thank Snort for providing the exploit for this vulnerability. ______ About Internet Security Systems (ISS) Founded in 1994, Internet Security Systems (ISS) (Nasdaq: ISSX) is a pioneer and world leader in software and services that protect critical online resources from an ever- changing spectrum of threats and misuse. Internet Security Systems is headquartered in Atlanta, GA, with additional operations throughout the Americas, Asia, Australia, Europe and the Middle East. Copyright (c) 2002 Internet Security Systems, Inc. All rights reserved worldwide. Permission is hereby granted for the electronic redistribution of this document. It is not to be edited or altered in any way without the express written consent of the Internet Security Systems X-Force. If you wish to reprint the whole or any part of this document in any other medium excluding electronic media, please email xforce@iss.net for permission. Disclaimer: The information within this paper may change without notice. Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. In no event shall the author/distributor (Internet Security Systems X-Force) be held liable for any damages whatsoever arising out of or in connection with the use or spread of this information. X-Force PGP Key available on MIT's PGP key server and PGP.com's key server, as well as at http://www.iss.net/security_center/sensitive.php Please send suggestions, updates, and comments to: X-Force xforce@iss.net of Internet Security Systems, Inc. [***** End Internet Security Systems Security Alert *****] _______________________________________________________________________________ CIAC wishes to acknowledge the contributions of Internet Security Systems for the information contained in this bulletin. _______________________________________________________________________________ CIAC, the Computer Incident Advisory Center, is the computer security incident response team for the U.S. Department of Energy (DOE) and the emergency backup response team for the National Institutes of Health (NIH). CIAC is located at the Lawrence Livermore National Laboratory in Livermore, California. CIAC is also a founding member of FIRST, the Forum of Incident Response and Security Teams, a global organization established to foster cooperation and coordination among computer security teams worldwide. CIAC services are available to DOE, DOE contractors, and the NIH. CIAC can be contacted at: Voice: +1 925-422-8193 (7x24) FAX: +1 925-423-8002 STU-III: +1 925-423-2604 E-mail: ciac@ciac.org Previous CIAC notices, anti-virus software, and other information are available from the CIAC Computer Security Archive. World Wide Web: http://www.ciac.org/ Anonymous FTP: ftp.ciac.org PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing communities receive CIAC bulletins. If you are not part of these communities, please contact your agency's response team to report incidents. Your agency's team will coordinate with CIAC. The Forum of Incident Response and Security Teams (FIRST) is a world-wide organization. A list of FIRST member organizations and their constituencies can be obtained via WWW at http://www.first.org/. This document was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the University of California nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation or favoring by the United States Government or the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes. LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC) M-038: Cisco Secure Access Control Server NDS User Authentication Vulnerability M-039: Microsoft Telnet Server Buffer Overflow Vulnerability M-040: MS Exchange - Incorrectly Sets Remote Registry Permissions M-041: Microsoft Internet Explorer Cumulative Patch M-042: Multiple Vulnerabilities in Multiple Implementations of SNMP M-043: Hewlett-Packard Buffer Overflow in Telnet Server Vulnerability M-044: SQL Server Remote Data Source Function Contain Unchecked Buffers M-046: Red Hat "ncurses" Vulnerability M-047: Oracle PL/SQL EXTPROC Database Vulnerability M-048: Oracle 9iAS Default Configuration Vulnerability