Vulnerability · Published Mar 7, 2026 · Assigned by GitHub_M
CVE-2026-30852Caddy: vars_regexp double-expands user input, leaking env vars and files
Medium 5.5
In plain English
A medium-severity information exposure in caddy from caddyserver. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.5% (higher than 41% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
Caddy is an extensible server platform that uses TLS by default. From version 2.7.5 to before version 2.11.2, 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. This issue has been patched in version 2.11.2.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine:v3.23 | caddy | 2.11.2-r0 | ALPINE-CVE-2026-30852 |
| Alpine:v3.24 | caddy | 2.11.2-r0 | ALPINE-CVE-2026-30852 |
| Go | github.com/caddyserver/caddy/v2 | 2.11.2 | GO-2026-4644 |
| Go | github.com/caddyserver/caddy/v2/modules/caddyhttp | 2.11.2 | GHSA-m2w3-8f23-hxxf |
| Ubuntu:25.10 | caddy | no fix listed | UBUNTU-CVE-2026-30852 |
| Ubuntu:26.10 | caddy | no fix listed | UBUNTU-CVE-2026-30852 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| caddyserver | caddy | >= 2.7.5, < 2.11.2 |
Weakness: CWE-200, CWE-74 · Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:P
References
- https://github.com/caddyserver/caddy/security/advisories/GHSA-m2w3-8f23-hxxf x_refsource_CONFIRM
- https://github.com/caddyserver/caddy/pull/5408 x_refsource_MISC
- https://github.com/caddyserver/caddy/releases/tag/v2.11.2 x_refsource_MISC