Critical Vulnerability in Next-Mdx-Remote Allows Arbitrary Code Execution in React Server-Side Rendering
A security vulnerability identified as CVE-2026-0969 has been discovered in the next-mdx-remote library, impacting versions 4.3.0 through 5.0.0. This vulnerability allows for arbitrary code execution when rendering untrusted MDX content on servers. The…
A security vulnerability identified as CVE-2026-0969 has been discovered in the next-mdx-remote library, impacting versions 4.3.0 through 5.0.0. This vulnerability allows for arbitrary code execution when rendering untrusted MDX content on servers. The issue has been resolved in version 6.0.0 of the library.
Next-mdx-remote is an open-source TypeScript library frequently used in Next.js-based React applications. It enables developers to render MDX (Markdown with JSX) content dynamically from various sources, such as databases and APIs, on both server and client sides.
The vulnerability is associated with the library's serialize and compileMDX functions, which previously did not properly sanitize JavaScript expressions in untrusted MDX content. This flaw allows attackers to inject malicious code, including eval() , Function() , or require() expressions, that may be executed with server privileges during server-side rendering (SSR).
Aspect Information
CVE ID CVE-2026-0969
A security vulnerability identified as CVE-2026-0969 has been discovered in the next-mdx-remote library, impacting versions 4.3.0 through 5.0.0.
Affected Versions 4.3.0 to 5.0.0
CVSS Score Critical (estimated 9.8/10)
Impact Remote Code Execution (RCE) on SSR with untrusted MDX
Version 6.0.0 introduces changes that block JavaScript expressions by default (blockJS: true). If JavaScript expressions must be enabled (blockJS: false), a new option, blockDangerousJS: true , is available to filter out potentially harmful globals such as process , eval , and require .
It is strongly recommended to upgrade to next-mdx-remote 6.0.0 if handling untrusted MDX content on servers. Review code for compileMDX or serialize function calls to ensure proper sanitization. Utilizing libraries like remark-rehype can provide additional safety measures. Conduct thorough testing in a staging environment to identify any issues resulting from the updated defaults.
Based on reporting by Cyber Security News.
