Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-46344 Overview
CVE-2025-46344 affects the Auth0 Next.js SDK, a library used to implement user authentication in Next.js applications. Versions from 4.0.1 up to (but not including) 4.5.1 fail to invoke .setExpirationTime when generating JSON Web Encryption (JWE) tokens for user sessions. The resulting JWE lacks an internal expiration (exp) claim. While the session cookie itself may expire or be cleared from the browser, the underlying JWE remains cryptographically valid indefinitely. An attacker who captures a valid JWE can continue using it for authenticated requests after the intended session lifetime. The issue is tracked under CWE-613: Insufficient Session Expiration and was patched in version 4.5.1.
Critical Impact
A captured JWE session token remains valid beyond its intended expiration, enabling session reuse after the user believes they have been logged out.
Affected Products
- Auth0 Next.js SDK (@auth0/nextjs-auth0) version 4.0.1
- Auth0 Next.js SDK versions 4.0.2 through 4.5.0
- Next.js applications relying on the affected SDK versions for session management
Discovery Timeline
- 2025-04-29 - CVE-2025-46344 published to the National Vulnerability Database
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-46344
Vulnerability Analysis
The Auth0 Next.js SDK uses JSON Web Encryption (JWE) tokens stored in cookies to carry session data. In the affected versions, the encryption routine in src/server/cookies.ts did not pass an expiration value to the JWT builder, so .setExpirationTime() was never invoked. The resulting token contained no exp claim.
The session cookie carried a Max-Age attribute enforced by the browser, which gave the appearance of correct expiration. However, server-side validation of the JWE relied solely on cryptographic integrity. A token presented after the cookie would have expired still decrypted and validated successfully.
An attacker who obtains a valid JWE through browser compromise, log exposure, shared infrastructure, or man-in-the-middle access can replay it indefinitely against the application.
Root Cause
The encrypt function in src/server/cookies.ts constructed the JWE without an expiration parameter. Downstream session stores, including stateful-session-store.ts, computed maxAge only for cookie attributes rather than embedding it into the token payload. This mismatch between cookie lifetime and token lifetime created the session persistence flaw.
Attack Vector
Exploitation requires an attacker to obtain a valid JWE session token. The attack is network-based and requires low privileges (an authenticated user whose token is captured). After the legitimate session cookie expires or is cleared, the attacker submits the captured JWE in a request to the application and gains access as the original user.
// Security patch in src/server/cookies.ts
// fix: Ensure JWE expires as expected (#2040)
export async function encrypt(
payload: jose.JWTPayload,
secret: string,
+ expiration: number,
additionalHeaders?: {
iat: number;
uat: number;
Source: auth0/nextjs-auth0 commit a4f061a
// Security patch in src/server/session/stateful-session-store.ts
if (!sessionId) {
sessionId = generateId();
}
-
+
+ const maxAge = this.calculateMaxAge(session.internal.createdAt);
+ const expiration = Date.now() / 1000 + maxAge;
const jwe = await cookies.encrypt(
{
id: sessionId
},
- this.secret
+ this.secret,
+ expiration,
);
- const maxAge = this.calculateMaxAge(session.internal.createdAt);
-
+
resCookies.set(this.sessionCookieName, jwe.toString(), {
...this.cookieConfig,
maxAge
Source: auth0/nextjs-auth0 commit a4f061a
The patch adds a mandatory expiration parameter to encrypt, derives it from the session createdAt and configured maxAge, and passes it to the JWT builder so the resulting JWE contains a valid exp claim.
Detect Identity Attacks the Moment Authentication Fails
Singularity™ Identity surfaces credential misuse, lateral movement, and privilege escalation in real time, so you can contain the breach before it spreads.
Stop Identity AttacksDetection Methods for CVE-2025-46344
Indicators of Compromise
- Successful authenticated requests using session cookies whose Max-Age has elapsed on the client side.
- JWE tokens decoded by the application that do not contain an exp claim.
- Replay of identical session identifiers from multiple source IP addresses or user-agent strings.
- Authenticated activity attributed to users who have performed a logout within the application.
Detection Strategies
- Inventory all Next.js services and verify the installed version of @auth0/nextjs-auth0. Flag any version in the range 4.0.1 through 4.5.0.
- Enable application-level logging that records session token jti or iat values and correlate unusually long-lived identifiers.
- Review access logs for sessions that remain active beyond the configured session lifetime.
- Compare the originating IP, device fingerprint, and user-agent of each authenticated request against the issuing session to identify reuse anomalies.
Monitoring Recommendations
- Instrument the application to reject JWE tokens that lack an exp claim, even on patched builds, as a defense-in-depth measure.
- Centralize authentication events in a SIEM and alert on sessions used after a logout event is recorded.
- Monitor dependency manifests (package.json, package-lock.json) in CI pipelines to detect downgrades to vulnerable SDK versions.
How to Mitigate CVE-2025-46344
Immediate Actions Required
- Upgrade @auth0/nextjs-auth0 to version 4.5.1 or later in all Next.js projects.
- Rotate the session encryption secret (AUTH0_SECRET) after upgrading so previously issued JWEs can no longer be decrypted.
- Invalidate active sessions and require users to re-authenticate.
- Audit authentication logs for session reuse that predates the patch deployment.
Patch Information
The fix was released in @auth0/nextjs-auth0v4.5.1. The code change is tracked in commit a4f061a and documented in GitHub Security Advisory GHSA-pjr6-jx7r-j4r6. The patch introduces a required expiration parameter to the encrypt function and propagates it from the session store to produce JWEs with proper exp claims.
Workarounds
- If immediate upgrade is not feasible, rotate AUTH0_SECRET on a short, scheduled interval to invalidate outstanding JWEs.
- Implement a server-side session allowlist or revocation store keyed by sessionId so that logout and expiration can be enforced independently of the token.
- Reject inbound JWEs that fail to present a valid exp claim at the middleware layer.
# Upgrade the Auth0 Next.js SDK to the patched release
npm install @auth0/nextjs-auth0@^4.5.1
# Verify the installed version
npm ls @auth0/nextjs-auth0
# Rotate the session secret (example for environment configuration)
export AUTH0_SECRET="$(openssl rand -hex 32)"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

