Critical Vulnerability in next-mdx-remote Enables Arbitrary Code Execution in React SSR

A critical vulnerability in next-mdx-remote, a widely used TypeScript library for rendering MDX content in React applications, exposes servers to arbitrary code execution when processing untrusted input.

Tracked as CVE-2026-0969, the flaw was disclosed by HashiCorp on February 11, 2026, via security bulletin HCSEC-2026-01, following discovery by researchers at Sejong University.

This issue affects versions 4.3.0 through 5.0.0, where the serialize function fails to adequately sanitize MDX content with enabled JavaScript expressions, allowing attackers to inject and execute malicious code during server-side rendering (SSR).

The vulnerability stems from insecure handling of dynamic MDX compilation in client or server environments.

When applications permit user-supplied MDX common in content management systems, blogs, or documentation platforms, attackers can embed JavaScript payloads that bypass sanitization.

These payloads leverage globals like eval, Function, process, or require to achieve remote code execution (RCE), potentially leading to full server compromise, data exfiltration, or lateral movement in cloud deployments.

HashiCorp emphasized that the risk is heightened in SSR scenarios, where untrusted content is compiled directly on production servers, echoing tactics seen in recent React ecosystem exploits.

HashiCorp patched the issue in the next-mdx-remote version 6.0.0, introducing breaking changes for enhanced security.

The update sets blockJS to true by default in both serialize and compileMDX functions, disabling JavaScript expressions outright and preventing most RCE vectors.

For legacy use cases requiring expressions, developers can opt out via blockJS: false, but this activates blockDangerousJS, also enabled by default, which blocks high-risk operations on a best-effort basis.

Organizations must audit configurations, as misconfigurations could reintroduce exposure.

CVE IDDescriptionAffected VersionsCVSS ScorePatch Version
CVE-2026-0969Arbitrary code execution due to insufficient sanitization in serialize function when processing untrusted MDX content with JavaScript expressions enabled4.3.0 – 5.0.09.8 (Critical)6.0.0

Affected organizations, particularly those in React/Next.js stacks handling dynamic content, face urgent risks.

Immediate upgrades to 6.0.0 are advised, alongside input validation and content security policies.

Follow us on Google News , LinkedIn and X to Get More Instant UpdatesSet Cyberpress as a Preferred Source in Google

AnuPriya
AnuPriya
Any Priya is a cybersecurity reporter at Cyber Press, specializing in cyber attacks, dark web monitoring, data breaches, vulnerabilities, and malware. She delivers in-depth analysis on emerging threats and digital security trends.

Trending News

Related Stories