Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

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

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

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
wafparan01d3 — 快速 WAF“偏执”医生评估 | WAFPARAN01D3 工具 | Kitploit
工具/GitHubGitHub/alt3kx/wafparan01d3
防御工具脚本与自动化配置审计Web安全渗透测试
GitHubalt3kx/wafparan01d3

wafparan01d3

快速 WAF“偏执”医生评估 | WAFPARAN01D3 工具

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

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

快速 WAF“偏执”诊断评估

wafparano1d3
WAFPARAN01D3

Web 应用程序防火墙偏执级别测试工具。
— 来自 alt3kx.github.io

偏执级别简介

本质上,偏执级别(PL)允许你定义核心规则集的激进程度。
参考:https://coreruleset.org/20211028/working-with-paranoia-levels/

工作原理

  • wafparan01d3.py python3 脚本通过使用基于 GET 参数编码的有效载荷,将恶意请求放置在 HTTP 请求的不同部分,评估结果记录在你机器上生成的报告调试文件 wafparan01d3.log 中。
  • 通过使用默认配置级别,观察每种 WAF 偏执级别设置不同攻击或载荷时的行为与响应。
  • 下面的 PoC 提供了从零开始的基本安装和配置,并通过设置一个基本的 "Mock" 来模拟后端,以复用当前已部署的 WAF。
  • 默认可用的载荷文件名为 mysql_gosecure.txt,基于 gosecure 的研究 "A Scientific Notation Bug in MySQL left AWS WAF Clients Vulnerable to SQL Injection",可从此处获取:https://www.gosecure.net/blog/2021/10/19/a-scientific-notation-bug-in-mysql-left-aws-waf-clients-vulnerable-to-sql-injection/ ,该研究使用 modsecurity 评估我们的 WAF 在不同的偏执级别下的表现,既包括默认配置,也包括以交错、快速的方式禁用不同规则/ID 的情况。

方法

  • Pentesters:灰盒范围,通过具有特权(可启动/重载并编辑 DEV/STG/TEST 环境中的 WAF Apache 配置文件)的 "shell" 对 WAF Linux 主机进行有限访问,发送不同的载荷。
  • Secutity Officers:为组织中的每个解决方案做出最佳决策,以应用合适的 WAF 偏执级别。
  • Blueteamers:规则执行、最佳告警,减少组织中的误报结果。
  • Integrators:执行更深入的故障排除,并通过快速定制规则或创建虚拟补丁来定义适当的 WAF 偏执级别。

概念验证:基于 Ubuntu 20.04.3 和 OWASP 核心规则集(CRS)v3.3.2

参考:https://www.inmotionhosting.com/support/server/apache/install-modsecurity-apache-module/

初始安装

  1. 更新软件仓库:
$ sudo apt update -y && sudo apt dist-upgrade -y
  1. 安装 Essentials:
$ sudo apt-get install build-essential -y
  1. 为 ubuntu 安装 apache2(如果尚未安装):
$ sudo apt-get install apache2 -y
  1. 下载并安装 ModSecurity Apache 模块:
$ sudo apt install libapache2-mod-security2 -y
  1. 为 ubuntu 安装 curl(如果尚未安装):
$ sudo apt-get install curl vim gridsite-clients net-tools -y
  1. 重启 Apache 服务:
$ sudo systemctl restart apache2
  1. 确保已安装的软件版本至少为 2.9.x:
$ sudo apt-cache show libapache2-mod-security2

install

配置 ModSecurity

  1. 复制并重命名文件:
$ sudo cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf

接下来,更改 ModSecurity 检测模式。首先,进入 cd /etc/modsecurity 文件夹
2. 使用 vi、vim、emacs 或 nano 编辑 ModSecurity 配置文件。

$ sudo vim /etc/modsecurity/modsecurity.conf
  1. 在文件顶部附近,你会看到 SecRuleEngine DetectionOnly。将 DetectionOnly 改为 On。

原始值: SecRuleEngine DetectionOnly
新值: SecRuleEngine On

modsec

  1. 保存更改。
  2. 重启 Apache:
$ sudo systemctl restart apache2

下载 OWASP 核心规则集

  1. 从 CoreRuleSet.org/installation 下载最新的 CRS
