Security Experts:

GitHub Patches Security Flaws in Core Node.js Dependencies

GitHub has published documentation on seven vulnerabilities in the Node.js packages and warned that exploitation could expose users to code execution attacks.

“These vulnerabilities may result in arbitrary code execution due to file overwrite and creation when tar is used to extract untrusted tar files or when the npm CLI is used to install untrusted npm packages under certain file system conditions,” GitHub said in an advisory.

A code npm dependency, tar is used to extract and install npm packages. Thousands of projects depend on it and tar has tens of millions of weekly downloads. A core dependency for the npm CLI, @npmcli/arborist allows for the management of node_modules trees.

Four of the identified security holes (two in tar: CVE-2021-32804 and CVE-2021-37713; and two in @npmcli/arborist: CVE-2021-39134 and CVE-2021-39135) impact the npm CLI when a malicious or untrusted npm package is installed and could lead to code execution even when using the --ignore-scripts argument.

Upon package installation, npm CLI ensures contents are written to the appropriate folders only, but the vulnerabilities cross these security boundaries and may lead to arbitrary file overwrites during installation, and subsequent code execution.

Given the large number of projects that depend on tar, GitHub started working on fixes immediately after identifying the issue and also began scanning the npm registry for malicious packages targeting CVE-2021-32804, but says none was identified.

“The scan completed on August 5, 2021 and we did not detect any malicious packages targeting CVE-2021-32804. Note that exploitation of these issues through the npm CLI requires installation of untrusted packages or processing untrusted tar archives using affected versions of tar,” the company said.

The vulnerabilities are addressed in npm CLI versions 6.14.15, 7.21.0, or newer; latest Node.js releases (as of August 31, patches were included in Node 12, 14, and 16); and tar versions 4.4.19, 5.0.11, and 6.1.10.

Several of the identified issues were reported to GitHub by Robert Chen (@chen-robert) and Philip Papurt (@ginkoid). As part of a private security bug bounty program, they received a total bounty payout of $14,500 for the reports.

Related: Critical Flaw in Pac-Resolver NPM Package Affects 290,000 Repositories

Related: Code Generated by GitHub Copilot Can Introduce Vulnerabilities

view counter