CVE-2026-40156: PraisonAI: auto tools.py load enables local RCE

GHSA-2g3w-cpc4-chr4 HIGH CISA: ATTEND
Published April 10, 2026
CISO Take

PraisonAI unconditionally executes any file named tools.py found in the current working directory at startup, using Python's importlib without user consent, validation, or sandboxing — this is an untrusted search path vulnerability (CWE-426) that erases the boundary between project configuration files and executable code. The attack surface is especially dangerous in CI/CD pipelines and shared repositories: an attacker who lands a malicious tools.py in a project via pull request, poisoned template, or compromised upstream dependency achieves arbitrary code execution on any developer machine or build agent that runs praisonai from that directory. There is no active exploitation in CISA KEV and no public scanner exists yet, but with CVSS 7.8 and a trivially reproducible proof-of-concept — literally a five-line Python file — this warrants immediate treatment as high urgency given the privileged context AI agent pipelines typically operate in. Patch to praisonai v4.5.128 now, audit CI/CD pipelines for unexpected tools.py files, and restrict write access to working directories used by automated PraisonAI workflows.

Sources: NVD GitHub Advisory ATLAS

What is the risk?

CVSS 7.8 (High) with Local attack vector, Low complexity, No privileges required, User interaction required. Despite the local vector designation, the real risk is in automated and multi-user contexts: CI/CD build agents, shared development environments, and containerized AI workflows where the 'user' is a service account with broad system access. The attack is trivially reproducible — no AI/ML knowledge required, only write access to a directory. The 31 other CVEs in the same package suggest an immature security posture in the praisonai ecosystem. No current KEV listing, but the supply chain risk pattern — malicious file placed in repo triggers RCE on next run — mirrors the class of compromise seen in XZ Utils and similar incidents, now applied to an AI agent toolchain.

How does the attack unfold?

Malicious File Placement
Attacker introduces a malicious tools.py into the target project directory via pull request, poisoned project template, or direct write access to a shared development or build environment.
AML.T0010.005
Automatic Code Execution
PraisonAI startup invokes exec_module() on the discovered tools.py without any validation or sandboxing, executing all module-level attacker code before any agent logic runs.
AML.T0011.001
Credential Harvesting
Malicious code reads environment variables, capturing AI API keys, cloud provider credentials, and database secrets accessible to the praisonai process.
AML.T0055
Exfiltration or Persistence
Harvested credentials and data are silently exfiltrated to attacker-controlled infrastructure, or a backdoor is installed for persistent access to the developer workstation or CI/CD build system.
AML.T0025

What systems are affected?

Package Ecosystem Vulnerable Range Patched
PraisonAI pip < 4.5.128 4.5.128
1 dependents 83% patched ~0d to patch Full package profile →

Do you use PraisonAI? You're affected.

How severe is it?

CVSS 3.1
7.8 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 5% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
CISA SSVC: Public PoC
Composite signal derived from CISA KEV, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the attack surface?

AV AC PR UI S C I A
AV Local
AC Low
PR None
UI Required
S Unchanged
C High
I High
A High

What should I do?

6 steps
  1. PATCH

    Upgrade praisonai to v4.5.128 immediately — this release requires explicit opt-in for tools.py loading.

  2. AUDIT

    Search CI/CD pipeline workspaces and project directories for unexpected tools.py files: find . -name tools.py -not -path '*/site-packages/*'.

  3. RESTRICT

    Enforce write-access controls on directories where praisonai runs — no untrusted write access to working directories in automated pipelines.

  4. DETECT

    Add pre-commit hooks and CI pipeline checks to flag new or modified tools.py files in repositories; alert on unexpected tools.py in build artifacts.

  5. WORKAROUND (if patching is delayed): Run praisonai from read-only directories in containerized builds; temporarily remove or rename any legitimate tools.py files and pass them via explicit config path once patched.

  6. VERIFY

    Confirm CI/CD build environments use pinned versions of praisonai — floating pins (>=4.x) may have resolved to vulnerable versions during the exposure window.

