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-8862: mustache package before 2.2.1 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

mustache.js is an open-source JavaScript templating library that allows developers to render dynamic content on web pages. It is commonly used in Node.js applications for server-side rendering. However, a vulnerability has been discovered in versions prior to 2.2.1 that allows remote attackers to conduct cross-site scripting (XSS) attacks. This vulnerability arises when a template with an unquoted attribute is used, enabling an attacker to inject malicious code into the rendered output.

Vulnerability Detail

The vulnerability, identified as CVE-2015-8862, originates from the lack of proper attribute quoting in mustache.js templates. By exploiting this vulnerability, an attacker can inject arbitrary JavaScript code into the rendered output, potentially leading to the execution of malicious actions in the context of the user's browser. This can result in various security risks, including unauthorized access to sensitive 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 is not immediately feasible, a temporary workaround can be implemented by manually ensuring that all attributes in mustache.js templates are properly quoted. This can be achieved by adding double quotes around attribute values in the template code. For example, change <div class=foo> to <div class="foo">. However, this workaround is not recommended as it may introduce human error and is not a long-term solution.

Conclusion

The cross-site scripting (XSS) vulnerability in mustache.js versions prior to 2.2.1 poses a significant security risk to web applications using this library. It is crucial to promptly upgrade to the latest version or apply the recommended workaround to mitigate the risk of XSS attacks. Regularly monitoring for open-source vulnerabilities, such as using Vulert's automated scanning, can help ensure the ongoing security of your application.

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. This can lead to the theft of sensitive information, unauthorized access to user accounts, and other malicious activities.

The mustache.js XSS vulnerability occurs when a template with an unquoted attribute is used. This allows an attacker to inject arbitrary JavaScript code into the rendered output, potentially leading to XSS attacks.

To check if your application is affected by this vulnerability, you can use Vulert's playground at Vulert Scanner. Simply upload your package-lock.json file, and Vulert will analyze it for any open-source vulnerabilities, including this XSS vulnerability in mustache.js.

While specific exploits targeting this vulnerability have not been disclosed, it is important to promptly address and fix vulnerabilities to prevent potential attacks. By upgrading to the latest version of mustache.js or applying the recommended workaround, you can mitigate the risk of XSS attacks.

For further support and assistance in remediating this vulnerability, you can reach out to info@devnack.com. Our team of experts will be happy to help you secure your application and address any concerns.

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