Miggo Logo

CVE-2023-45133:
Babel vulnerable to arbitrary code execution when compiling specifically crafted malicious code

9.4

CVSS Score
3.1

Basic Information

EPSS Score
0.21149%
Published
10/16/2023
Updated
4/4/2024
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
@babel/traversenpm< 7.23.27.23.2
@babel/traversenpm>= 8.0.0-alpha.0, < 8.0.0-alpha.48.0.0-alpha.4
babel-traversenpm< 7.23.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The primary vulnerable function is _evaluate in packages/babel-traverse/src/path/evaluation.ts. The patch directly modifies this function to add a check for hasOwnProperty, preventing the evaluation of methods from an object's prototype chain. The vulnerability description explicitly names path.evaluate() and path.evaluateTruthy() as the internal Babel methods that, when used by plugins, can lead to arbitrary code execution. The packages/babel-traverse/src/path/index.ts file shows that these methods are part of the NodePath class and are imported from NodePath_evaluation, which contains _evaluate. Therefore, NodePath.evaluate and NodePath.evaluateTruthy are the user-facing functions that trigger the vulnerable code in _evaluate. The confidence is high because the patch directly points to _evaluate, and the advisory explicitly mentions the other two methods as the means by which the vulnerability is triggered.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t Usin* ****l to *ompil* *o** t**t w*s sp**i*i**lly *r**t** *y *n *tt**k*r **n l*** to *r*itr*ry *o** *x**ution *urin* *ompil*tion, w**n usin* plu*ins t**t r*ly on t** `p*t*.*v*lu*t*()`or `p*t*.*v*lu*t*Trut*y()` int*rn*l ****l m*t*o*s. Kno

Reasoning

T** prim*ry vuln*r**l* *un*tion is `_*v*lu*t*` in `p**k***s/****l-tr*v*rs*/sr*/p*t*/*v*lu*tion.ts`. T** p*t** *ir**tly mo*i*i*s t*is *un*tion to *** * ****k *or `**sOwnProp*rty`, pr*v*ntin* t** *v*lu*tion o* m*t*o*s *rom *n o*j**t's prototyp* ***in.