Summary
PraisonAI before version 1.6.78 contains a remote code execution flaw in SkillTools.run_skill_script(), which runs scripts based on attacker-controlled file paths.
By providing absolute paths, an attacker can execute arbitrary scripts from anywhere on the filesystem, including locations outside the intended working directory, when the skill runner is exposed to untrusted input.
Affected context
This vulnerability arises in PraisonAI deployments where skill execution is driven by dynamically supplied script paths.
Risk increases when:
- SkillTools.run_skill_script() accepts user-controlled or external input for script selection
- There is no validation or restriction on allowed directories
- The runtime environment hosts additional scripts or binaries that should not be directly executable via the skill interface
Exploit preconditions
- Attack surface: Interfaces (APIs, plugins, integrations, or UI flows) that allow callers to specify or influence the script path passed into SkillTools.run_skill_script().
- Required access: Ability to invoke skill execution with a chosen path argument (e.g., authenticated user, integration, or compromised component).
- Trigger point: Calling run_skill_script() with an absolute or crafted path referencing a script located outside the intended working directory.
- Why exploitation is possible: The function lacks path containment and directory whitelisting checks, allowing arbitrary filesystem paths to be treated as trusted scripts for execution.
Why this happens
The core issue is insufficient path validation when selecting scripts for execution.
SkillTools.run_skill_script() implicitly trusts caller-provided paths and does not enforce containment within a designated skills directory, nor does it apply robust allow-listing, canonicalization, or checks against traversal outside safe paths.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory (Path Traversal), where user-controlled paths are used directly to access or execute files beyond the intended directory scope.
Potential impact
- Execution of arbitrary scripts present anywhere on the filesystem
- Full remote code execution in the PraisonAI process context
- Reading or manipulating sensitive data via malicious or unintended scripts
- Lateral movement to other services accessible from the compromised application
- Escalation of privileges if powerful system utilities or admin scripts are reachable
General mitigation guidance
Effective mitigation focuses on treating script paths as untrusted input and constraining what can be executed by the skill runner.
Recommended patterns include:
- Restricting script execution to a dedicated, well-defined skills directory (or set of directories) and rejecting paths that fall outside these locations.
- Canonicalizing and normalizing paths before comparison (e.g., resolving symbolic links, '.' and '..' segments) to enforce containment checks reliably.
- Using an explicit allow-list or registry of known skill scripts, referenced by logical identifiers rather than direct filesystem paths supplied by callers.
- Running the skill execution environment with least-privilege, limiting filesystem access and OS-level capabilities available to executed scripts.
- Separating high-risk scripts or administrative utilities from directories accessible to the skill runner.
How teams detect issues like this
Detection typically combines code-level review and runtime monitoring:
- Static analysis and manual review to identify file execution APIs that accept caller-controlled paths without validation or containment checks.
- Search for uses of SkillTools.run_skill_script() where arguments originate from request parameters, configuration files, or external integrations.
- Enforcement of security coding guidelines requiring directory whitelisting and canonical path checks before script execution.
- Logging of executed script paths and monitoring for unusual locations (e.g., system directories, temporary folders, or user-upload directories).
- Optional use of automated security scanners or SAST tools with rules for path traversal and unsafe file execution patterns.

