CVE-2015-8861: Cross-Site Scripting in handlebars

handlebars Updated 02 Oct 2025

Summary

23/10/2018
Yes i
Moderate
6.1

CVE-2015-8861: Cross-Site Scripting in handlebars. Affects handlebars versions < 4.0.0. Fixed in 4.0.0. How to fix ↓

Also tracked for

The same CVE-2015-8861 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The handlebars package is an open-source JavaScript library used for creating and rendering templates. It provides a simple and efficient way to generate HTML content dynamically. However, versions prior to 4.0.0 are susceptible to a cross-site scripting (XSS) vulnerability when attributes in handlebar templates are not properly quoted.

Vulnerability Detail

The vulnerability in handlebars arises when attributes in handlebar templates are not enclosed within quotes. This allows an attacker to inject malicious code into the rendered HTML, leading to potential XSS attacks. An example template and input payload demonstrate how an unquoted attribute can be exploited to execute arbitrary JavaScript code. The rendered result shows the injected code being executed. This vulnerability has a CVSS score of 6.1 (Moderate).

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 version below is the minimum fixed release for this vulnerability.

If you need the minimum change

4.0.0

This is the first release that contains the fix.

npm install handlebars@4.0.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

A possible workaround for this vulnerability is to manually quote all attributes in handlebars templates. For example, the vulnerable template <a href={{foo}}/> can be secured by modifying it to <a href="{{foo}}"/>. This ensures that the attribute value is treated as a string and prevents the execution of injected code.

Conclusion

The handlebars package prior to version 4.0.0 is vulnerable to cross-site scripting (XSS) attacks when attributes in handlebar templates are not quoted. It is crucial to update to the latest version or ensure proper quoting of attributes to mitigate this vulnerability. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for handlebars →

Share this vulnerability

FAQ

Handlebars is an open-source JavaScript library used for creating and rendering templates. It simplifies the process of generating dynamic HTML content.

Cross-site scripting is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. It can lead to various attacks, such as stealing sensitive information or performing actions on behalf of the user.

The handlebars vulnerability allows attackers to inject malicious code into rendered HTML, potentially leading to cross-site scripting attacks. This can compromise the security and integrity of affected applications.

To fix the handlebars vulnerability, update to version 4.0.0 or later of the handlebars package. Alternatively, ensure that all attributes in handlebars templates are properly quoted to prevent code injection.

Yes, a workaround for the handlebars vulnerability is to manually quote all attributes in handlebars templates. This helps prevent the injection of untrusted code.

Related vulnerabilities

Recent vulnerabilities recorded for 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 version below is the minimum fixed release for this vulnerability.

If you need the minimum change

4.0.0

This is the first release that contains the fix.

npm install handlebars@4.0.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback