CVE-2026-40287: PraisonAI has RCE via Automatic tools.py Import
PraisonAI automatically imports ./tools.py from the current working directory when launching certain components. This includes call.py, toolresolver.py, and CLI tool-loading paths.
A malicious tools.py placed in the process working directory is executed immediately, allowing arbitrary Python code execution in the host environment.
Affected Code - call.py → importtoolsfromfile() - toolresolver.py → loadlocaltools() - tools.py → local tool import flow -
PoC Create tools.py in the directory where PraisonAI is launched:
python tools.py import os os.system("echo pwned > /tmp/pwned.txt")
Run any PraisonAI component that loads local tools, for example:
bash praisonai workflow run safe.yaml
Reproduction Steps 1. Create a malicious tools.py in the current working directory. 2. Start PraisonAI or invoke a CLI command that loads local tools. 3. Verify that /tmp/pwned.txt or the malicious command output exists.
Impact An attacker who can place or influence tools.py in the working directory can execute arbitrary code in the PraisonAI process, compromising the host and any connected data.
Reporter: Lakshmikanthan K (letchupkt)
Other sources
PraisonAI is a multi-agent teams system. Versions 4.5.138 and below are vulnerable to arbitrary code execution through automatic, unsanitized import of a tools.py file from the current working directory. Components including call.py (importtoolsfromfile()), toolresolver.py (loadlocaltools()), and CLI tool-loading paths blindly import ./tools.py at startup without any validation, sandboxing, or user confirmation. An attacker who can place a malicious tools.py in the directory where PraisonAI is launched (such as through a shared project, cloned repository, or writable workspace) achieves immediate arbitrary Python code execution in the host environment. This compromises the full PraisonAI process, the host system, and any connected data or credentials. This issue has been fixed in version 4.5.139.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/PraisonAIto a version that resolves this vulnerability.Fixed in 4.5.139 - Upgrade
Upgrade
pip/praisonaiagentsto a version that resolves this vulnerability.Fixed in 1.5.140 - Upgrade
Upgrade
PraisonAIto a version that resolves this vulnerability.Fixed in 4.5.139 - Compensating control
Prevent untrusted users or processes from writing a tools.py file into the current working directory or the directory where PraisonAI is launched (e.g., ensure the launch/workspace directory is not writable by attackers).
- Operational
After upgrading, verify the expected behavior and check for indicators of compromise such as whether /tmp/pwned.txt (or malicious command output) was created by the exploit.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-40287?
CVE-2026-40287 is classified as a high-severity vulnerability due to its potential for arbitrary code execution.
How do I fix CVE-2026-40287?
To mitigate CVE-2026-40287, upgrade to PraisonAI version 4.5.139 or later, which addresses the issue.
What types of software are affected by CVE-2026-40287?
CVE-2026-40287 affects PraisonAI versions 4.5.138 and earlier.
What does CVE-2026-40287 exploit?
CVE-2026-40287 exploits the unsanitized import of a tools.py file leading to possible arbitrary code execution.
What components are involved in CVE-2026-40287?
Components involved in CVE-2026-40287 include call.py and the automatic import functionality in PraisonAI.