handlebars is vulnerable to Code Injection
98
CVE Score
Critical
Code Injection
Handlebars.compile() and Handlebars.precompile() accept a pre-parsed AST, and the validator only checks values on PathExpression, NumberLiteral, and BooleanLiteral nodes. Values such as Program.blockParams.length, the depth on a non-PathExpression param, or a non-string StringLiteral.value/PathExpression.original are written into the generated JavaScript unchecked. An untrusted AST, such as a parsed JSON request body, can insert arbitrary JavaScript into the generated output so it runs on the server with compile() or wherever the precompiled output later loads. The fix validates these values directly at each compiler write site and restricts node type dispatch to known node types.
Upgrade the handlebars library to the patch version.
You are affected if you are using a version that falls within the vulnerable range and you pass an untrusted pre-parsed AST, such as a parsed JSON request body, into compile() or precompile().
3.0.0 - 4.7.9
Fixed in 4.7.10handlebars is vulnerable to Code Injection in versions 3.0.0 - 4.7.9.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.