Prototype Pollution in handlebars
Summary
GHSA-g9r4-xpmj-mj65: Prototype Pollution in handlebars. Affects handlebars across 2 version ranges.
< 3.0.8
>= 4.0.0, < 4.5.3
Fixed in 3.0.8 or 4.5.3, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Handlebars is a popular templating engine for JavaScript that allows developers to create dynamic HTML templates. It is widely used in web development frameworks and applications. However, versions of handlebars prior to 3.0.8 or 4.5.3 are vulnerable to prototype pollution. This means that an attacker can manipulate the Object prototype through a malicious template, potentially leading to application crashes or the execution of arbitrary code.
Vulnerability Detail
The vulnerability in handlebars arises from its handling of templates. By crafting a malicious template, an attacker can modify or add properties to the Object prototype. This can have severe consequences, as it allows the attacker to manipulate the behavior of the entire application. They can crash the application by modifying critical properties or execute arbitrary code by adding malicious functions to the prototype. This vulnerability poses a significant risk to the security and stability of applications that use vulnerable versions of handlebars.
How To Fix
Latest published version: 4.7.10 as of 22 Oct 2026
npm install handlebars@4.7.10
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 3.0.83.0.8npm install handlebars@3.0.8 -
>= 4.0.0, < 4.5.34.5.3npm install handlebars@4.5.3
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Conclusion
Prototype pollution in handlebars is a critical vulnerability that allows attackers to manipulate the Object prototype through malicious templates. This can lead to application crashes or the execution of arbitrary code. To protect your application, it is essential to upgrade to version 3.0.8, 4.5.3, or any later release. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for handlebars →
FAQ
Handlebars is a templating engine for JavaScript that allows developers to create dynamic HTML templates. It is widely used in web development frameworks and applications.
Prototype pollution is a vulnerability that allows an attacker to modify the behavior of JavaScript objects by manipulating their prototypes. In the case of handlebars, it allows an attacker to modify or add properties to the Object prototype, potentially leading to application crashes or the execution of arbitrary code.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your package-lock.json file, and Vulert will analyze it for any open-source vulnerabilities, including this handlebars prototype pollution issue.
No, there are no known workarounds for this vulnerability. It is recommended to upgrade to a secure version of handlebars to mitigate the risk.
There are no known public exploits for this vulnerability at the moment. However, it is crucial to update to a secure version of handlebars as soon as possible to prevent any potential attacks.
References
Related vulnerabilities
Recent vulnerabilities recorded for handlebars.