Summary
A request-matching inconsistency in the Cedar authorization middleware for Express.js can cause Cedar to authorize a different action from the route that Express ultimately executes. Under certain overlapping route configurations, an attacker may append a query string to obtain access to an endpoint protected by a more restrictive policy.
Affected context
The issue can occur in Express applications using affected versions of the Cedar authorization middleware when:
- Authorization mappings contain overlapping path prefixes
- Different matching paths have different permission requirements
- The middleware uses a URL representation that includes the query string
- Express routes the request using only the path component
This mismatch can cause the authorization decision and executed handler to refer to different logical endpoints.
Exploit preconditions
- Attack surface: HTTP request handling through an Express.js application
- Required access: An ability to send requests to an exposed application endpoint; authentication requirements depend on the application's policies
- Trigger point: Authorization middleware path matching before Express route dispatch
- Why exploitation is possible: The middleware and Express interpret the request URL differently, allowing a less restrictive Cedar action mapping to authorize a request that Express handles as a more restrictive route
Why this happens
The underlying bug is an inconsistent interpretation of request targets between the authorization layer and the web framework.
The middleware matches Cedar actions using req.originalUrl, which includes the query string, while Express route matching uses the path component. With overlapping path patterns, these representations can resolve to different actions and handlers.
This maps primarily to CWE-863: Incorrect Authorization, with characteristics of CWE-436: Interpretation Conflict, because security-relevant components apply different interpretations to the same request.
Potential impact
- An attacker may bypass a more restrictive authorization policy
- Unauthorized users could access protected resources or operations
- Sensitive user or application data may be disclosed
- Application integrity could be affected if protected state-changing routes are exposed
- Authorization policy enforcement may become inconsistent across endpoints
General mitigation guidance
Mitigation generally focuses on ensuring that authorization and routing use the same canonical request representation.
Common defensive patterns include:
- Matching authorization policies against the normalized path component used by Express routing
- Canonicalizing and validating request paths before authorization decisions are made
- Avoiding ambiguous overlapping route mappings with different permission levels
- Applying endpoint-level authorization checks in handlers or trusted route boundaries
- Treating the middleware as one layer of defense rather than the sole authorization control
- Enforcing least-privilege policies for each distinct resource and operation
- Preserving query parameters as data rather than allowing them to influence route identity
How teams detect issues like this
Organizations can identify this class of issue through:
- Static analysis and code review checks for authorization decisions based on raw URLs
- Review of differences between middleware matching logic and framework route matching behavior
- Tests covering query-string variations, trailing delimiters, encoded characters, and overlapping route prefixes
- Policy-to-route consistency checks that verify each executed handler is governed by the intended Cedar action
- Integration tests confirming that authorization decisions remain unchanged when irrelevant query parameters are added
- Automated security review tools that flag inconsistent URL canonicalization and authorization boundaries

