CVE-2026-22871: Guarddog Remote Code Execution Vulnerability
HIGHCVE-2026-22871 is a HIGH remote code execution vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Guarddog libraries in the PyPI ecosystem. The issue involves guarddog path traversal vulnerability leads to arbitrary file overwrite and rce. Remediation is available by upgrading affected packages to version 2.7.1.
CVE-2026-22871 at a Glance
How to Fix CVE-2026-22871
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.
pip install guarddog>=2.7.1
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-2026-22871, 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 2.7.1), 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-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 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
CVE-2026-22871 Affected Guarddog Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
guarddog
|
PyPI |
< 2.7.1
|
2.7.1
|
References
Frequently Asked Questions
What is CVE-2026-22871?
Which Guarddog versions are affected?
What version fixes CVE-2026-22871?
Is guarddog affected?
What CWE is associated with CVE-2026-22871?
How can I check PyPI dependencies for CVE-2026-22871?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xg9w-vg3g-6m68",
"modified" : "2026-01-13T21:54:49Z",
"published" : "2026-01-13T21:54:49Z",
"aliases" : [ "CVE-2026-22871" ],
"summary" : "GuardDog Path Traversal Vulnerability Leads to Arbitrary File Overwrite and RCE",
"details" : "## Summary\n\nA **path traversal vulnerability** exists in GuardDog's `safe_extract()` function that allows malicious PyPI packages to write arbitrary files outside the intended extraction directory, leading to **Arbitrary File Overwrite** and **Remote Code Execution** on systems running GuardDog.\n\n**CWE:** CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)\n\n## Details\n\n### Vulnerable Code\n\n**File:** `guarddog/utils/archives.py`\n\n```python\nelif zipfile.is_zipfile(source_archive):\n with zipfile.ZipFile(source_archive, \"r\") as zip:\n for file in zip.namelist():\n # Note: zip.extract cleans up any malicious file name\n # such as directory traversal attempts This is not the\n # case of zipfile.extractall\n zip.extract(file, path=os.path.join(target_directory, file)) # ❌ VULNERABLE\n```\n\n### Root Cause\n\nThe comment about `zip.extract()` fooled me at first :) then I noticed the `os.path.join()` call. \nThe vulnerability stems from **incorrect usage of Python's `zipfile.ZipFile.extract()` API**:\n\n- The `path` parameter should be the **target directory**, not a full file path\n- `extract()` automatically appends the member name to the path\n- By passing `os.path.join(target_directory, file)`, GuardDog causes the filename to be appended **twice**\n- This breaks zipfile's built-in path traversal sanitization\n\n### Attack Vector\n\n1. Attacker creates malicious wheel with path traversal filenames\n2. Uploads to PyPI or distributes directly\n3. Package scan: `guarddog pypi scan malicious-pkg`\n4. GuardDog downloads and extracts the package\n5. Malicious files written to arbitrary locations\n6. Code execution could be achieved\n\n## Impact\n\nImpact depends on how GuardDog is running and under which environment.\n\n### Critical Scenarios\n\n1. **Immediate Code Execution**\n - Write to `~/.bashrc` → executes on next shell\n - Write to `~/.profile` → executes on login\n\n2. **Persistent Backdoors**\n - Write to `~/.ssh/authorized_keys` → SSH access\n - Write to `/etc/cron.d/malicious` → scheduled execution (if root)\n - Write to systemd user services → persistent execution\n\nand more...\n\n## Credits\n\n**Reported by:** Charbel (dwbruijn)",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "guarddog"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.7.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/DataDog/guarddog/security/advisories/GHSA-xg9w-vg3g-6m68"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-22871"
}, {
"type" : "WEB",
"url" : "https://github.com/DataDog/guarddog/commit/9aa6a725b2c71d537d3c18d1c15621395ebb879c"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/DataDog/guarddog"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-01-13T21:54:49Z",
"nvd_published_at" : "2026-01-13T21:15:55Z"
}
}