Safeguard
Vulnerability Analysis•

CVE-2026-22871: Critical Path Traversal in GuardDog Before 2.7.1

CVE-2026-22871 is a critical (9.8) path traversal in GuardDog safe_extract that can overwrite files and run code. Upgrade GuardDog to 2.7.1 or later.

Safeguard Security Team
2 min read

CVE-2026-22871 is a critical path traversal flaw (CVSS 9.8) in GuardDog, Datadog's command line tool for spotting malicious PyPI packages. The safe_extract() function could write files outside its extraction folder, which can lead to file overwrite and code execution on the scanning machine. GuardDog 2.7.1 fixes it.

What's affected

GuardDog versions before 2.7.1 are affected. The fixed version is 2.7.1.

The irony is worth noting: the tool exists to inspect suspicious packages, so it is run against untrusted archives by design. That makes the extraction step a security boundary.

How to check if you're exposed

Check what is installed, in every environment that runs scans:

pip show guarddog
pip freeze | grep -i guarddog

Look at CI images, analyst workstations and any scheduled jobs that vet new packages. Any copy below 2.7.1 should be treated as exposed whenever it extracts a package you do not trust.

What to do now

  1. Upgrade with pip install --upgrade guarddog and confirm the version is 2.7.1 or higher.
  2. Run GuardDog on throwaway or isolated machines rather than hosts that hold credentials.
  3. Check recent runs for unexpected files outside the scan working directory.
  4. Rebuild CI images that pinned an older GuardDog.

Why it matters

This is CWE-22 (Path Traversal). Archive entries carry their own paths, and if the extractor trusts them, an entry named with parent directory segments lands outside the target folder. A safe extractor resolves each path and refuses anything that escapes the destination.

The advisory says the result can be arbitrary file overwrite and remote code execution on the system running GuardDog. Security tooling that handles hostile input should be run with the same care as the thing it inspects. Teams that adopted a scanner like this to reduce supply chain risk should include it in their own patch inventory, next to the application dependencies it protects. The record does not flag this CVE as exploited in the wild.

Quick check

Why is a scanner exposed to this?

Because it unpacks packages that may be malicious, so a flaw in unpacking turns the sample into an attack on the analyst machine.

What is the fixed version?

GuardDog 2.7.1.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.