Miggo Logo

CVE-2022-25863: Unsanitized JavaScript code injection possible in gatsby-plugin-mdx

8.1

CVSS Score
3.1

Basic Information

EPSS Score
0.70545%
Published
6/3/2022
Updated
1/27/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
gatsby-plugin-mdxnpm< 2.14.12.14.1
gatsby-plugin-mdxnpm>= 3.0.0, < 3.15.23.15.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from gatsby-plugin-mdx passing MDX content to gray-matter without disabling its JavaScript frontmatter engine. The core issue manifests in all MDX processing paths (webpack loader, GraphQL node creation) where gray-matter was invoked with default options. The patched versions explicitly set JSFrontmatterEngine: false and remove JS engine support, confirming these grayMatter call sites were the vulnerable points. The test cases in the commit diff validate() that JS frontmatter processing was previously enabled in these functions.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t T** **ts*y-plu*in-m*x plu*in prior to v*rsions *.**.* *n* *.**.* p*ss*s input t*rou** to t** `*r*y-m*tt*r` npm p**k***, w*i** is vuln*r**l* to J*v*S*ript inj**tion in its ****ult *on*i*ur*tion, unl*ss input is s*nitiz**. T** vuln*r**ility

Reasoning

T** vuln*r**ility st*ms *rom `**ts*y-plu*in-m*x` p*ssin* M*X *ont*nt to `*r*y-m*tt*r` wit*out *is**lin* its J*v*S*ript *rontm*tt*r *n*in*. T** *or* issu* m*ni**sts in *ll M*X pro**ssin* p*t*s (`w**p**k lo***r`, `*r*p*QL` no** *r**tion) w**r* `*r*y-m*