# node-js-libs cli arbitrary file overwrite via predictable temporary files

Source: https://junglewise.ai/threats/node-js-libs-cli-arbitrary-file-overwrite-via-predictable-temporary-72e75bc2  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-05-24. Updated: 2026-05-14  
License: CC BY 4.0 with a link back

Severity: low · CVSS 3 · Published 2022-05-24

The node-cli library, used for building command-line interfaces in Node.js, is vulnerable to a file overwrite flaw. An attacker could trick a user into running a command that inadvertently overwrites important system or user files. This could lead to data loss or system instability depending on which files are targeted.

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Low severity, with a CVSS score of 3, published 24 May 2022.

**Which products and versions are affected?** node-js-libs cli >= 0.1.0, < 1.0.0.

**Is there a fix for This vulnerability?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether anything you run is named in the advisory. 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.

## Technical details

The node-cli library (versions 0.1.0 through 0.11.3) creates temporary lock and log files in the /tmp directory using predictable names based on the application name (e.g., /tmp/[app].pid). Because these files are created in a world-writable directory without sufficient validation, an attacker can create a symbolic link at the expected file path. When the application runs, it follows the link and overwrites the target file with the privileges of the user executing the CLI tool. This is classified as a path traversal/race condition issue (CWE-22, CWE-362). The vulnerability is fixed in version 1.0.0.

## Affected products

- node-js-libs cli >= 0.1.0, < 1.0.0

## Timeline

- 2016-03-28: disclosed: Initial report by Steve Kemp
- 2016-06-15: advisory: NPM advisory published
- 2016-06-16: other: GitHub issue #81 opened to track the flaw
- 2022-05-24: advisory: GitHub Advisory published
- 2023-12-08: other: Advisory GHSA-3mrp-qhcj-mwv5 withdrawn as a duplicate of GHSA-6cpc-mj5c-m9rq

## References

- [https://github.com/node-js-libs/cli/issues/81](https://github.com/node-js-libs/cli/issues/81)
- [https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-1000021](https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-1000021)
- [https://web.archive.org/web/20190430172230/https://www.npmjs.com/advisories/95](https://web.archive.org/web/20190430172230/https://www.npmjs.com/advisories/95)
