Apache mod_proxy / mod_rewrite SSRF and proxy misrouting — reverse-proxy rules that forward attacker-controlled path/host to arbitrary backends, including CVE-2021-40438. Tier 1. Payloads: payloads/ssrf.md. Use when the target runs Apache httpd as a reverse proxy (ProxyPass / RewriteRule [P] / ProxyPassMatch) or you see proxy-style path routing.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Mod Proxy Ssrf?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-mod-proxy-ssrf)
---
name: mod-proxy-ssrf
description: "Apache mod_proxy / mod_rewrite SSRF and proxy misrouting — reverse-proxy rules that forward attacker-controlled path/host to arbitrary backends, including CVE-2021-40438. Tier 1. Payloads: payloads/ssrf.md. Use when the target runs Apache httpd as a reverse proxy (ProxyPass / RewriteRule [P] / ProxyPassMatch) or you see proxy-style path routing."
---
# Apache mod_proxy / mod_rewrite SSRF
Misconfigured or vulnerable Apache proxy rules let you redirect the upstream request to an internal/attacker host → SSRF, then cloud metadata or internal-app access.
## Trigger phrases
`mod_proxy, mod_rewrite, apache proxy ssrf, cve-2021-40438, proxypass, rewriterule, proxy misrouting`
## Method
1. **Fingerprint:** `Server: Apache`, behaviour of `ProxyPass`/`RewriteRule ... [P]`/`ProxyPassMatch`. Probe paths that look proxied (`/api/`, `/service/`, `/_/`), note upstream-leak headers (`Via`, `X-Forwarded-*`, backend error pages).
2. **CVE-2021-40438 (mod_proxy SSRF, httpd ≤2.4.48):** a crafted `unix:` prefix in the request URI makes mod_proxy forward to an attacker-chosen host when a `RewriteRule`/`ProxyPassMatch` builds the upstream URL from the request path:
```
GET /<proxied-path>?unix:AAAA...(long)...AAAA|http://169.254.169.254/latest/meta-data/ HTTP/1.1
Host: target
```
Pad the `unix:` segment long enough to overflow the parsed worker, then supply your target URL after `|`. Confirm with OAST host first, then metadata.
3. **Rewrite rule injection / path misrouting:** where a rule captures `$1` into the proxy target (`RewriteRule ^/proxy/(.*)$ http://$1 [P]`), request `/proxy/<id>.oast/` → full SSRF. Test encoded slashes `%2f`, `..;/`, extra `/` to escape the intended prefix.
4. **Pivot:** reach cloud metadata (headers per `ssrf`), internal admin, Redis/FastCGI via gopher if the worker allows it.
## Modern / rare techniques
- [NEW] **HTTP/2 `:method` with spaces bypasses `ProxyMatch`/`RewriteRule` path guards** (h2 tolerates bytes HTTP/1.1 forbids) — see `http-request-smuggling` §H2. Combine when a path-based proxy ACL protects an internal route.
- [NEW] **`unix:` socket confusion** (basis of CVE-2021-40438) also appears in bespoke `RewriteRule [P]` configs that concatenate user input into the `unix:/path|http://...` form.
- Mixed with **open-redirect / 307 chains** (`r3dir`) to defeat an upstream allowlist that the proxy enforces by hostname.
## Bypass / evasion
${CLAUDE_PLUGIN_ROOT}/payloads/waf-bypass.md + ssrf.md host-obfuscation: encoded IPs, `[::ffff:169.254.169.254]`, trailing-dot host, double-encoding of the injected URL so the proxy decodes it late.
## Escalation / chaining
Full SSRF → `ssrf` (metadata/gopher playbook) → `cloud-pentest`. Path-ACL bypass often pairs with `access-control` and `http-request-smuggling`. Version-confirmed CVE-2021-40438 → report as critical reverse-proxy SSRF.
## Backend & tooling
Preferred Kali path (native / WSL+Kali / Kali-SSH / Kali-MCP / HexStrike): `curl`/`nuclei` CVE-2021-40438 template, `nmap` http-apache-* scripts, `SSRFmap`, interactsh for OAST. If a Burp MCP is present, send the crafted `unix:` request to Repeater and watch Collaborator. Windows-local last resort. See `zazy-orchestrator`.
## Verification (background, before reporting)
Re-confirm independently (second payload/tool/vantage or OAST callback) and reproduce before marking CONFIRMED. For blind cases use OAST (Collaborator/interactsh) before concluding negative. Report true positives only.
## Evidence
The crafted request, upstream response proving redirection (OAST hit or metadata/internal content), confirmed httpd version if CVE-based, affected endpoint, impact. Remediation: upgrade httpd (≥2.4.49 for CVE-2021-40438), constrain `ProxyPass` targets to fixed hosts, never build upstream URLs from user input, strip `unix:`.