When using attributes without quotes in a mustache template, an attacker can manipulate the input to introduce additional attributes, potentially executing code. This may lead to a Cross-site Scripting (XSS) vulnerability, assuming an attacker can influence the value entered into the template. If the mustache template is used to render user-generated content, this vulnerability may escalate to a persistent XSS vulnerability.
For example, assume mustache was used to display user comments, using the following template:
If an attacker spoofed his email address and provided the following value:
The resulting HTML would be:
<a firstname.lastname@example.org onload=alert(document.cookie)>Evil Wizard</a><pre>Busted!</pre>
Snyk patch available for versions:
- <2.2.1 >=2.1.0