next-mdx-remote Vulnerability Allows Arbitrary Code Execution in React SSR
A security vulnerability has been identified in next-mdx-remote, a TypeScript library used for rendering MDX content in React applications.
A security vulnerability has been identified in next-mdx-remote, a TypeScript library used for rendering MDX content in React applications.
The vulnerability, tracked as CVE-2026-0969, was discovered by researchers at Sejong University. It allows attackers to execute arbitrary code on servers when processing untrusted MDX content.
The affected function is serialize , present in next-mdx-remote versions 4.3.0 through 5.0.0. This function is utilized for compiling MDX content for dynamic rendering.
HashiCorp disclosed the vulnerability on February 11, 2026, under bulletin HCSEC-2026-01. The issue arises due to inadequate sanitization of MDX content when JavaScript expressions are enabled. Attackers can inject malicious code via user-supplied MDX content, potentially achieving remote code execution on affected servers.
Next-mdx-remote version 6.0.0 addresses this vulnerability by implementing significant security enhancements. The update includes a breaking change, disabling JavaScript expressions by default using the blockJS option set to true for both serialize and compileMDX functions, thereby preventing arbitrary code execution in most scenarios.
A security vulnerability has been identified in next-mdx-remote, a TypeScript library used for rendering MDX content in React applications.
For applications that require JavaScript expressions, version 6.0.0 offers an additional safety measure through the blockDangerousJS option. This is enabled by default when blockJS is set to false, providing protection against dangerous operations such as eval , Function , process , require , and other global objects that could facilitate code execution attacks.
CVE ID Description Affected Versions
CVE-2026-0969 Arbitrary code execution due to insufficient sanitization in serialize function when processing untrusted MDX content with JavaScript expressions enabled 4.3.0 – 5.0.0
Organizations using next-mdx-remote in environments where untrusted user input is processed should assess their exposure to this vulnerability. Upgrading to version 6.0.0 is strongly recommended to mitigate the risk of arbitrary code execution.
Administrators should ensure proper configuration of the new security options and verify that JavaScript expressions are enabled only when necessary and with appropriate safeguards in place.
Based on reporting by GBHackers.
