Vulnerabilities in pkg:npm/@actions/artifact

PACKAGE
Advisory Identifier: GHSA-6q32-hq47-5qq3
Advisory Summary

CVE-2024-42471 is a HIGH (CVSS 7.3) @actions/artifact has an arbitrary file vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @actions/artifact libraries in the npm ecosystem. The issue involves @actions/artifact has an arbitrary file write via artifact extraction. Remediation is available by upgrading affected packages to version 2.1.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@actions/artifact

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@actions/artifact. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-6q32-hq47-5qq3 CVE-2024-42471 HIGH @actions/artifact has an Arbitrary File Write via artifact extraction

CVE-2024-42471 at a Glance

CVE Identifier CVE-2024-42471
GHSA Identifier GHSA-6q32-hq47-5qq3
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product @actions/artifact
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2024-42471

To remediate this vulnerability, upgrade all affected @actions/artifact dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@actions/artifact fixed: 2.1.2
npm install @actions/artifact@2.1.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @actions/artifact

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-42471, inspect your project dependencies using npm:

npm ls @actions/artifact

Analyze the terminal output to locate any version of @actions/artifact in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.2), your application is affected.

Note: The npm ls @actions/artifact command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In @actions/artifact, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Versions of `actions/artifact` before 2.1.7 are vulnerable to arbitrary file write when using `downloadArtifactInternal`, `downloadArtifactPublic`, or `streamExtractExternal` for extracting a specifically crafted artifact that contains path traversal filenames. ### Patches Upgrade to version 2.1.7 or higher. ### References - https://snyk.io/research/zip-slip-vulnerability - https://github.com/actions/toolkit/pull/1724 ### CVE CVE-2024-42471 ### Credits Justin Taft from Google

CVE-2024-42471 Affected @actions/artifact Versions

1 component(s)
Fixed Versions:
2.1.2
Product / Package Ecosystem Affected Versions Fixed Version
@actions/artifact
npm
≥ 2.0.0
< 2.1.2
2.1.2

References

Frequently Asked Questions

What is CVE-2024-42471?
CVE-2024-42471 is a security vulnerability in @actions/artifact involving @actions/artifact has an Arbitrary File Write via artifact extraction under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which @actions/artifact versions are affected?
Affected versions include releases prior to 2.1.2 across affected packages: @actions/artifact.
What version fixes CVE-2024-42471?
Upgrading to 2.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @actions/artifact affected?
Yes, @actions/artifact is affected in releases prior to 2.1.2. Upgrade your dependency to 2.1.2 or later.
What is the CVSS score of CVE-2024-42471?
CVE-2024-42471 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2024-42471?
CVE-2024-42471 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2024-42471?
Run the dependency tree command: 'npm ls @actions/artifact'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6q32-hq47-5qq3",
  "modified" : "2025-01-22T18:44:59Z",
  "published" : "2024-09-03T20:08:30Z",
  "aliases" : [ "CVE-2024-42471" ],
  "summary" : "@actions/artifact has an Arbitrary File Write via artifact extraction",
  "details" : "### Impact\n\nVersions of `actions/artifact` before 2.1.7 are vulnerable to arbitrary file write when using `downloadArtifactInternal`, `downloadArtifactPublic`, or `streamExtractExternal` for extracting a specifically crafted artifact that contains path traversal filenames.\n\n### Patches\n\nUpgrade to version 2.1.7 or higher. \n\n### References\n\n- https://snyk.io/research/zip-slip-vulnerability\n- https://github.com/actions/toolkit/pull/1724\n\n### CVE\n\nCVE-2024-42471\n\n### Credits\n\nJustin Taft from Google",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@actions/artifact"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/actions/toolkit/security/advisories/GHSA-6q32-hq47-5qq3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-42471"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/actions/toolkit/pull/1602"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/actions/toolkit/pull/1666"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/actions/toolkit/pull/1724"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/actions/toolkit/commit/29885a805ef3e95a9862dcaa8431c30981960017"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/actions/download-artifact/blob/v3/package.json#L31"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/actions/toolkit"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/research/zip-slip-vulnerability"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-09-03T20:08:30Z",
    "nvd_published_at" : "2024-09-02T18:15:35Z"
  }
}