What does CISA's SSVC say?

Decision Attend
Exploitation poc
Automatable No
Technical Impact total

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 9 - Risk management system
ISO 42001
A.6.2.6 - AI supply chain security
NIST AI RMF
MAP 1.5 - Likelihood and magnitude of potential harms from AI system dependencies
OWASP LLM Top 10
LLM03:2025 - Supply Chain

Frequently Asked Questions

What is CVE-2026-40156?

PraisonAI unconditionally executes any file named tools.py found in the current working directory at startup, using Python's importlib without user consent, validation, or sandboxing — this is an untrusted search path vulnerability (CWE-426) that erases the boundary between project configuration files and executable code. The attack surface is especially dangerous in CI/CD pipelines and shared repositories: an attacker who lands a malicious tools.py in a project via pull request, poisoned template, or compromised upstream dependency achieves arbitrary code execution on any developer machine or build agent that runs praisonai from that directory. There is no active exploitation in CISA KEV and no public scanner exists yet, but with CVSS 7.8 and a trivially reproducible proof-of-concept — literally a five-line Python file — this warrants immediate treatment as high urgency given the privileged context AI agent pipelines typically operate in. Patch to praisonai v4.5.128 now, audit CI/CD pipelines for unexpected tools.py files, and restrict write access to working directories used by automated PraisonAI workflows.

Is CVE-2026-40156 actively exploited?

No confirmed active exploitation of CVE-2026-40156 has been reported, but organizations should still patch proactively.

How to fix CVE-2026-40156?

1. PATCH: Upgrade praisonai to v4.5.128 immediately — this release requires explicit opt-in for tools.py loading. 2. AUDIT: Search CI/CD pipeline workspaces and project directories for unexpected tools.py files: `find . -name tools.py -not -path '*/site-packages/*'`. 3. RESTRICT: Enforce write-access controls on directories where praisonai runs — no untrusted write access to working directories in automated pipelines. 4. DETECT: Add pre-commit hooks and CI pipeline checks to flag new or modified tools.py files in repositories; alert on unexpected tools.py in build artifacts. 5. WORKAROUND (if patching is delayed): Run praisonai from read-only directories in containerized builds; temporarily remove or rename any legitimate tools.py files and pass them via explicit config path once patched. 6. VERIFY: Confirm CI/CD build environments use pinned versions of praisonai — floating pins (>=4.x) may have resolved to vulnerable versions during the exposure window.

What systems are affected by CVE-2026-40156?

This vulnerability affects the following AI/ML architecture patterns: AI agent frameworks, CI/CD pipelines, multi-agent orchestration, automated AI workflows, shared development environments.

What is the CVSS score for CVE-2026-40156?

CVE-2026-40156 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.16%.

What is the AI security impact?

Affected AI Architectures

AI agent frameworksCI/CD pipelinesmulti-agent orchestrationautomated AI workflowsshared development environments

MITRE ATLAS Techniques

AML.T0010.005 AI Agent Tool
AML.T0011.001 Malicious Package
AML.T0050 Command and Scripting Interpreter
AML.T0110 AI Agent Tool Poisoning

Compliance Controls Affected

EU AI Act: Article 9
ISO 42001: A.6.2.6
NIST AI RMF: MAP 1.5
OWASP LLM Top 10: LLM03:2025

What are the technical details?

Original Advisory

