NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2026-61438: PraisonAI vulnerable to Remote Code Execution via Broken AST Sandbox

highCVSS 3.1 7.3GHSA-26mh-57q7-jfvr

PraisonAI before 4.6.78 lets a YAML workflow run arbitrary OS commands. The AST sandbox in `JobWorkflowExecutor._exec_inline_python()` allows `import os`, so a `script:` step can call `os.system()`. Anyone who runs an untrusted workflow with job workflows enabled is affected. Upgrade to 4.6.78.

Published Oct 29, 2026 · Analysis Oct 31, 2026

What an attacker can do

_exec_inline_python() is meant to run small inline Python expressions from a script: step in a type: job workflow. It checks every AST node against an allowlist and supplies a __builtins__ whitelist without __import__, exec, eval or open. Both checks fail. The allowlist of modules (allowed_modules) contains os, and the node allowlist permits ast.Import, ast.ImportFrom, ast.Call and ast.Attribute. A real import statement does not go through __import__ in the restricted builtins, so removing it achieves nothing. A step such as import os followed by os.system('id') passes validation and runs.

The attacker needs to get a workflow file in front of a user or pipeline. Typical routes are a shared repository, a downloaded template, or a workflow generated by an AI model. The victim must run praisonai workflow run with PRAISONAI_ALLOW_JOB_WORKFLOWS=true. The commands then run with the privileges of the calling process, so a CI job can expose its secrets and tokens. The CVSS vector (local, user interaction required) matches this: the attacker supplies the file, and a person or job runs it.

Who is affected

PraisonAI (pip package praisonai) versions before 4.6.78. Only setups that execute job-type YAML workflows with script: steps are exposed, which requires PRAISONAI_ALLOW_JOB_WORKFLOWS=true. Multi-tenant hosts and CI pipelines that take workflows from untrusted sources carry the most risk.

pip show praisonai

Also check the environment of your CI jobs and services for that variable.

praisonai

Ecosystem
PyPI
Affected
< 4.6.78
Fixed in
4.6.78
Check
pip show praisonai

How to fix it

Upgrade to praisonai 4.6.78.

pip install --upgrade "praisonai>=4.6.78"

The reporter recommends removing os from the module allowlist (allowing only os.path through an explicit check), and also reviewing re and collections. Until you upgrade, leave PRAISONAI_ALLOW_JOB_WORKFLOWS unset and run only workflows you wrote or reviewed.

How to tell if you were hit

Review workflow YAML files for script: steps that contain import os, os.system, os.popen, os.exec* or os.spawn*. Check shell history and CI logs for praisonai workflow run against files from outside your team. Look for child processes spawned by the praisonai Python process that you did not expect, such as shells, curl or id. If an AI agent can write or fetch workflow files, Beam's recorded agent shell commands and file access show which workflow was created and run.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

JobWorkflowExecutor._exec_inline_python() is designed to safely execute inline Python expressions from YAML workflow script: steps using AST validation. The function claims to block dangerous operations by (a) checking all AST nodes against an allowlist, and (b) providing a __builtins__ whitelist that omits __import__, exec, eval, and open.

The sandbox is broken. The module import allowlist (allowed_modules) explicitly includes 'os', and the AST allowlist permits ast.Import, ast.ImportFrom, ast.Call, and ast.Attribute nodes. This means the following malicious workflow script: step passes all AST validation checks and executes without error.

Attack Scenario

Attacker creates or contributes a YAML workflow file (type: job) with a script: step containing import os; os.system(...). A user or CI pipeline with PRAISONAI_ALLOW_JOB_WORKFLOWS=true executes the workflow via praisonai workflow run malicious.yaml. Arbitrary OS commands execute with the privileges of the calling process.

This is particularly dangerous in multi-tenant or CI environments where YAML workflows may originate from untrusted sources (e.g., downloaded templates, shared repositories, AI-generated workflows).

PoC

_Complete instructions, including specific configuration details, to reproduce the vulnerability._

Impact

