CVE-2025-48947:
NextJS-Auth0 SDK Vulnerable to CDN Caching of Session Cookies
7.7
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
@auth0/nextjs-auth0 | npm | >= 4.0.1, <= 4.6.0 | 4.6.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability (CVE-2025-48947 / GHSA-f3fg-mf2q-fj3f) in the auth0/nextjs-auth0
SDK (versions 4.0.1 to 4.6.0) stems from the potential for CDN caching of HTTP responses that set session cookies. This is due to the absence of appropriate Cache-Control
headers on these sensitive responses. The commit 12a62ca596db3b0827b39a4b865b882423e7cb1e
addresses this by introducing a utility function addCacheControlHeadersForSession
(in src/server/cookies.ts
) and integrating it into several methods of the AuthClient
class (in src/server/auth-client.ts
).
The AuthClient
class is central to handling authentication and session management operations. The methods handleAuthRouter
(specifically its login path), handleLogout
, handleCallback
, handleMe
, and handleAccessToken
are directly involved in processes that create, modify, or utilize session cookies, or return session-related data. In the vulnerable versions, these methods generated HTTP responses (e.g., setting cookies, returning user data, redirecting after logout) without the necessary Cache-Control
directives (like private, no-cache, no-store, must-revalidate, max-age=0
). This omission meant that if a CDN or other shared cache was configured to cache responses even with Set-Cookie
headers, these sensitive responses could be stored and inadvertently served to other users, leading to session hijacking or information disclosure.
The patch explicitly adds calls to addCacheControlHeadersForSession(res)
within these identified methods. This ensures that any response they generate which pertains to session state is correctly marked to prevent caching by shared caches. Therefore, these methods, in their pre-patch state, are the vulnerable functions as they were responsible for emitting responses that could lead to the caching of session cookies. During exploitation, requests to endpoints managed by these functions would result in responses that a misconfigured CDN could cache, triggering the vulnerability. These function names would appear in a runtime profile or stack trace when such vulnerable operations are performed.
Vulnerable functions
AuthClient.handleAuthRouter
src/server/auth-client.ts
AuthClient.handleLogout
src/server/auth-client.ts
AuthClient.handleCallback
src/server/auth-client.ts
AuthClient.handleMe
src/server/auth-client.ts
AuthClient.handleAccessToken
src/server/auth-client.ts