CVE-2026-46415: Caddy Middleware Unsafe Remoteaddr

Directly reading client IP from `RemoteAddr` in Caddy middleware skips trusted proxy resolution. If the server is behind a reverse proxy, this evaluates the proxy's IP rather than the true client, bypassing IP-based access controls. Use `caddyhttp.GetVar(r.Context(), caddyhttp.ClientIPVarKey)` to retrieve the true client IP securely.

Provally CuratedPublic repositoryHighHigh confidenceVerifiedApache-2.0Go
greprules fetch cve-2026-46415-caddy-middleware-unsafe-remoteaddr --engine opengrep

Description

Directly reading client IP from `RemoteAddr` in Caddy middleware skips trusted proxy resolution. If the server is behind a reverse proxy, this evaluates the proxy's IP rather than the true client, bypassing IP-based access controls. Use `caddyhttp.GetVar(r.Context(), caddyhttp.ClientIPVarKey)` to retrieve the true client IP securely.