Caddyserver Caddy expression language injection in vars_regexp

Severity: medium · CVSS 5.5 · Published 2026-05-19

A vulnerability in the Caddy web server allows attackers to steal sensitive information by sending specially crafted web requests. By exploiting a flaw in how Caddy processes internal variables, an attacker can force the server to reveal environment variables (like AWS keys or database passwords) or read local system files. This could lead to a full compromise of the server's credentials and sensitive data.

Technologies: github.com/caddyserver/caddy/v2 (Go). Vendors: Go.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Medium severity, with a CVSS score of 5.5, published 19 May 2026.
Which products and versions are affected?
github.com/caddyserver/caddy/v2 (Go) >= 2.11.0, <= 2.11.2.
Is there a fix for This vulnerability?
No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.
How is This vulnerability attacked?
It is attacked over the network, in a web application.
Am I affected?
Check whether you run github.com/caddyserver/caddy/v2 (Go) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

A bypass of the fix for CVE-2026-30852 exists in Caddy's 'vars_regexp' and 'MatchVarsRE' components within 'modules/caddyhttp/vars.go'. The original fix only prevented double expansion when variable keys were placeholders; however, literal key names remain unprotected and undergo a second round of expansion. An attacker can provide a request header containing Caddy placeholders (e.g., {env.SECRET} or {file./etc/passwd}) which are resolved during the second pass. This allows for the disclosure of sensitive environment variables, system information, or local files (up to 1MB) through reflected response headers or forwarded backend requests.

Affected products

  • Caddyserver Caddy 2.11.0 - 2.11.2

Timeline

  • 2026-05-13: disclosed: Advisory published to caddyserver/caddy repository
  • 2026-05-19: advisory: GitHub Advisory published

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.