HashiCorp Patches Critical RCE Vulnerability in next-mdx-remote Library
Take action: If your React application renders user-supplied MDX content, update next-mdx-remote to version 6.0.0 immediately to enable the new default security blocks. Avoid enabling JavaScript expressions for untrusted input, as even best-effort sanitization can be bypassed by determined attackers.
Learn More
HashiCorp reports a critical vulnerability in next-mdx-remote, a popular TypeScript library used to render MDX content in React applications.
The flaw is tracked as CVE-2026-0969 (CVSS score 9.8) - An arbitrary code execution vulnerability that occurs when the serialize function processes untrusted MDX content with JavaScript expressions enabled. Attackers can inject malicious payloads into MDX inputs, which the library fails to sanitize before compilation. By accessing global objects such as eval, Function, process, or require, an attacker can run system-level commands on the host server.
Successful exploitation allows for full server compromise, enabling attackers to move laterally in cloud environments. Because the malicious code runs with the privileges of the Node.js process, it can access sensitive information. Exposed data items include:
- Server environment variables and secrets
- Internal API credentials and tokens
- Local file system contents
- Cloud infrastructure metadata and configuration
The vulnerability affects next-mdx-remote versions 4.3.0 through 5.0.0.
HashiCorp released next-mdx-remote version 6.0.0 to patch the flaw. The update sets the blockJS parameter to true by default, which disables JavaScript expressions entirely in both serialize and compileMDX functions.
For developers who must enable expressions, the new blockDangerousJS setting provides a best-effort filter against high-risk operations. Administrators should update to version 6.0.0 immediately and audit their configurations to ensure they do not inadvertently reintroduce exposure by opting out of these new security defaults.