CVE-2022-1537: Grunt race condition in file copy

CVE-2022-1537 · Severity: low · CVSS 3.1 · Published 2022-05-11

Grunt is a task automation tool widely used in JavaScript development workflows to automate build processes. A race condition in its file copy operations allows a lower-privileged attacker to write arbitrary files by exploiting a time-of-check-time-of-use (TOCTOU) window, potentially leading to privilege escalation if the tool runs with elevated permissions.

Technologies: grunt (npm). Vendors: npm.

Quick answers

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

  • grunt (npm): upgrade to 1.5.3 or later
    npm install grunt@1.5.3

Technical details

A TOCTOU (time-of-check-time-of-use) race condition exists in Grunt's file.copy operations (CWE-367) prior to version 1.5.3. An attacker with write access to both source and destination directories can exploit the vulnerability by creating a symbolic link between the check and use phases, redirecting file writes to arbitrary locations. This can achieve arbitrary file write with the privileges of the Grunt process, enabling local privilege escalation (e.g., modifying .bashrc or /etc/shadow if Grunt runs as root). The vulnerability requires local access and the ability to write to directories involved in the copy operation. A patch is available in Grunt 1.5.3 and later.

Affected products

  • Grunt Grunt prior to 1.5.3

Identifiers

  • CVE-2022-1537
  • GHSA-rm36-94g8-835r

Timeline

  • 2022-05-11: disclosed
  • 2022: patched: Fixed in version 1.5.3

References

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