CVE-2024-51479

7.5 HIGH

📋 TL;DR

This CVE describes an authorization bypass vulnerability in Next.js middleware. Attackers can bypass pathname-based authorization checks for pages directly under the application's root directory, potentially accessing restricted content. Only Next.js applications using middleware for authorization based on pathnames are affected.

💻 Affected Systems

Products:
  • Next.js
Versions: Versions before 14.2.15
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only affects applications using middleware for authorization based on pathnames. Applications hosted on Vercel are automatically mitigated regardless of Next.js version.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Unauthorized users gain access to sensitive pages and data that should be protected by authorization middleware, potentially leading to data breaches or privilege escalation.

🟠

Likely Case

Attackers bypass authorization to access restricted pages or content that should only be available to authenticated/authorized users.

🟢

If Mitigated

If proper authentication is implemented at the application level (not just middleware) or if the application doesn't use pathname-based authorization in middleware, impact is minimal.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires knowledge of application structure and affected paths. No public exploit code identified at this time.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 14.2.15 and later

Vendor Advisory: https://github.com/vercel/next.js/security/advisories/GHSA-7gfc-8cq8-jh5f

Restart Required: Yes

Instructions:

1. Update Next.js to version 14.2.15 or later using npm/yarn/pnpm. 2. Run 'npm update next' or 'yarn upgrade next' or 'pnpm update next'. 3. Restart your Next.js application. 4. Test authorization functionality.

🔧 Temporary Workarounds

No official workarounds

all

The vendor states there are no official workarounds for this vulnerability

🧯 If You Can't Patch

  • Move authorization logic from middleware to individual page components or API routes
  • Implement additional authentication checks at the application level beyond middleware

🔍 How to Verify

Check if Vulnerable:

Check if your Next.js application uses middleware for authorization based on pathnames and is version <14.2.15

Check Version:

npm list next | grep next or check package.json

Verify Fix Applied:

Verify Next.js version is 14.2.15 or later and test authorization functionality for pages directly under root directory

📡 Detection & Monitoring

Log Indicators:

  • Unauthorized access attempts to pages directly under root directory
  • Successful access to protected pages without proper authentication logs

Network Indicators:

  • HTTP requests to root-level pages that should be protected
  • Unusual access patterns to /foo, /bar, etc. paths

SIEM Query:

web.access AND (path:"/foo" OR path:"/bar" OR path:"/[root-level-page]") AND NOT auth.success

🔗 References

📤 Share & Export