Categories
CVE-2022-25863 high CVSS 8.1

Unsafe Deserialization in gatsby-plugin-mdx (CVE-2022-25863)

Summary

Vulnerability in gatsby-plugin-mdx (CVE-2022-25863). Confidential information can be exposed externally. Exploitable via JSFrontmatterEngine. Mitigation: upgrade to 3.15.2 or later.

Original description

The description as published by the source.

Impact

The gatsby-plugin-mdx plugin prior to versions 3.15.2 and 2.14.1 passes input through to the gray-matter npm package, which is vulnerable to JavaScript injection in its default configuration, unless input is sanitized. The vulnerability is present when passing input in both webpack (MDX files in src/pages or MDX file imported as component in frontend / React code) and data mode (querying MDX nodes via GraphQL). Injected JavaScript executes in the context of the build server.

To exploit this vulnerability untrusted/unsanitized input would need to be sourced or added into an MDX file. The following MDX payload demonstrates a vulnerable configuration:

---js
((require("child_process")).execSync("id >> /tmp/rce"))
--- 

Patches

A patch has been introduced in gatsby-plugin-mdx@3.15.2 and gatsby-plugin-mdx@2.14.1 which mitigates the issue by disabling the gray-matter JavaScript Frontmatter engine. The patch introduces a new option, JSFrontmatterEngine which is set to false by default. When setting JSFrontmatterEngine to true, input passed to gatsby-plugin-mdx must be sanitized before processing to avoid a security risk. Warnings are displayed when enabling JSFrontmatterEngine to true or if it appears that the MDX input is attempting to use the Frontmatter engine.

Workarounds

If an older version of gatsby-plugin-mdx must be used, input passed into the plugin should be sanitized ahead of processing.

**We encourage projects…

Source: NIST National Vulnerability Database NVD GitHub Advisory

Auto-generated summary

Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.

A vulnerability tracked as CVE-2022-25863 has been found in gatsby-plugin-mdx.
Attackers can target a specific entry point like JSFrontmatterEngine over the network to misuse the product.
Confidential information can be exposed externally. CVSS score: 8.1/10.
What to do: upgrade gatsby-plugin-mdx to 3.15.2 or later.
If unsure, ask your IT team or search "gatsby-plugin-mdx CVE-2022-25863" on the vendor's site.

CVE-2022-25863 (gatsby-plugin-mdx) — CWE-502 / CVSS v3 8.1
Attack vector: remote (network-reachable) / no user interaction
Attack surface: JSFrontmatterEngine / false / true
Patched: 3.15.2 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.

❓ What is the problem

Unsafe deserialization (CWE-502) exists in gatsby-plugin-mdx. Attackers reach the vulnerable code path via JSFrontmatterEngine.

📍 Affected scope

Check the vendor advisory for the affected versions of gatsby-plugin-mdx. Attack surface: JSFrontmatterEngine / false / true.

🔥 Severity

Severity: High (CVSS 8.1/10). Confidential information can be exposed externally.

🔧 How to fix

Update to 3.15.2.

🛡️ Workaround

Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.

🔍 Detection

Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'gatsby-plugin-mdx' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.

Response actions

Concrete steps and command examples for SOC/SRE teams to execute in order

  1. 1
    Identify exposure identify
    grep -r 'gatsby-plugin-mdx' . | grep -v node_modules

    リポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で gatsby-plugin-mdx を grep し、稼働しているサービス・バージョンを把握する。

  2. 2
    Apply patch patch
    Upgrade gatsby-plugin-mdx to 3.15.2

    ステージング環境で 3.15.2 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。

  3. 3
    Post-deployment verification verify
    Confirm patched version is live in production

    パッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。

Affected packages

npm gatsby-plugin-mdx
[{"type":"SEMVER","events":[{"introduced":"3.0.0"},{"fixed":"3.15.2"}]}]

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details