CVE-2024-24579: Github.com/anchore/stereoscope Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-hpxr-w9w7-g4gv
CVSS 5.3
CWE-22
Published
Advisory Summary

CVE-2024-24579 is a MODERATE (CVSS 5.3) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/anchore/stereoscope libraries in the Go ecosystem. The issue involves stereoscope vulnerable to tar path traversal when processing oci tar archives. Remediation is available by upgrading affected packages to version 0.0.1.

CVE-2024-24579 at a Glance

CVE Identifier CVE-2024-24579
GHSA Identifier GHSA-hpxr-w9w7-g4gv
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Github.com/anchore/stereoscope
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

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

How to Fix CVE-2024-24579

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

github.com/anchore/stereoscope fixed: 0.0.1
Upgrade github.com/anchore/stereoscope to 0.0.1
Verify Direct and Transitive Dependencies

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

inspect dependencies for github.com/anchore/stereoscope

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-24579, inspect your project dependencies for Github.com/anchore/stereoscope:

inspect dependencies for github.com/anchore/stereoscope

Analyze the terminal output to locate any version of Github.com/anchore/stereoscope in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

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 Github.com/anchore/stereoscope, 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 It is possible to craft an OCI tar archive that, when stereoscope attempts to unarchive the contents, will result in writing to paths outside of the unarchive temporary directory. Specifically, use of `github.com/anchore/stereoscope/pkg/file.UntarToDirectory()` function, the `github.com/anchore/stereoscope/pkg/image/oci.TarballImageProvider` struct, or the higher level `github.com/anchore/stereoscope/pkg/image.Image.Read()` function express this vulnerability. ### Patches Patched in v0.0.1 ### Workarounds If you are using the OCI archive as input into stereoscope then you can switch to using an [OCI layout](https://github.com/opencontainers/image-spec/blob/main/image-layout.md) by unarchiving the tar archive and provide the unarchived directory to stereoscope. ### References - Patch PR https://github.com/anchore/stereoscope/pull/214

CVE-2024-24579 Affected Github.com/anchore/stereoscope Versions

1 component(s)
Fixed Versions:
0.0.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/anchore/stereoscope
Go
< 0.0.1
0.0.1

References

Frequently Asked Questions

What is CVE-2024-24579?
CVE-2024-24579 is a security vulnerability in Github.com/anchore/stereoscope involving stereoscope vulnerable to tar path traversal when processing OCI tar archives under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Github.com/anchore/stereoscope versions are affected?
Affected versions include releases prior to 0.0.1 across affected packages: github.com/anchore/stereoscope.
What version fixes CVE-2024-24579?
Upgrading to 0.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/anchore/stereoscope affected?
Yes, github.com/anchore/stereoscope is affected in releases prior to 0.0.1. Upgrade your dependency to 0.0.1 or later.
What is the CVSS score of CVE-2024-24579?
CVE-2024-24579 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2024-24579?
CVE-2024-24579 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 Go dependencies for CVE-2024-24579?
Run the dependency tree command: 'inspect dependencies for github.com/anchore/stereoscope'. 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-hpxr-w9w7-g4gv",
  "modified" : "2024-01-31T22:39:17Z",
  "published" : "2024-01-31T22:39:17Z",
  "aliases" : [ "CVE-2024-24579" ],
  "summary" : "stereoscope vulnerable to tar path traversal when processing OCI tar archives",
  "details" : "### Impact\nIt is possible to craft an OCI tar archive that, when stereoscope attempts to unarchive the contents, will result in writing to paths outside of the unarchive temporary directory. Specifically, use of `github.com/anchore/stereoscope/pkg/file.UntarToDirectory()` function, the  `github.com/anchore/stereoscope/pkg/image/oci.TarballImageProvider` struct, or the higher level `github.com/anchore/stereoscope/pkg/image.Image.Read()` function express this vulnerability.\n\n### Patches\nPatched in v0.0.1\n\n### Workarounds\nIf you are using the OCI archive as input into stereoscope then you can switch to using an [OCI layout](https://github.com/opencontainers/image-spec/blob/main/image-layout.md) by unarchiving the tar archive and provide the unarchived directory to stereoscope.\n\n### References\n- Patch PR https://github.com/anchore/stereoscope/pull/214",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/anchore/stereoscope"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/anchore/stereoscope/security/advisories/GHSA-hpxr-w9w7-g4gv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-24579"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/anchore/stereoscope/commit/09dacab4d9ee65ee8bc7af8ebf4aa7b5aaa36204"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/anchore/stereoscope"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-31T22:39:17Z",
    "nvd_published_at" : "2024-01-31T17:15:40Z"
  }
}