CVE-2020-8141: doT code injection in template compilation

CVE-2020-8141 · Severity: low · CVSS 3.1 · Published 2022-05-24

The doT library, a fast template engine for Node.js, contains a security flaw that allows for unauthorized code execution. If an attacker can influence the templates used by an application or manipulate global object properties, they can run malicious commands on the server. This could lead to a full system takeover, data theft, or service disruption.

Technologies: dot (npm). Vendors: npm.

Quick answers

Is CVE-2020-8141 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2020-8141 being exploited in the wild.
How severe is CVE-2020-8141?
Low severity, with a CVSS score of 3.1, published 24 May 2022.
Which products and versions are affected?
dot (npm) SEMVER:introduced=0,fixed=1.1.3.
Is there a fix for CVE-2020-8141?
Yes. dot (npm): upgrade to 1.1.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2020-8141 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2020-8141?
Check whether you run dot (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

  • dot (npm): upgrade to 1.1.3 or later
    npm install dot@1.1.3

Technical details

The doT package (v1.1.2 and earlier) utilizes the JavaScript Function() constructor to compile templates, which is a form of 'eval-like' behavior. This creates a code injection vulnerability (CWE-94) if an attacker can provide a malicious template string. Additionally, the library is susceptible to prototype pollution; if an attacker can modify Object.prototype, they can inject malicious code that is executed during the template compilation process. The attack requires the ability to reach the template engine with user-controlled input, typically over a network. Successful exploitation allows for arbitrary remote code execution (RCE) with the privileges of the Node.js process. The issue is fixed in version 1.1.3.

Affected products

  • doT dot <= 1.1.2

Identifiers

  • CVE-2020-8141
  • GHSA-297x-8xj4-vcxv

Timeline

  • 2020-03-15: disclosed: NVD publication date
  • 2022-05-24: advisory: GitHub Advisory published

References

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