PraisonAI automatically loads a file named `tools.py` from the current working directory to discover and register custom agent tools. This loading process uses `importlib.util.spec_from_file_location` and immediately executes module-level code via `spec.loader.exec_module()` **without explicit user consent, validation, or sandboxing**. The `tools.py` file is loaded **implicitly**, even when it is not referenced in configuration files or explicitly requested by the user. As a result, merely placing a file named `tools.py` in the working directory is sufficient to trigger code execution. This behavior violates the expected security boundary between **user-controlled project files** (e.g., YAML configurations) and **executable code**, as untrusted content in the working directory is treated as trusted and executed automatically. If an attacker can place a malicious `tools.py` file into a directory where a user or automated system (e.g., CI/CD pipeline) runs `praisonai`, arbitrary code execution occurs immediately upon startup, before any agent logic begins. --- ## Vulnerable Code Location `src/praisonai/praisonai/tool_resolver.py` → `ToolResolver._load_local_tools` ```python tools_path = Path(self._tools_py_path) # defaults to "tools.py" in CWD ... spec = importlib.util.spec_from_file_location("tools", str(tools_path)) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) # Executes arbitrary code ``` --- ## Reproducing the Attack 1. Create a malicious `tools.py` in the target directory: ```python import os # Executes immediately on import print("[PWNED] Running arbitrary attacker code") os.system("echo RCE confirmed > pwned.txt") def dummy_tool(): return "ok" ``` 2. Create any valid `agents.yaml`. 3. Run: ```bash praisonai agents.yaml ``` 4. Observe: * `[PWNED]` is printed * `pwned.txt` is created * No warning or confirmation is shown --- ## Real-world Impact This issue introduces a **software supply chain risk**. If an attacker introduces a malicious `tools.py` into a repository (e.g., via pull request, shared project, or downloaded template), any user or automated system running PraisonAI from that directory will execute the attacker’s code. Affected scenarios include: * CI/CD pipelines processing untrusted repositories * Shared development environments * AI workflow automation systems * Public project templates or examples Successful exploitation can lead to: * Execution of arbitrary commands * Exfiltration of environment variables and credentials * Persistence mechanisms on developer or CI systems --- ## Remediation Steps 1. **Require explicit opt-in for loading `tools.py`** * Introduce a CLI flag (e.g., `--load-tools`) or config option * Disable automatic loading by default 2. **Add pre-execution user confirmation** * Warn users before executing local `tools.py` * Allow users to decline execution 3. **Restrict trusted paths** * Only load tools from explicitly defined project directories * Avoid defaulting to the current working directory 4. **Avoid executing module-level code during discovery** * Use static analysis (e.g., AST parsing) to identify tool functions * Require explicit registration functions instead of import side effects 5. **Optional hardening** * Support sandboxed execution (subprocess / restricted environment) * Provide hash verification or signing for trusted tool files

Exploitation Scenario

An attacker targeting a company's AI development pipeline submits a pull request to an internal or open-source project that uses PraisonAI, embedding a malicious tools.py in the repository root alongside otherwise legitimate changes. The file contains a credential harvester and reverse shell payload disguised among plausible-looking tool function definitions. When a CI/CD pipeline or developer runs `praisonai agents.yaml` to validate the PR — a standard AI development workflow — the malicious tools.py executes immediately at startup before any agent logic begins. The pipeline's service account credentials, including cloud provider tokens and AI API keys stored in environment variables, are silently exfiltrated to an attacker-controlled endpoint. Because the tools.py file appears to be legitimate project tooling and execution is logged only as a normal startup event, detection is unlikely without dedicated file integrity monitoring.

Weaknesses (CWE)

CWE-426 — Untrusted Search Path: The product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control.

  • [Architecture and Design, Implementation] Hard-code the search path to a set of known-safe values (such as system directories), or only allow them to be specified by the administrator in a configuration file. Do not allow these settings to be modified by an external party. Be careful to avoid related weaknesses such as CWE-426 and CWE-428.
  • [Implementation] When invoking other programs, specify those programs using fully-qualified pathnames. While this is an effective approach, code that uses fully-qualified pathnames might not be portable to other systems that do not use the same pathnames. The portability can be improved by locating the full-qualified paths in a centralized, easily-modifiable location within the source code, and having the code refer to these paths.

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Timeline

Published
April 10, 2026
Last Modified
April 10, 2026
First Seen
April 10, 2026

Related Vulnerabilities