Summary
PraisonAI's workflow engine allows arbitrary shell commands and Python code to be executed directly from untrusted YAML workflow files without validation or sandboxing.
In environments where attackers can supply or modify workflow YAML (such as CI pipelines, shared repos, or multi-tenant setups), this can lead to full compromise of the host system and its accessible data and credentials.
Affected context
This vulnerability affects PraisonAI deployments that execute workflows via praisonai workflow run <file.yaml> using YAML files of type: job.
The risk is highest when:
- Workflow YAML files originate from untrusted or partially trusted sources (e.g., contributor PRs, shared templates, or multi-tenant workflow catalogs)
- The workflow engine runs on CI/CD agents, build servers, or shared infrastructure with access to secrets or production systems
- There is no additional approval, review, or sandbox around workflow execution
In these situations, the workflow engine interprets fields like run, script, and python as executable instructions on the host.
Exploit preconditions
- Attack surface: The
praisonai workflow run <file.yaml>command and any automated process that invokes it on user-supplied YAML. - Required access: Ability to create, modify, or influence a workflow YAML file processed by PraisonAI (e.g., commit to a repository, contribute to a shared workflow library, or supply configuration in a multi-tenant environment).
- Trigger point: Execution of a workflow with
type: jobwhere steps includerun:,script:, orpython:fields. - Why exploitation is possible: The JobWorkflowExecutor (
job_workflow.py) passesruncontent directly tosubprocess.run()and executesscriptandpythoncontent using Python execution primitives (such asexec()or direct script invocation) without validation, sandboxing, or user confirmation. This aligns with CWE-78 (OS Command Injection) and CWE-94 (Improper Control of Code Generation) because attacker-controlled strings are treated as executable commands and code.
Why this happens
The core issue is that the workflow engine conflates configuration data with executable instructions, treating YAML fields as direct code and command sources.
Specifically:
- The
runfield is fed intosubprocess.run()in_exec_shell()with no restriction or sanitization, enabling arbitrary OS command execution (CWE-78). - The
scriptandpythonfields are executed as inline or external Python code via_exec_inline_python()and_exec_python_script(), effectively giving the YAML author the ability to run arbitrary Python (CWE-94). - There is no trust boundary enforcement, sandboxing, or policy layer that distinguishes trusted workflow authors from untrusted ones.
Abstractly, this reflects a design pattern where a workflow configuration language doubles as a scripting environment without isolation or permission controls, making any untrusted workflow file a potential code execution vector.
Potential impact
- Full arbitrary OS command execution on the machine running PraisonAI workflows
- Reading, modifying, or exfiltrating application secrets, API keys, and credentials available on the host or in the environment
- Unauthorized access to local files, databases, and network resources accessible from the host
- Compromise of CI/CD pipelines, including tampering with build artifacts or injecting malicious code
- Lateral movement within the infrastructure using the compromised host as a pivot
- Persistent backdoor installation, cryptomining, or other long-term abuses on the affected system
General mitigation guidance
Effective mitigation focuses on separating configuration from execution and constraining what workflows are allowed to do:
- Introduce a policy layer that declaratively restricts which workflow steps can execute shell commands or Python code, and under which conditions.
- Prefer whitelisted, parameterized actions over free-form
run,script, orpythonfields. For example, define named actions (e.g., "deploy", "lint") that internally handle commands rather than letting YAML supply arbitrary command strings. - Apply least-privilege execution for the workflow runner:
- Run the engine under a dedicated, low-privilege user account.
- Isolate it in containers or lightweight VMs with restricted filesystem and network access.
- Treat workflow YAML from external contributors as untrusted content, requiring explicit human review or approval before execution.
- Minimize the exposure of secrets and credentials to the workflow environment; use scoped tokens and secret providers that restrict what any single workflow can access.
- Where possible, introduce language-level sandboxing or restricted execution environments for any dynamic code that must remain supported.
How teams detect issues like this
Organizations can use multiple layers of detection and policy enforcement:
- Static analysis & linting:
- Scan workflow repositories for steps that use
run:,script:, orpython:with unconstrained free-form content. - Flag suspicious patterns, such as workflows that invoke system utilities known to be abused (e.g., shells, interpreters, network tools) from untrusted branches or tenants.
- Code review signals:
- Require security-focused review for any changes that introduce or modify PraisonAI workflow YAML files, especially in shared libraries.
- Maintain guidelines that call out direct command execution or inline Python inside workflows as high-risk patterns.
- Policy enforcement in CI/CD:
- Block automatic execution of new or modified workflows originating from forks or external contributors until approved.
- Use admission-like controls in pipeline orchestration (e.g., pre-run checks) to prevent certain step types in specific environments (e.g., production).
- Runtime monitoring:
- Monitor workflow runner hosts for anomalous process execution patterns, unexpected outbound network traffic, and unusual file-access behavior indicative of command injection.
- Centralize logs for subprocess executions invoked by the workflow engine and alert on suspicious commands.
- Automated review tools:
- Integrate security scanners that understand PraisonAI workflow syntax and enforce organization-specific policies around command and code execution.

