/

CVE-2026-46415

Severity:

HIGH RISK

(8.2)

IP Blocking Bypass (CWE-284) in Caddy Defender

CVE-2026-46415

Deferred

Vulnerability type

Category:

Authorization Bypass via Misconfigured Trust

CWE:

CWE-284, CWE-348

Impact:

IP-based Access Control Bypass

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A logic flaw in the Caddy Defender middleware causes IP-based blocking decisions to rely on the immediate peer address rather than the real client IP when Caddy is deployed behind trusted proxies.

In proxy, CDN, or load-balancer deployments that depend on Caddy's trusted proxy resolution, clients from blocked IP ranges can bypass Defender as long as the proxy's own IP is allowed.

Affected context

This vulnerability arises in Caddy deployments that:

  • Use the Caddy Defender plugin for IP-based blocking or request manipulation
  • Place Caddy behind trusted proxies, CDNs, or load balancers
  • Rely on Caddy's trusted_proxies handling to resolve the original client IP

In these environments, Defender evaluated requests using RemoteAddr (the proxy's IP) instead of Caddy's resolved client_ip, allowing clients from blocked IP ranges to appear allowed when connecting through non-blocked intermediaries.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints protected by Caddy Defender, reachable via a trusted proxy, CDN, or load balancer
  • Required access: Ability to send requests through an intermediary whose IP is not blocked by Defender
  • Trigger point: Evaluation of IP-based rules in Caddy Defender that use RemoteAddr instead of the resolved client IP
  • Why exploitation is possible: The plugin trusts the immediate peer address as the client identity, ignoring Caddy's client_ip resolution logic in proxied deployments, which maps to broken trust and authorization decisions.

Why this happens

The core issue is an authorization decision based on the wrong identity attribute. Defender relied on r.RemoteAddr, which represents the direct TCP peer, even in deployments where Caddy already resolved the actual client IP using its trusted_proxies configuration.

This misalignment between trust resolution and policy enforcement means the access control logic did not operate on the true client identity, corresponding to CWE-284: Improper Access Control and CWE-348: Use of Incorrect Validation of Client-Side Data, where security checks depend on an attribute that does not faithfully represent the entity being controlled.

Potential impact

  • Clients from blocked IP ranges may bypass IP-based blocking when routed through allowed proxies
  • Attackers can reach endpoints that administrators intended to shield via Defender rules
  • Increased exposure of administrative, diagnostic, or rate-limited paths
  • Potential abuse of IP-based throttling, geo-blocking, or ban lists

General mitigation guidance

Effective mitigation focuses on aligning identity resolution with access control decisions and treating network topology explicitly:

  • Ensure IP-based authorization logic consistently uses the canonical, server-resolved client IP attribute rather than raw peer addresses
  • Design middleware and policies to honor existing trusted-proxy and client IP resolution mechanisms provided by the web server or framework
  • Favor edge-layer enforcement (firewalls, CDNs, load balancers) for coarse IP blocking, using application-layer controls as a secondary defense
  • Keep trust boundaries minimal and explicit, avoiding assumptions that the immediate peer always represents the original client
  • Regularly review IP-based rules and security plugins for awareness of proxy headers and trust policies

How teams detect issues like this

Detection typically involves a mix of configuration review and runtime validation:

  • Inspect middleware and access control code for use of direct peer address fields (e.g., RemoteAddr) instead of canonical client IP abstractions
  • Review Caddy and plugin configurations to confirm that trusted proxy resolution and blocking rules rely on the same client IP source
  • Use logging or security analytics to compare recorded client IPs with enforcement decisions, looking for discrepancies between blocked lists and observed traffic
  • Apply static analysis or automated configuration checks to flag authorization logic that bypasses established trust resolution mechanisms
  • Incorporate regression tests that simulate proxied requests from blocked IP ranges to validate that IP-based policies behave as expected

Sources

SourceLink
caddyserver.comcaddyserver.com/docs/caddyfile/matchers#client-ip
caddyserver.comcaddyserver.com/docs/caddyfile/options#trusted-proxies
github.comgithub.com/JasonLovesDoggo/caddy-defender/pull/139
github.comgithub.com/JasonLovesDoggo/caddy-defender/security/advisories/GHSA-3h23-rrpc-3p87

Frequently asked

questions

It is exploitable in deployments where Caddy Defender operates behind trusted proxies, CDNs, or load balancers and relies on Caddy's client IP resolution. In such topologies, any user able to send traffic through an allowed intermediary can potentially bypass IP-based blocking.

No. Exploitation only requires network access to the protected endpoints through a proxy or edge service whose IP address is not blocked. The vulnerability affects IP-based controls regardless of the authentication state of the requester.

The key fix pattern is to centralize and trust a single, canonical client identity representation. Authorization and blocking logic should consistently use server-resolved client IPs that honor trusted-proxy policies, rather than raw connection peers or unvalidated header values.

When designing access controls, explicitly model proxy and CDN layers, verify which component is responsible for client IP resolution, and ensure all security policies consume that resolved identity. Add tests that exercise proxied traffic paths, use defense in depth by enforcing coarse IP blocks at the edge, and periodically audit middleware for assumptions about RemoteAddr and related fields.

Find out what's already
exploitable in your codebase.