Cross-Site Scripting (XSS) Vulnerability in mustache.js

mustache.js Updated 02 Oct 2025

Summary

23/01/2017
N/A
No i
Medium
6.1

CVE-2015-8861: The handlebars package before 4.0.0 for Node.js allows remote attackers to conduct cross-site scripting (XSS) attacks by leveraging a template with an attribute that is not quoted. Affects mustache.js versions 2.3.2-2 – 3.0.1-1. No fix is published. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

mustache.js is a popular JavaScript templating library used for rendering dynamic content in web applications. It provides a simple and intuitive syntax for generating HTML, XML, and other text-based formats. However, an XSS vulnerability (CVE-2015-8861) has been identified in mustache.js versions prior to 4.0.0. This vulnerability allows remote attackers to execute malicious scripts in the context of a user's browser by exploiting unquoted attributes in templates.

Vulnerability Detail

The vulnerability (CVE-2015-8861) arises from the improper handling of unquoted attributes in mustache.js templates. When a template contains an attribute that is not properly quoted, an attacker can inject arbitrary JavaScript code that will be executed when the template is rendered. This can lead to various security issues, including the theft of sensitive user information, session hijacking, and defacement of web pages.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If upgrading to the latest version of mustache.js is not immediately feasible, a temporary workaround can be implemented by manually ensuring that all attributes in templates are properly quoted. This can be achieved by reviewing the templates used in the application and adding quotes around all attribute values. For example, instead of using <div class=example>, it should be written as <div class="example">.

Conclusion

The CVE-2015-8861 vulnerability in mustache.js versions prior to 4.0.0 exposes web applications to cross-site scripting attacks. It is crucial to upgrade to the latest version of mustache.js or manually apply the workaround to mitigate the risk. For further assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for mustache.js →

Share this vulnerability

FAQ

Cross-Site Scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. These scripts can be used to steal sensitive information, manipulate user sessions, or deface websites.

The CVE-2015-8861 vulnerability affects mustache.js versions prior to 4.0.0. It allows remote attackers to conduct XSS attacks by exploiting unquoted attributes in templates. This can lead to the execution of arbitrary JavaScript code in the context of a user's browser.

The consequences of the CVE-2015-8861 vulnerability can be severe. Attackers can use it to steal sensitive user information, manipulate user sessions, deface web pages, or perform other malicious actions. It is important to patch this vulnerability to protect users and maintain the security of web applications.

To fix the CVE-2015-8861 vulnerability, it is recommended to upgrade to mustache.js version 4.0.0 or later. This version includes a fix for the XSS vulnerability by properly quoting all attributes in templates. Developers should update their application's dependencies to use the patched version of mustache.js.

If upgrading to the latest version of mustache.js is not immediately feasible, a temporary workaround can be implemented by manually ensuring that all attributes in templates are properly quoted. This can be achieved by reviewing the templates used in the application and adding quotes around all attribute values.

Related vulnerabilities

Recent vulnerabilities recorded for mustache.js.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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