CVE-2022-29078:
ejs template injection vulnerability
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.99812%
CWE
Published
4/26/2022
Updated
1/30/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
ejs | npm | < 3.1.7 | 3.1.7 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key points: 1) The compile function directly embedded unvalidated outputFunctionName into generated JavaScript code, allowing command injection. 2) The option merging logic in renderFile allowed overwriting internal options via prototype pollution. The commit patched both by adding regex validation (_JS_IDENTIFIER) for option names and destructuredLocals entries, confirming these were the injection vectors. The template compilation's code generation is the ultimate execution point, while the option merging enabled the malicious payload delivery.