Next.js Vulnerability Let Attackers Bypass Authentication


A high-severity vulnerability has been discovered in the popular web framework, Next.js, which allows attackers to bypass authentication under specific circumstances.

The issue, cataloged as CVE-2024-51479, affects versions from 9.5.5 up to 14.2.14. Developers using these versions must quickly upgrade to the patched version 14.2.15 to secure their applications.

Authorization Bypass in Next.js ( CVE-2024-51479)

The vulnerability stems from a flaw in how Next.js handles authorization checks in middleware based on pathname rules.

– Advertisement –
SIEM as a Service

If an application relies on pathname-based middleware to enforce access control, it may inadvertently expose certain routes to unauthorized access.

Free Webinar on Best Practices for API vulnerability & Penetration Testing:  Free Registration

Specifically, routes directly under the application’s root directory are vulnerable to bypass.

For instance, while the root path such as https://example.com/ remains unaffected, a route like https://example.com/foo could be exploited, whereas deeper nested routes like https://example.com/foo/bar are not impacted.

This vulnerability poses a significant risk for applications that manage sensitive data or services on affected routes.

Exploitation does not require user interaction, credentials, or elevated privileges, making it an attractive target for attackers operating over a network.

The vulnerability is rated as high severity, with a CVSS v3 score of 7.5. Exploiting the vulnerability compromises confidentiality, with unauthorized access to data being the primary concern.

However, it does not affect the integrity or availability of the application. The attack complexity is low, further amplifying the risk, as it requires no special privileges or user interaction to execute.

Patches and Mitigation

The Next.js team has addressed the issue in version 14.2.15. Updating to this version eliminates the vulnerability by ensuring proper authorization checks for all routes, including those directly under the root directory.

For applications hosted on Vercel, this vulnerability has already been mitigated automatically, irrespective of the Next.js version being used.

However, developers running self-hosted or custom deployments should urgently update their projects to the patched version to prevent exploitation.

No official workarounds are available for this vulnerability. The most effective action is to immediately update to Next.js version 14.2.15 or later.

Developers are also encouraged to review their middleware and route protection strategies to ensure robust security measures are in place.

Security audits and monitoring of access logs can help detect any unauthorized activity, particularly for routes that may have been previously exposed.

The vulnerability was responsibly disclosed by tyage, a security researcher from GMO CyberSecurity by IERAE. The Next.js team has expressed its gratitude for the timely and responsible reporting of this issue.

Further details are available in the official advisories published by the Next.js team, highlighting their commitment to maintaining a secure development environment.

Investigate Real-World Malicious Links, Malware & Phishing Attacks With ANY.RUN – Try for Free



Source link