Skip to content
OpenAdvisories
Medium · 5.5 CVE-2026-30852 EUVD-2026-10177GHSA-m2w3-8f23-hxxfGO-2026-4644

Caddy: vars_regexp double-expands user input, leaking env vars and files

Published Mar 7, 2026 · Updated Mar 9, 2026 · Assigned by GitHub_M

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 products

VendorProductAffectedFixed
caddyserver caddy >= 2.7.5, < 2.11.2 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Ubuntu 26.10 caddy No fix yet —
Ubuntu 25.10 caddy No fix yet —
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 26.04 LTS caddy No fix yet —
Ubuntu Pro 24.04 LTS caddy No fix yet —
ReleasePackageFixed inAdvisory
openSUSE Leap 16.0 govulncheck-vulndb 0.0.20260723T184607-160000.1.1 openSUSE-SU-2026:21483-1
openSUSE Leap 15.6 govulncheck-vulndb 0.0.20260317T205859-150000.1.152.1 SUSE-SU-2026:1042-1
ReleasePackageFixed inAdvisory
Alpine v3.24 caddy 2.11.2-r0 —
Alpine v3.23 caddy 2.11.2-r0 —

Affected packages

EcosystemPackageAffectedFixedRecord
Go github.com/caddyserver/caddy/v2 >= 2.7.5, < 2.11.2 2.11.2 GO-2026-4644
Go github.com/caddyserver/caddy/v2/modules/caddyhttp >= 2.7.5, < 2.11.2 2.11.2 GHSA-m2w3-8f23-hxxf

Advisories 2

References