High-Severity RCE Vulnerability Disclosed in next-mdx-remote
HashiCorp disclosed a high-severity RCE in next-mdx-remote affecting versions 4.3.0 to 5.x when compiling untrusted MDX on the server.
- Sarah Gooding

HashiCorp has published HCSEC-2026-01, disclosing a high-severity vulnerability in the popular next-mdx-remote library that can lead to arbitrary code execution when rendering untrusted MDX content on the server.
The issue is tracked as CVE-2026-0969 (GHSA-g4xw-jxrg-5f6m) and carries a CVSS 3.1 score of 8.8 (High).
Versions 4.3.0 up to 6.0.0 Affected
#The vulnerability impacts next-mdx-remote versions 4.3.0 up to, but not including, 6.0.0. It is fixed in version 6.0.0.
next-mdx-remote is a TypeScript library used in Next.js applications to render MDX content from remote or dynamic sources, either on the client or during server-side rendering.

The Vulnerability
#According to the advisory, the serialize function used to compile MDX is vulnerable to arbitrary code execution due to insufficient sanitization of MDX content.
If applications allow untrusted user-supplied MDX content with JavaScript expressions enabled, an attacker may be able to achieve remote code execution in server environments.
The CVE is categorized under CWE-94: Improper Control of Generation of Code (Code Injection). The CVSS vector is:
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
The score reflects network accessibility, low attack complexity, no required user interaction, and high impact to confidentiality, integrity, and availability.
What Changed in 6.0.0
#
Version 6.0.0 introduces a breaking change designed to reduce risk by default.
JavaScript expressions are now disabled by default via blockJS: true in both the serialize and compileMDX functions.
If JavaScript expressions are explicitly enabled with blockJS: false, a new blockDangerousJS: true option is enabled by default. This option provides best-effort protection against potentially dangerous globals and constructs such as eval, Function, process, and require.
The change shifts the default posture from permissive to restrictive, particularly for server-side rendering scenarios that process untrusted content.
Scope of Impact
#For clarity, this is not a vulnerability in Next.js itself. It affects applications that use next-mdx-remote to compile untrusted MDX content on the server. Projects that render only trusted, developer-authored MDX or that compile MDX at build time may not be exposed in the same way.
Who is at Risk
#The advisory specifically calls out deployments that pass untrusted user input into serialize or compileMDX in a server environment.
Applications that:
- Accept user-generated MDX content
- Render that content server-side
- Have JavaScript expressions enabled
are at risk of remote code execution if running a vulnerable version.
Client-only rendering scenarios may have different impact characteristics, but the most serious risk arises when compilation occurs in a server context.
Advisory Ingestion Status
#At the time of publishing, the CVE has been published to the GitHub Advisory Database but is currently marked “Unreviewed,” with no package listed and affected or patched versions shown as unknown. At the time of writing, the authoritative version information is available in HashiCorp’s advisory, which states that versions 4.3.0 up to 6.0.0 are affected and that the issue is fixed in 6.0.0.
Remediation
#HashiCorp credits researchers at Sejong University for disclosing the vulnerability. They recommend evaluating exposure and upgrading to next-mdx-remote 6.0.0.
Because 6.0.0 introduces a breaking change, teams should review how MDX content is compiled and whether JavaScript expressions are required in their use case.
Socket customers will receive alerts for CVE-2026-0969 where affected versions of next-mdx-remote are detected in their dependency graph.
Socket Certified Patches Available
#Socket has published Certified Patches for this vulnerability. These patches can be applied to affected versions of next-mdx-remote without upgrading the dependency.
Certified Patches apply a targeted fix directly to the vulnerable code while preserving the rest of the package’s behavior.
You can install and apply the patch using:
socket patch add GHSA-g4xw-jxrg-5f6m
After installing dependencies, make sure to apply patches as part of your build process.
Certified Patches are free to use and available to anyone, including teams that are not Socket customers.
Learn more about how Certified Patches work:
https://socket.dev/blog/certified-patches




