CVE-2022-23531: Guarddog GuardDog Vulnerable To Arbitrary File Vulnerability

LOW
Advisory Identifier: GHSA-rp2v-v467-q9vq
CVSS 5.8
CWE-23 CWE-22
Published
Advisory Summary

CVE-2022-23531 is a LOW (CVSS 5.8) guarddog vulnerable to arbitrary file vulnerability (CWE-23: Relative Path Traversal) affecting Guarddog libraries in the PyPI ecosystem. The issue involves guarddog vulnerable to arbitrary file write when scanning a specially-crafted pypi package. Remediation is available by upgrading affected packages to version 0.1.5.

CVE-2022-23531 at a Glance

CVE Identifier CVE-2022-23531
GHSA Identifier GHSA-rp2v-v467-q9vq
Severity LOW
CVSS v3.1 Base Score 5.8
CWE Classification CWE-23: Relative Path Traversal
Affected Product Guarddog
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.8

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

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

How to Fix CVE-2022-23531

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

guarddog fixed: 0.1.5
pip install guarddog>=0.1.5
Verify Direct and Transitive Dependencies

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

pip show guarddog

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-23531, inspect your installed packages using pip:

pip show guarddog

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

Note: The pip show guarddog command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-23: Relative Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory. In Guarddog, 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 Running GuardDog against a specially-crafted package can allow an attacker to write an arbitrary file on the machine where GuardDog is executed. This is due to a path traversal vulnerability when extracting the `.tar.gz` file of the package being scanned, which exists by design in the `tarfile.TarFile.extractall` function. See also https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall ### Remediation Upgrade to GuardDog v0.1.5 or more recent. ### References * https://semgrep.dev/r?q=trailofbits.python.tarfile-extractall-traversal.tarfile-extractall-traversal * https://www.trellix.com/en-us/about/newsroom/stories/research/tarfile-exploiting-the-world.html * https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall

CVE-2022-23531 Affected Guarddog Versions

1 component(s)
Fixed Versions:
0.1.5
Product / Package Ecosystem Affected Versions Fixed Version
guarddog
PyPI
< 0.1.5
0.1.5

References

Frequently Asked Questions

What is CVE-2022-23531?
CVE-2022-23531 is a security vulnerability in Guarddog involving GuardDog vulnerable to arbitrary file write when scanning a specially-crafted PyPI package under CWE-23: Relative Path Traversal.
Which Guarddog versions are affected?
Affected versions include releases prior to 0.1.5 across affected packages: guarddog.
What version fixes CVE-2022-23531?
Upgrading to 0.1.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is guarddog affected?
Yes, guarddog is affected in releases prior to 0.1.5. Upgrade your dependency to 0.1.5 or later.
What is the CVSS score of CVE-2022-23531?
CVE-2022-23531 has a CVSS v3.1 base score of 5.8 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2022-23531?
CVE-2022-23531 is classified under CWE-23: Relative Path Traversal (The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory.).
How can I check PyPI dependencies for CVE-2022-23531?
Run the dependency tree command: 'pip show guarddog'. 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-rp2v-v467-q9vq",
  "modified" : "2024-11-18T16:26:28Z",
  "published" : "2022-12-02T22:25:25Z",
  "aliases" : [ "CVE-2022-23531" ],
  "summary" : "GuardDog vulnerable to arbitrary file write when scanning a specially-crafted PyPI package",
  "details" : "### Impact\n\nRunning GuardDog against a specially-crafted package can allow an attacker to write an arbitrary file on the machine where GuardDog is executed.\n\nThis is due to a path traversal vulnerability when extracting the `.tar.gz` file of the package being scanned, which exists by design in the `tarfile.TarFile.extractall` function. See also https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall\n\n### Remediation\n\nUpgrade to GuardDog v0.1.5 or more recent.\n\n### References\n\n* https://semgrep.dev/r?q=trailofbits.python.tarfile-extractall-traversal.tarfile-extractall-traversal\n* https://www.trellix.com/en-us/about/newsroom/stories/research/tarfile-exploiting-the-world.html\n* https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:L/SI:L/SA:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "guarddog"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/DataDog/guarddog/security/advisories/GHSA-rp2v-v467-q9vq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23531"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DataDog/guarddog/pull/89"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DataDog/guarddog/commit/98af5c8c1e9c15fa888c900252e76116b0ec25d1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/DataDog/guarddog"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DataDog/guarddog/releases/tag/v0.1.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/guarddog/PYSEC-2022-42994.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-23" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-02T22:25:25Z",
    "nvd_published_at" : "2022-12-17T00:15:00Z"
  }
}