CVE-2017-1000188: mde ejs XSS in renderFile

CVE-2017-1000188 · Severity: low · CVSS 3 · Published 2017-11-30

EJS is a popular template engine for Node.js used to generate HTML and dynamic content. A cross-site scripting (XSS) vulnerability in the renderFile() function allows attackers to inject malicious code that could be executed in users' browsers, potentially leading to session hijacking, credential theft, or malware distribution.

Technologies: ejs (npm). Vendors: npm.

Quick answers

Is CVE-2017-1000188 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2017-1000188 being exploited in the wild.
How severe is CVE-2017-1000188?
Low severity, with a CVSS score of 3, published 30 November 2017.
Which products and versions are affected?
ejs (npm) SEMVER:introduced=0,fixed=2.5.5.
Is there a fix for CVE-2017-1000188?
Yes. ejs (npm): upgrade to 2.5.5 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2017-1000188 attacked?
It is attacked over the network.
Am I affected by CVE-2017-1000188?
Check whether you run ejs (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • ejs (npm): upgrade to 2.5.5 or later
    npm install ejs@2.5.5

Technical details

The vulnerability is a cross-site scripting (CWE-79) flaw in the ejs.renderFile() function affecting versions prior to 2.5.5. The root cause is improper input validation/sanitization of template data, allowing unsafe options to be passed through the data object without adequate blacklisting. An attacker can inject malicious JavaScript by crafting specially-formatted template data; exploitation requires user interaction (rendering a template with attacker-controlled data). The fix (commit 49264e0) blacklists additional unsafe options from passing through the data object. Patches are available in version 2.5.5 and later.

Affected products

  • mde ejs before 2.5.5

Identifiers

  • CVE-2017-1000188
  • GHSA-hwcf-pp87-7x6p

Timeline

  • 2017-11-30: disclosed
  • 2017: patched: Fixed in version 2.5.5

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.