Summary
oxyno-zeta/s3-proxy contains an authentication bypass where the auth middleware and S3 bucket handler interpret URL paths differently, especially around percent-encoding and glob pattern matching.
An unauthenticated attacker with network access can exploit this mismatch to perform unauthorized PUT, GET, and DELETE operations on objects in S3 namespaces that are intended to be authentication-protected.
Affected context
This issue affects deployments of oxyno-zeta/s3-proxy that:
- Rely on s3-proxy for fronting AWS S3 buckets or compatible object storage
- Use path-based rules to distinguish open vs. protected namespaces
- Configure authentication/authorization via glob-style patterns on URL paths
The vulnerability emerges when:
- The authentication middleware evaluates access rules using the percent-encoded request URI (
r.URL.RequestURI()), and - The bucket handler derives S3 object keys from the decoded path (
r.URL.Path), - While the globbing library is used without a path separator, allowing
*to span across/boundaries.
Exploit preconditions
- Attack surface: HTTP(S) interface exposed by s3-proxy (e.g., internet-facing or internal API).
- Required access: Network-level ability to send HTTP requests to the s3-proxy instance; no prior authentication is required.
- Trigger point: Requests targeting paths that:
- Match an "open" pattern at the auth middleware, but
- Resolve to an authentication-protected S3 namespace at the bucket handler.
- Why exploitation is possible:
- The auth layer inspects the raw, percent-encoded request URI, while the storage layer uses the decoded path, leading to inconsistent routing decisions.
- The glob library is used without a path separator, so patterns like
*can match across/characters, enabling traversal into protected namespaces. - Go's URL parsing normalizes dot-dot segments (
../), which can move a request from an open route to a protected path between the two processing stages.
Why this happens
The core issue is an inconsistent interpretation of the request path across security and business logic layers, combined with overly permissive glob matching.
At the authentication layer, access rules are evaluated against r.URL.RequestURI(), which preserves percent-encoding and does not resolve traversal segments. At the bucket handler, S3 object keys are derived from r.URL.Path, which is decoded and normalized. This divergence means a single HTTP request can appear to target an "open" path to the auth middleware while resolving to a protected path when the S3 key is constructed.
Using the glob library without a defined path separator causes * to match arbitrary substrings including /, allowing patterns intended to guard specific directories or prefixes to unintentionally cover multiple path segments. When combined with encoded slashes (%2F) and ../ segments, this leads to a CWE-22: Path Traversal style navigation into protected namespaces, and ultimately a CWE-863: Incorrect Authorization condition where authorization checks are performed against a different effective resource than the one actually accessed.
Potential impact
- Unauthenticated clients may read objects from S3 paths that are configured to require authentication.
- Attackers could write or overwrite objects in protected namespaces, potentially:
- Injecting malicious content
- Corrupting configuration or application assets
- Poisoning data pipelines that consume those objects
- Unauthorized deletion of objects in protected S3 prefixes, leading to data loss or service disruption.
- Abuse of the proxy as a pivot to compromise downstream services that implicitly trust data stored in protected S3 locations.
General mitigation guidance
Effective mitigation focuses on aligning path handling across all layers and hardening authorization boundaries:
- Ensure that the same, fully-normalized and decoded path representation is used both for authorization decisions and for deriving S3 object keys.
- Avoid relying on raw, percent-encoded request URIs for access control; decode and normalize paths before policy evaluation.
- Configure path-matching libraries with explicit path separators so that glob tokens like
*and**cannot inadvertently span directory boundaries unless that behavior is deliberately intended and understood. - Prefer prefix- or exact-match policies for sensitive namespaces over broad, ambiguous glob patterns.
- Treat traversal tokens (
..,.) and encoded slashes (%2F,%2f) as high-risk; normalize or reject requests containing them when they target protected namespaces. - Segment highly sensitive S3 prefixes behind stricter, defense-in-depth controls, such as separate proxies or additional authentication layers, so that a single pattern-matching mistake is less likely to expose critical data.
How teams detect issues like this
Detection can focus on both code-level patterns and runtime behavior:
- Static/code review:
- Search for code paths where authorization logic uses
r.URL.RequestURI()or raw URL strings, while downstream handlers user.URL.Pathor other decoded/normalized representations. - Flag uses of globbing libraries on URL paths where no explicit path separator is configured, especially in authentication or routing logic.
- Review any custom path normalization or routing code for discrepancies between security checks and storage or forwarding logic.
- Automated analysis:
- Add static analysis rules to CI that detect mismatched URL handling in authentication middleware vs. handlers.
- Use policy-as-code (e.g., Open Policy Agent) to centralize and enforce path normalization and access rules consistently.
- Runtime monitoring:
- Log both the raw request URI and the resolved S3 key for each request, and monitor for cases where unauthenticated requests access protected prefixes.
- Alert on suspicious patterns such as
%2F,%2f, or../appearing in paths that should be strictly controlled.

