Impact
Handlebars.js versions 4.0.0 through 4.7.8 allow an attacker to inject a specially crafted property into Object.prototype. When the runtime resolves a partial name, it performs a plain property lookup on options.partials without guarding against prototype‑chain traversal. If Object.prototype contains a string value whose key matches a partial reference, that string is used as the partial body and rendered without HTML escaping, leading to reflected or stored XSS. The weakness is a Prototype Pollution flaw (CWE‑1321) combined with a Reflected XSS condition (CWE‑79).
Affected Systems
The vulnerability affects projects that use Handlebars.js versions 4.0.0 through 4.7.8, including any Node.js applications that depend on the handlebars-lang:handlebars.js library. Versions starting at 4.7.9 are not impacted.
Risk and Exploitability
The CVSS score is 4.7, indicating a low to moderate severity, and the EPSS score is below 1%, suggesting a low exploitation probability in the wild. The vulnerability is not listed in the CISA KEV catalog. An attacker would need to supply a template that references the polluted partial name; once executed, the malicious payload can execute arbitrary JavaScript within the victim’s browser context. The attack can be carried out from the client side if an attacker controls template rendering, making it a practical risk in web applications that allow dynamic template injection.
OpenCVE Enrichment
Github GHSA