Summary
A path handling inconsistency in Caddy on Windows lets certain request URLs bypass path-scoped authentication and deny rules intended to protect private files.
When a URL uses mixed slashes, the matcher may treat it as outside protected paths while the file server resolves it inside them, allowing unauthenticated access to sensitive content under specific path patterns.
Affected context
This vulnerability arises in Caddy deployments running on Windows where path-based routing and access control are used to protect directories like /private/*.
The issue is triggered when clients send URLs that mix forward and backslashes, causing the path matcher to interpret the request as outside a protected scope while the filesystem resolution treats it as inside the directory.
It primarily affects configurations that rely on path matchers for authentication or deny rules around sensitive file paths, rather than additional enforcement layers.
Exploit preconditions
- Attack surface: HTTP(S) interface exposed by Caddy on Windows systems
- Required access: Unauthenticated remote access to the Caddy server
- Trigger point: Requests targeting protected routes (e.g.,
/private/*) using crafted paths such as/private\secret.txt - Why exploitation is possible: The URL path matching logic normalizes and evaluates paths differently than the underlying file server, so a request can appear outside the protected pattern to the matcher while still resolving to a protected file on disk.
Why this happens
The root cause is a mismatch between logical path matching and filesystem resolution, linked to CWE-22: Improper Limitation of a Pathname to a Restricted Directory and CWE-284: Improper Access Control.
Caddy's path matchers on Windows evaluate route scopes using one interpretation of the URL (treating /private\secret.txt as outside /private/*), while the file server uses Windows path semantics and resolves private\secret.txt as a file inside the protected directory.
This discrepancy breaks assumptions about path-scoped security rules: access control checks are performed on one path representation while actual resource access is based on another, causing certain requests to bypass intended restrictions.
Potential impact
- Unauthenticated clients can access files intended to be protected under path-limited auth or deny rules
- Exposure of sensitive configuration, logs, or user data stored in "private" directories
- Bypass of application-level authorization enforced via path-based matchers
- Potential information disclosure that can assist further attacks against the server or backend systems
General mitigation guidance
Mitigation centers on aligning path validation with resource resolution and reducing reliance on fragile path semantics.
Secure patterns include consistently normalizing and canonicalizing request paths before applying matchers or authorization rules, avoiding mixed slash forms in route definitions, and designing access control based on explicit resource mappings instead of loosely defined path prefixes.
Deployments can also layer defenses by combining path-based rules with stronger authentication and authorization controls, and by minimizing the exposure of sensitive files through separate storage locations or processes that do not depend solely on web path patterns.
How teams detect issues like this
Detection can focus on identifying inconsistent path handling between routing logic and filesystem access.
Static analysis and configuration reviews may look for path-based auth or deny rules that rely on glob-style patterns (e.g., /private/*) on Windows deployments, especially where backslash handling is unclear.
Log analysis can flag repeated access to protected directories using mixed-slash paths, indicating possible probing or exploitation attempts.
Policy enforcement in CI/CD pipelines can require explicit path normalization and canonicalization in server configuration, and security testing tools can incorporate test cases that exercise mixed path separators against protected routes to reveal inconsistencies.

