GHSA-78m5-jpmf-ch7v
MEDIUMGuardDog vulnerable to arbitrary file write when scanning a specially-crafted remote PyPI package
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Blast Radius
guarddogReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
Unsafe extracting using shutil.unpack_archive() from a remotely retrieved tarball may lead to writing the extracted file to an unintended destination.
Details
Extracting files using shutil.unpack_archive() from a potentially malicious tarball without validating that the destination file path is within the intended destination directory can cause files outside the destination directory to be overwritten.
The vulnerable code snippet is between L153..158.
response = requests.get(url, stream=True)
with open(zippath, "wb") as f:
f.write(response.raw.read())
shutil.unpack_archive(zippath, unzippedpath)
It seems that a remotely retrieved tarball which could be with the extension .tar.gz happens to be unpacked using shutil.unpack_archive() with no destination verification/limitation of the extracted files.
PoC
The PoC provided showcases the risk of extracting the non-harmless text file sim4n6.txt to a parent location rather than the current folder.
> tar --list -f archive.tar
tar: Removing leading `../../../' from member names
../../../sim4n6.txt
> python3
Python 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.unpack_archive("archive.tar")
>>> exit()
> file ../../../sim4n6.txt
../../../sim4n6.txt: ASCII text
A Potential Attack Scenario
- An attacker may craft a malicious tarball with a filename path, such as
../../../../../../../../etc/passwd, and then serve the archive remotely, thus, providing a possibility to overwrite the system files.
Mitigation
Potential mitigation could be to:
- Use a safer module, like
zipfile. - Validate the location of the extracted files and discard those with malicious paths such as a relative path
..or absolute ones.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | guarddog | all versions | 0.1.8 |
Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for guarddog. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update guarddog to 0.1.8 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-78m5-jpmf-ch7v is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-78m5-jpmf-ch7v is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-78m5-jpmf-ch7v. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-78m5-jpmf-ch7v in your dependencies?
O3 detects GHSA-78m5-jpmf-ch7v across PyPI dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.