GitHub Advisory Database
GHSA-rp2v-v467-q9vq
GuardDog vulnerable to arbitrary file write when scanning a specially-crafted PyPI package
Details
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
Affected packages
| Ecosystem | Package | Affected versions |
|---|---|---|
| PyPI | guarddog | All versions before 0.1.5 (fixed in 0.1.5) |
References
- https://github.com/DataDog/guarddog/security/advisories/GHSA-rp2v-v467-q9vq
- https://nvd.nist.gov/vuln/detail/CVE-2022-23531
- https://github.com/DataDog/guarddog/pull/89
- https://github.com/DataDog/guarddog/commit/98af5c8c1e9c15fa888c900252e76116b0ec25d1
- https://github.com/DataDog/guarddog
- https://github.com/DataDog/guarddog/releases/tag/v0.1.5
- https://github.com/pypa/advisory-database/tree/main/vulns/guarddog/PYSEC-2022-42994.yaml