/

CVE-2026-39307

Severity:

HIGH RISK

(8.1)

Path Traversal / Zip Slip in PraisonAI Template Installation

CVE-2026-39307

Analyzed

Vulnerability type

Category:

Path Traversal / Zip Slip

CWE:

CWE-22

Impact:

Arbitrary File Write via Path Traversal

Severity:

HIGH RISK

(8.1)

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 template installation mechanism was vulnerable to a Zip Slip path traversal issue that could allow arbitrary file writes during archive extraction from external sources.

If an attacker supplies or controls a malicious ZIP template, they can cause files to be written outside the intended templates directory, potentially overwriting sensitive or executable files on the host system.

Affected context

This vulnerability affects environments where PraisonAI installs templates by downloading ZIP archives from external locations such as GitHub and then extracting them on the local filesystem.

The risk is highest when:

  • Template sources are user-specified, community-contributed, or otherwise untrusted
  • PraisonAI runs with elevated filesystem permissions
  • The host system contains sensitive or executable files reachable via relative paths from the extraction directory

Exploit preconditions

  • Attack surface: PraisonAI template installation feature that downloads and extracts ZIP archives.
  • Required access: Ability to cause PraisonAI to download and extract a crafted ZIP file (e.g., by pointing it to a malicious repository or compromising a template source).
  • Trigger point: Invocation of the template installation workflow that calls zipfile.extractall() on the attacker-controlled archive.
  • Why exploitation is possible: The extraction logic does not validate or normalize file paths inside the ZIP, allowing ../ traversal or absolute paths to escape the intended destination directory and overwrite arbitrary files.

Why this happens

The root cause is the direct use of zipfile.extractall() on untrusted ZIP archives without validating the contained file paths.

Malicious archives can include entries with relative path components (such as ../../) or absolute paths that, when extracted, resolve outside the designated template directory.

This behavior maps to CWE-22: Path Traversal, specifically the Zip Slip pattern, where insufficient canonicalization and validation of paths during decompression leads to arbitrary file write outside the intended location.

Potential impact

  • Overwrite of application or system configuration files that the PraisonAI process can access
  • Planting or overwriting executable scripts or binaries that may later be invoked by the application or system services
  • Tampering with PraisonAI's own templates or code to introduce backdoors or data exfiltration logic
  • Escalation from a limited template-management capability to broader compromise of the host environment, depending on file permissions

General mitigation guidance

Effective mitigation focuses on enforcing strict path hygiene during archive extraction and limiting the blast radius of file operations:

  • Normalize and validate each ZIP entry path before extraction, ensuring it resolves within a pre-defined, canonical template directory.
  • Reject entries containing .., absolute paths, drive prefixes, or symlink tricks that could escape the target directory.
  • Extract files using a custom loop instead of extractall(), applying explicit checks on each member before writing to disk.
  • Run PraisonAI with the least filesystem privileges necessary and isolate template storage in tightly permissioned directories.
  • Treat all externally sourced templates as untrusted content and integrate security review requirements for official or curated template repositories.

How teams detect issues like this

Detection can rely on both code-level and operational signals:

  • Static analysis: Flag uses of zipfile.extractall() or similar bulk extraction APIs on untrusted data without prior path validation or canonicalization.
  • Code review: Look for archive-handling code that does not sanitize ZIP entry names, fails to enforce a strict base directory, or writes files using paths derived directly from archive metadata.
  • Security testing: Include Zip Slip test archives in QA and security testing pipelines to verify that extraction is confined to the intended directory.
  • Runtime monitoring: Monitor for unexpected file modifications outside designated template directories during template installation operations, where host-level tools are available.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-4ph2-f6pf-79wv

Frequently asked

questions

It can be, if an attacker can cause PraisonAI to download and install a malicious ZIP template from a remote source, for example by controlling a template repository URL or compromising a trusted template provider.

The attacker needs the ability to influence which template archive PraisonAI downloads and extracts. They do not necessarily need direct access to the filesystem; the PraisonAI process performs the file writes on their behalf.

Replace direct calls to zipfile.extractall() with a controlled extraction loop that normalizes and validates each entry path, enforcing that all extracted files remain within a predefined directory and rejecting any traversal or absolute paths.

Establish secure patterns for handling archive and file-based content: always treat archive contents as untrusted, perform path canonicalization and allow-list checks, follow least-privilege principles for application file permissions, and include archive-handling checks in security reviews and automated testing.

Find out what's already
exploitable in your codebase.