Overview
Recently, NSFOCUS CERT detected that Next.js issued a security announcement and fixed the middleware permission bypass vulnerability (CVE-2025-29927). Because Next.js lacks effective verification of the source of the x-middleware-subrequest header, when configuring to use middleware for authentication and authorization, an unauthenticated attacker can bypass system permission controls by manipulating the x-middleware-subrequest header to access the targeted protected resource. At present, the vulnerability details and PoC have been made public. Relevant users are requested to take measures for protection as soon as possible.
Next.js is a React-based open source web framework in the Node.js ecosystem, which provides backend development capabilities through the Server Actions function. NSFOCUS has successfully replicated this vulnerability:


Reference link: https://github.com/vercel/next.js/security/advisories/GHSA-f82v-jwr5-mffw
Scope of Impact
Affected version
- 11.1.4 <= Next.js <= 13.5.6
- 14.0.0 <= Next.js <= 14.2.24
- 15.0.0 <= Next.js <= 15.2.2
Note: This affects Next.js applications that are self-hosted using middleware.
Unaffected Version
- Next.js = 12.3.5
- Next.js >= 13.5.9
- Next.js >= 14.2.25
- Next.js >= 15.2.3
Detection
Cloud detection
NSFOCUS External Attack Surface Management (EASM) supports the Internet asset investigation of CVE-2025-29927 vulnerability risks. Currently, it has helped service customers complete the investigation of exposure surfaces and timely conduct early warning and closed-loop disposal of vulnerabilities before threats occur.
Interested customers can contact NSFOCUS’s local regional colleagues or send an email to rs@nsfocus.com for detailed consultation.
Local screening
NSFOCUS Automated Penetration Test Tool (EZ) supports fingerprint identification for Next.js applications, and the web module can be directly used for scanning detection.
Download link of the tool: https://github.com/m-sec-org/EZ/releases
For new users, please register in the M-SEC community (https://msec.nsfocus.com) and apply for a certificate.
Mitigation
Official upgrade
At present, a new version has been officially released to fix this vulnerability. Please upgrade the protection for affected users as soon as possible.
Download link: https://github.com/vercel/next.js/releases
Temporary protective measures
If the relevant user is temporarily unable to perform the upgrade operation, it can also be temporarily remediated by intercepting the request containing the x-middleware-subrequest header.
Statement
This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.
About NSFOCUS
NSFOCUS, a pioneering leader in cybersecurity, is dedicated to safeguarding telecommunications, Internet service providers, hosting providers, and enterprises from sophisticated cyberattacks.
Founded in 2000, NSFOCUS operates globally with over 4000 employees at two headquarters in Beijing, China, and Santa Clara, CA, USA, and over 50 offices worldwide. It has a proven track record of protecting over 25% of the Fortune Global 500 companies, including four of the five largest banks and six of the world’s top ten telecommunications companies.
Leveraging technical prowess and innovation, NSFOCUS delivers a comprehensive suite of security solutions, including the Intelligent Security Operations Platform (ISOP) for modern SOC, DDoS Protection, Continuous Threat Exposure Management (CTEM) Service and Web Application and API Protection (WAAP). All the solutions and services are augmented by the Security Large Language Model (SecLLM), ML, patented algorithms and other cutting-edge research achievements developed by NSFOCUS.