Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/caddyserver/caddy/v2/modules/caddyhttp
  4. ›
  5. CVE-2026-30852

CVE-2026-30852: Caddy's vars_regexp double-expands user input, leaking env vars and files

March 6, 2026 (updated March 9, 2026)

The vars_regexp matcher in vars.go:337 double-expands user-controlled input through the Caddy replacer. When vars_regexp matches against a placeholder like {http.request.header.X-Input}, the header value gets resolved once (expected), then passed through repl.ReplaceAll() again (the bug). This means an attacker can put {env.DATABASE_URL} or {file./etc/passwd} in a request header and the server will evaluate it, leaking environment variables, file contents, and system info.

header_regexp does NOT do this — it passes header values straight to Match(). So this is a code-level inconsistency, not intended behavior.

References

  • github.com/advisories/GHSA-m2w3-8f23-hxxf
  • github.com/caddyserver/caddy
  • github.com/caddyserver/caddy/pull/5408
  • github.com/caddyserver/caddy/releases/tag/v2.11.2
  • github.com/caddyserver/caddy/security/advisories/GHSA-m2w3-8f23-hxxf
  • nvd.nist.gov/vuln/detail/CVE-2026-30852

Code Behaviors & Features

Detect and mitigate CVE-2026-30852 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 2.7.5 before 2.11.2

Fixed versions

  • 2.11.2

Solution

Upgrade to version 2.11.2 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
  • CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

Source file

go/github.com/caddyserver/caddy/v2/modules/caddyhttp/CVE-2026-30852.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 25 Mar 2026 00:18:57 +0000.