A critical security vulnerability tracked as CVE-2024-51479 has been identified in Next.js, a widely used React framework for building web applications.
The flaw allowed unauthorized access to certain pages directly under the application’s root directory, bypassing middleware-based authorization checks. This issue has raised significant concerns due to Next.js’ extensive adoption by developers and organizations worldwide.
The vulnerability affected Next.js versions 9.5.5 through 14.2.14. It stemmed from how middleware authorization was implemented based on the pathname of requests.
Specifically, pages located directly under the root directory (e.g., `https://example.com/foo`) were vulnerable, while the root itself (`https://example.com/`) and nested paths (`https://example.com/foo/bar`) remained unaffected.
This bypass could have enabled attackers to gain unauthorized access to sensitive application data or functionality if proper authorization mechanisms had not been implemented elsewhere in the application.
The vulnerability was assigned a CVSS score of 7.5, indicating high severity. Given the widespread use of Next.js in enterprise and consumer-facing applications, this flaw posed a significant risk to user data and business operations.
Investigate Real-World Malicious Links, Malware & Phishing Attacks With ANY.RUN – Try for Free
Organizations relying on middleware for authorization checks were particularly vulnerable if they had not updated their applications.
The Next.js team promptly addressed the issue by releasing a patch in version 14.2.15 and later. Developers are strongly advised to upgrade their applications to this version or newer to eliminate the risk of exploitation.
For applications hosted on Vercel, the platform that created Next.js, the vulnerability has been automatically mitigated through proactive measures implemented by Vercel’s firewall.
This ensures that even applications running older versions of Next.js are protected against this specific flaw.
Unfortunately, this vulnerability has no official workarounds apart from upgrading to a patched version of Next.js. Developers must prioritize updating their dependencies to secure their applications effectively.
To protect against potential exploitation:
- Update your Next.js application to version 14.2.15 or later immediately.
- If hosting on Vercel, verify that your deployment benefits from their automatic mitigation.
- Review your application’s authorization logic to ensure robust security measures beyond middleware checks.
This incident underscores the importance of staying vigilant about security updates and regularly auditing application dependencies for vulnerabilities.
By addressing such issues promptly, developers can safeguard their applications and users from potential threats.