CVE-2016-10547 Cross-Site Scripting in nunjucks

Medium 6.1 Published Updated

Attackers can bypass autoescaping in Nunjucks templates to inject malicious scripts into the DOM, potentially executing arbitrary code in user browsers.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2016-10547?

CVE-2016-10547 is a medium-severity cross-site scripting vulnerability in HackerOne nunjucks node module, published on 31 May 2018. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Nunjucks is a full featured templating engine for JavaScript. Versions 2.4.2 and lower have a cross site scripting (XSS) vulnerability in autoescape mode. In autoescape mode, all template vars should automatically be escaped. By using an array for the keys, such as `name[]=<script>alert(1)</script>`, it is possible to bypass autoescaping and inject content into the DOM.

Weakness: CWE-79

Which versions are affected by CVE-2016-10547?

2 open source packages ship an affected version, including nunjucks. It affects 1 product.

PackageAffectedFixed in
nunjucks npmAll versions2.4.3
nunjucks npmAll versions2.4.3

Products include Mozilla Nunjucks.

How do I fix CVE-2016-10547?

Upgrade nunjucks to 2.4.3 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2016-10547 being exploited?

There is no known exploitation of CVE-2016-10547 in the wild and no public exploit code.

Sources

Also known as GHSA-f7ph-p5rv-phw2.

Is CVE-2016-10547 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free