Root Cause — Lines 364–372:

pythonallowed_modules = {'os', 'datetime', 'time', 'json', 'math', 're', 'collections', 'itertools'} if isinstance(node, ast.Import): for alias in node.names: if alias.name.split('.')[0] not in allowed_modules: return {"ok": False, "error": f"Import of '{alias.name}' not allowed..."}

os is trusted because it is commonly used for path operations (os.path, os.getcwd). However, os.system(), os.popen(), os.execvp(), os.spawn*(), and os._exit() are all accessible once the module is imported, none of which are individually blocked.

The __builtins__ restriction (blocking __import__) is irrelevant because the code uses a real import statement processed by the Python bytecode compiler — not a __import__() call.

Proof-of-Concept validation (static — no remote network call made):

pythonimport ast

_ALLOWED_NODES = ( ast.Expression, ast.BoolOp, ast.BinOp, ast.UnaryOp, ast.Compare, ast.IfExp, ast.Constant, ast.Name, ast.Load, ast.Store, ast.Subscript, ast.List, ast.Tuple, ast.Dict, ast.Set, ast.And, ast.Or, ast.Not, ast.Eq, ast.NotEq, ast.Lt, ast.LtE, ast.Gt, ast.GtE, ast.In, ast.NotIn, ast.Add, ast.Sub, ast.Mult, ast.Div, ast.Mod, ast.FloorDiv, ast.USub, ast.UAdd, ast.Call, ast.Attribute, ast.keyword, ast.Starred, ast.Module, ast.Assign, ast.Import, ast.ImportFrom, ast.alias, ) allowed_modules = {'os', 'datetime', 'time', 'json', 'math', 're', 'collections', 'itertools'}

malicious = "import os\nresult = os.system('id')" tree = ast.parse(malicious, mode="exec")

all_pass = True for node in ast.walk(tree): if not isinstance(node, _ALLOWED_NODES): print(f"BLOCKED: {type(node).__name__}") all_pass = False if isinstance(node, ast.Import): for alias in node.names: if alias.name.split('.')[0] not in allowed_modules: print(f"IMPORT BLOCKED: {alias.name}") all_pass = False

print("SANDBOX BYPASSED" if all_pass else "sandbox holds")

Output: SANDBOX BYPASSED

Recommended Fix

Remove 'os' from allowed_modules and replace it with only the safe submodule: 'os.path'. Then validate that the imported name is specifically os.path, not os:

python# BEFORE (vulnerable) allowed_modules = {'os', 'datetime', 'time', 'json', 'math', 're', 'collections', 'itertools'}

AFTER (safe)

allowed_modules = {'datetime', 'time', 'json', 'math', 're', 'collections', 'itertools', 'pathlib'}

If os.path is needed, handle it explicitly:

if isinstance(node, ast.ImportFrom): if node.module == 'os.path': pass # allow 'from os.path import join, exists' only elif node.module and node.module.split('.')[0] not in allowed_modules: return {"ok": False, "error": f"Import of '{node.module}' not allowed."}

Additionally, block ast.Import of os entirely, and consider also removing re (which can be used for ReDoS/CPU exhaustion) and collections (which can be used to reach __subclasses__-style gadgets).

Credited to chakrapani150.

Questions

Does this need the PRAISONAI_ALLOW_JOB_WORKFLOWS setting?

Yes. The attack scenario in the advisory runs the workflow with PRAISONAI_ALLOW_JOB_WORKFLOWS=true. If you have not enabled job workflows, this path is not reachable by running a malicious file.

Is CVE-2026-61438 exploited in the wild?

No source says so, and it is not in CISA's KEV catalog. The advisory gives a static proof of concept that shows the sandbox checks pass for os.system('id'). The EPSS score is low at 0.31%.

Why does blocking `__import__` not stop the attack?

The sandbox removes __import__ from the builtins, but the workflow code uses an import statement that the AST allowlist permits. The module check then approves os by name, so the import succeeds.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More PyPI vulnerabilities

All PyPI entries