$ cd ~
$ wget https://github.com/coreruleset/coreruleset/archive/refs/tags/v3.3.2.zip
  1. 验证校验和,确保与此处公开提供的匹配:https://coreruleset.org/installation/
$ sha1sum v3.3.2.zip && echo ProvidedChecksum
88f336ba32a89922cade11a4b8e986f2e46a97cf  v3.3.2.zip
ProvidedChecksum 

checksum

  1. 解压 zip 文件。
$ unzip v3.3.2.zip
  1. 将新目录中的 CRS 设置文件移动到你的 ModSecurity 目录:
$ sudo mv coreruleset-3.3.2/crs-setup.conf.example /etc/modsecurity/crs/crs-setup.conf

-(可选,但推荐)将新目录中的 rules 目录移动到你的 ModSecurity 目录:

$ sudo mv coreruleset-3.3.2/rules/ /etc/modsecurity/crs/
  1. 编辑你的 Apache security2.conf 文件,以确保它会加载 ModSecurity 规则:
$ sudo vim /etc/apache2/mods-enabled/security2.conf
<IfModule security2_module>
        # Default Debian dir for modsecurity's persistent data
        SecDataDir /var/cache/modsecurity

        # Include all the *.conf files in /etc/modsecurity.
        # Keeping your local configuration in that directory
        # will allow for an easy upgrade of THIS file and
        # make your life easier
        IncludeOptional /etc/modsecurity/crs-setup.conf
        IncludeOptional /etc/modsecurity/rules/*.conf

        # Include OWASP ModSecurity CRS rules if installed
        #IncludeOptional /usr/share/modsecurity-crs/*.load
</IfModule>

secmodule

  1. 确保同时列出了默认的 ModSecurity 和新的 CRS 配置文件。第一行 conf 文件路径可能已经包含。第二个文件路径应为你移动 /rules 目录的位置。
  2. 编辑 /etc/apache2/apache2.conf
$ sudo vim /etc/apache2/apache2.conf

复制并粘贴以下代码,然后保存。

# Include list of ports to listen on
Include ports.conf

Include /etc/modsecurity/modsecurity.conf
Include /etc/modsecurity/crs/crs-setup.conf
Include /etc/modsecurity/crs/rules/*.conf

ports

Apache 加载模块 Rewrite 与 Proxy

  1. 复制以下模块。启用 Proxy 和 Rewrite 模块。
$ cd /etc/apache2
$ sudo cp mods-available/proxy_http.load mods-enabled
$ sudo cp mods-available/proxy.load mods-enabled/
$ sudo cp mods-available/rewrite.load mods-enabled/
  1. 重启 Apache
$ sudo systemctl restart apache2

添加用于测试“Mock”的虚拟主机

  1. 添加端口,编辑 /etc/apache2/ports.conf
$ sudo vim /etc/apache2/ports.conf

复制并粘贴以下代码,然后保存。

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 8080
Listen 18080

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

ports2

  1. 进入 /etc/apache2/sites-enabled,创建文件 001-test.conf
$ cd /etc/apache2/sites-enabled/
$ sudo touch 001-test.conf
$ sudo vim 001-test.conf

复制并粘贴以下代码,然后保存。

<VirtualHost *:8080>
        ServerName test.domain:8080

        SecRuleEngine On

        ErrorLog ${APACHE_LOG_DIR}/test_error.log
        CustomLog ${APACHE_LOG_DIR}/test_access.log combined
        SecAuditLog ${APACHE_LOG_DIR}/test_audit.log

        ProxyPass / http://127.0.0.1:18080/
        ProxyPassReverse / http://127.0.0.1:18080/
</VirtualHost>
  1. 进入 /etc/apache2/sites-enabled,创建文件 002-moc.conf
$ cd /etc/apache2/sites-enabled/
$ sudo touch 002-moc.conf
$ sudo vim 002-moc.conf

复制并粘贴以下代码,然后保存。

<VirtualHost 127.0.0.1:18080>

        ErrorLog ${APACHE_LOG_DIR}/moc_error.log
        CustomLog ${APACHE_LOG_DIR}/moc_access.log combined
下载工具