handlebars
cpe:2.3:a:handlebarsjs:handlebars:*:*:*:*:node.js:*:*, +1 more
- >= 4.0.0, <= 4.7.8
A vulnerability in the Handlebars JavaScript library, specifically in versions 4.0.0 through 4.7.8, allows for remote code execution. This issue arises when a crafted object is placed in the template context, bypassing all conditional guards in the `resolvePartial()` function. As a result, the `invokePartial()` function returns `undefined`, which the Handlebars runtime interprets as a signal to compile the partial. The injected object, being a valid Handlebars Abstract Syntax Tree (AST) containing malicious code, is executed on the server. Exploitation requires control over a value that can be returned by a dynamic partial lookup, such as `{{> (lookup ...)}}`, in contexts where user-supplied data is processed.
Exploitation of this vulnerability allows for arbitrary code execution on the server where the affected Handlebars version is used.
To reproduce this vulnerability, create a Handlebars template that uses dynamic partial lookups. Inject a crafted object into the context that exploits the `resolvePartial()` and `invokePartial()` functions, bypassing the normal checks and leading to the execution of injected code.
Update Handlebars to version 4.7.9 or later, and consider using the runtime-only build to avoid the vulnerability.
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.