/

CVE-2026-44340

Severity:

HIGH RISK

(7.5)

Path Traversal / Archive Extraction Vulnerability

CVE-2026-44340

Analyzed

Vulnerability type

Category:

Path Traversal / Archive Extraction Vulnerability

CWE:

CWE-22, CWE-59

Impact:

Arbitrary File Write Outside Intended Directory

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PraisonAI's archive extraction helper _safe_extractall incorrectly trusts symlink entries in tar bundles, allowing files to be written outside the intended destination directory.

A crafted bundle that chains a symlink and a subsequent file entry can cause writes to arbitrary filesystem locations when recipes are pulled, published, or unpacked, potentially overwriting sensitive files or planting malicious content.

Affected context

This vulnerability affects PraisonAI environments that process recipe bundles (for pull, publish, or unpack flows) using the _safe_extractall helper.

The vulnerable behavior manifests when:

  • Tar archives are accepted from sources that may be influenced by an attacker (directly or via a compromised channel).
  • The extraction destination directory is assumed to be a safe, confined location, but archive content is not fully constrained to that directory.
  • The underlying filesystem honors symlinks and hardlinks created during extraction.

In these conditions, a malicious archive can influence where files end up on disk beyond the nominal destination directory.

Exploit preconditions

  • Attack surface: Archive (tar) processing in recipe pull, recipe publish, and recipe unpack flows.
  • Required access: Ability to supply or influence a recipe bundle that PraisonAI will extract (e.g., publishing a malicious recipe or compromising a recipe source).
  • Trigger point: The application calling _safe_extractall, which then invokes tar.extractall(dest_dir) without proper filtering and without validating symlink linkname targets.
  • Why exploitation is possible:
  • Member names are checked for absolute paths and .. traversal, but member.linkname is not validated.
  • Symlink and hardlink entries are not rejected, allowing creation of links that point outside dest_dir.
  • A subsequent regular file whose path traverses via the freshly created symlink is treated as inside dest_dir, but actually writes to an external, attacker-chosen location.

Why this happens

The core issue is an incomplete validation of archive entries that focuses only on the visible member path rather than the effective filesystem target of links.

This maps to:

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') — the extraction logic intends to confine writes to dest_dir, but fails to account for symlink-mediated escape.
  • CWE-59: Improper Link Resolution Before File Access ('Link Following') — symlink and hardlink entries are accepted without checking where they resolve, and subsequent file operations implicitly follow those links.

Conceptually, the insecure pattern is: treating archives as trusted, validating only the nominal filenames, and then extracting all content (including links) without enforcing a strict "no links, no escapes" policy or using safe filters provided by the tar library.

Potential impact

  • Overwriting files outside the intended extraction directory with attacker-controlled content.
  • Placing malicious configuration files or scripts in locations that may be automatically loaded by the system or other applications.
  • Corrupting or clobbering application data, logs, or cache files to disrupt operations.
  • Assisting in privilege escalation if writable paths influence higher-privileged services (e.g., through modified config, unit files, or hooks), depending on environment hardening.
  • Facilitating further compromise when combined with other weaknesses such as permissive file permissions or unsafe automatic execution mechanisms.

General mitigation guidance

Effective mitigation focuses on treating archive content as untrusted and enforcing strict extraction policies:

  • Reject or strip symlink and hardlink entries when extracting archives that originate from untrusted or semi-trusted sources.
  • Validate both the archive entry name and any associated linkname to ensure that the final resolved path remains within the intended destination directory.
  • Use safer archive APIs or filters (such as data-only extraction filters) that deny special file types by default.
  • Perform path normalization and canonicalization on every target path before creation, and abort extraction if it attempts to leave the destination directory.
  • Run extraction processes with least privilege and restricted filesystem access (e.g., chroot/jail, containers, or limited service accounts) to reduce blast radius if a path escape occurs.
  • Treat imported recipes and bundles as potentially hostile until verified through content, source, and integrity checks.

How teams detect issues like this

Organizations can detect and monitor for this class of vulnerability using a blend of code-centric and operational techniques:

  • Static analysis: Add rules or queries to flag:
  • Uses of tar.extractall() or equivalent high-risk extraction APIs without filters or without explicit rejection of special file types.
  • Archive extraction helpers that do not inspect or sanitize linkname, or that allow SYMTYPE/LNKTYPE entries from untrusted sources.
  • Manual path joins that do not normalize and enforce containment within a base directory.
  • Code review signals:
  • Helper functions labelled as "safe" that parse or extract archives but only validate entry names and not link targets.
  • Absence of checks for symlinks, hardlinks, device files, or uncommon tar member types.
  • Extraction logic that assumes inbound bundles are trusted based solely on source or filename.
  • Policy and tooling:
  • Introduce security review gates for any functionality that processes user-supplied archives.
  • Leverage SAST/IAST tools or custom linters that recognize insecure archive usage patterns.
  • Monitor runtime for unusual file creation patterns originating from extraction services (e.g., writes outside expected directories) as a compensating operational control.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-9q28-ghcr-c4x3

Frequently asked

questions

It can be, if an attacker can cause PraisonAI to download or process a malicious recipe bundle from a remote source. The exact exposure depends on how recipe pull and publish endpoints are exposed and authenticated in a given deployment.

The attacker must be able to supply or influence a tar bundle that the application will extract using the vulnerable helper. This could occur through publishing a crafted recipe, compromising a recipe repository, or intercepting and modifying bundles in transit in less protected environments.

The robust fix pattern is to treat all archive content as untrusted: disallow symlinks and hardlinks by default, or strictly validate linkname targets; use archive APIs that expose a "data-only" or "no special files" mode; and enforce that all resolved paths remain inside the intended destination directory.

Adopt a defensive design standard for archive handling and filesystem interactions: require path containment checks and link resolution safeguards, mandate code review for any new archive extraction logic, and integrate automated checks (static analysis or linters) that flag high-risk patterns like unrestricted extractall() calls and unvalidated symlink handling.

Find out what's already
exploitable in your codebase.