T00ls庆五一礼物之二:Gnuboard4 SQL Injection

2013-05-01 02:18:10 126 8635 2
棒子程序, 棒子国90%的论坛都是用的这屌程序, 我是本着无聊的心情读的, 绝非搞啥韩国数据什么的 = =
因为某SB的一句此程序有GETSHELL, 害的我苦读, 是谁就不说了, 最终注射一堆堆, GETSHELL没读到, 擦

不废话,上代码:
 <? //   \bbs\poll_update.php
include_once("./_common.php");
$po = sql_fetch(" select * from $g4[poll_table] where po_id = '$_POST[po_id]' "); //检查是否存在此投票
if (!$po[po_id])
    alert_close("po_id &#44050;&#51060; &#51228;&#45824;&#47196; &#45336;&#50612;&#50724;&#51648; &#50506;&#50520;&#49845;&#45768;&#45796;.");

if ($member[mb_level] < $po[po_level])
    alert_close("&#44428;&#54620; $po[po_level] &#51060;&#49345; &#54924;&#50896;&#47564; &#53804;&#54364;&#50640; &#52280;&#50668;&#54616;&#49892; &#49688; &#51080;&#49845;&#45768;&#45796;.");
// &#53216;&#53412;&#50640; &#51200;&#51109;&#46108; &#53804;&#54364;&#48264;&#54840;&#44032; &#50630;&#45796;&#47732;
if (get_cookie("ck_po_id") != $po[po_id])
{
    // &#53804;&#54364;&#54664;&#45912; ip&#46308; &#51473;&#50640;&#49436; &#52286;&#50500;&#48376;&#45796;
    $search_ip = false;
    $ips = explode("\n", trim($po[po_ips]));
    for ($i=0; $i<count($ips); $i++)
    {
        if ($_SERVER[REMOTE_ADDR] == trim($ips[$i]))  //判断当前ip是否已经投过票
        {
            $search_ip = true;
            break;
        }
    }

    // &#53804;&#54364;&#54664;&#45912; &#54924;&#50896;&#50500;&#51060;&#46356;&#46308; &#51473;&#50640;&#49436; &#52286;&#50500;&#48376;&#45796;
    $search_mb_id = false;//&#&53804
    if ($is_member)
    {
        $ids = explode("\n", trim($po[mb_ids]));
        for ($i=0; $i<count($ids); $i++)
        {
            if ($member[mb_id] == trim($ids[$i]))  //判断当前用户是否已经投过票
            {
                $search_mb_id = true;
                break;
            }
        }
    }

    // &#50630;&#45796;&#47732; &#49440;&#53469;&#54620; &#53804;&#54364;&#54637;&#47785;&#51012; 1&#51613;&#44032; &#49884;&#53412;&#44256; ip, id&#47484; &#51200;&#51109;
    if (!($search_ip || $search_mb_id))  //如果都没有则注射? o(∩_∩)o~~
    {
        $po_ips = $po[po_ips] . $_SERVER[REMOTE_ADDR] . "\n";
        $mb_ids = $po[mb_ids];
        if ($member[mb_id])
            $mb_ids .= $member[mb_id] . "\n";
        sql_query(" update $g4[poll_table] set po_cnt{$gb_poll} = po_cnt{$gb_poll} + 1, po_ips = '$po_ips', mb_ids = '$mb_ids' where po_id = '$po_id' "); //大家都懂了, 你,懂了么????
    }

    if (!$search_mb_id)
        insert_point($member[mb_id], $po[po_point], $po[po_id] . ". " . cut_str($po[po_subject],20) . " &#53804;&#54364; &#52280;&#50668; ", "@poll", $po[po_id], "&#53804;&#54364;");
}

set_cookie("ck_po_id", $po[po_id], 86400 * 15); // &#53804;&#54364; &#53216;&#53412; &#48372;&#47492;&#44036; &#51200;&#51109;

goto_url("./poll_result.php?po_id=$po_id&skin_dir=$skin_dir");
?>
白痴注入, 此程序从一开始就已经全局变量覆盖了, 所以注射还有几个, 就是没有搞到getshell, 留给大牛们读吧~


测试图:



exp用法看下说明文件, 有的站需要登录后才可以注射, 可在exp里设置用户名和密码..


关于作者

Rices154篇文章2132篇回复

评论126次

要评论?请先  登录  或  注册