tree-kill code injection on Windows

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

tree-kill is a Node.js library used to terminate processes and their child processes across platforms. On Windows systems, the library fails to properly sanitize user-supplied input before passing it to a shell command, allowing an attacker who controls the process ID parameter to execute arbitrary shell commands with the privileges of the running process.

Technologies: tree-kill (npm). Vendors: npm.

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.1, published 24 May 2022.
Which products and versions are affected?
tree-kill (npm) SEMVER:introduced=0,last_affected=1.2.1.
Is there a fix for This vulnerability?
A patch was published on 2022: Fix released in version 1.2.2 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network.
Am I affected?
Check whether you run tree-kill (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.

Technical details

The vulnerability is a code injection flaw (CWE-94) in the Windows code path of tree-kill. While the Linux implementation properly sanitizes input passed to the kill command, the Windows path concatenates unsanitized user input directly into an exec() call without validation. An attacker who can control the process ID argument supplied to the kill() function can inject shell metacharacters (e.g., & or |) to execute arbitrary commands. The attack is network-adjacent if the input comes from a remote source, but typically requires the application using tree-kill to pass attacker-controlled data to the kill() function. Patches were released in version 1.2.2 and later.

Affected products

  • pkrumins tree-kill 1.2.1 and earlier

Timeline

  • 2019-12-18: disclosed
  • 2022: patched: Fix released in version 1.2.2
  • 2022-05-24: advisory: GHSA advisory published
  • 2023-11-08: other: Advisory withdrawn as duplicate of GHSA-884p-74jh-xrg2

References

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