OpenNext Cloudflare: Cache interception can bypass middleware protection for encoded pathsGHSA-2vc4-c4r6-p6v6
HIGHFix: opennextjs/opennextjs-aws#1199GHSA-2vc4-c4r6-p6v6 is a high-severity (CVSS 7.5) CWE-177 vulnerability in @opennextjs/cloudflare. A fix is available for @opennextjs/cloudflare — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-2vc4-c4r6-p6v6.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-2vc4-c4r6-p6v6 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@opennextjs/cloudflarenpmDescription
Summary
When cache interception is enabled, @opennextjs/cloudflare can interpret percent-encoded paths differently during middleware matching and cache lookup.
An encoded request may fail to match authorization middleware, then be decoded into the cache key of a protected route. The cached response may consequently be returned without invoking the middleware.
enableCacheInterception is disabled by default.
Impact
A remote unauthenticated attacker may retrieve cached content from routes intended to be protected by middleware.
An application is affected when it:
- explicitly enables
enableCacheInterception; - relies on middleware for access control; and
- has a matching cached route.
Details
Middleware matching previously used the encoded request pathname, while cache interception decoded the pathname before selecting a cache entry.
For example, consider an application with:
- middleware matcher
/admin/:path*; - middleware returning
401 Authentication requiredfor/admin; - a statically generated, cached
/adminroute; and - cache interception enabled:
export default defineCloudflareConfig({
incrementalCache: staticAssetsIncrementalCache,
enableCacheInterception: true,
});
An attacker can request:
GET /%61dmin
The encoded pathname does not match /admin/:path*, so the authorization middleware is not invoked. Cache interception then decodes %61dmin to admin and may return the cached /admin response:
HTTP/1.1 200 OK
x-opennext-cache: HIT
Protected content
Malformed paths exposed an additional inconsistency. For example:
GET /%61dmin/%ZZ
The previous implementation decoded each segment independently. It decoded %61dmin to admin but retained the malformed %ZZ segment, allowing cache lookup to continue using a partially decoded pathname.
Patches
The fix aligns encoded-path handling across middleware matching and cache lookup, and rejects malformed paths instead of partially decoding them. See the upstream fixes in opennextjs-aws#1199 and opennextjs-aws#1200.
Users should upgrade to @opennextjs/[email protected] or later.
Workarounds
If upgrading is not immediately possible for an application:
- Disable cache interception by removing
enableCacheInterception: true. - Enforce authorization inside protected route handlers rather than relying exclusively on middleware.
- Reject encoded paths for protected routes at a trusted proxy before they reach the Worker.
Adding individual encoded matcher variants is not a complete workaround because pathnames can have multiple equivalent encodings.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @opennextjs/cloudflare | ≥ 0.3.0&&< 1.20.2 | 1.20.2npm install @opennextjs/cloudflare@1.20.2 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @opennextjs/cloudflare, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @opennextjs/cloudflare to 1.20.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-2vc4-c4r6-p6v6 is resolved across your whole dependency graph.
Workarounds
Put an independent control in front of the weakness: restrict the affected endpoint or interface to trusted networks, require an additional authentication factor or proxy-level check, and invalidate existing sessions and credentials in case the flaw has already been used.
Frequently Asked Questions
Is GHSA-2vc4-c4r6-p6v6 in your dependencies?
Find it across npm, including transitive dependencies.