GitHub advisory · PyPI
PraisonAI: Shell command allowlist bypass via find -exec built-in action
Description
The shell command execution hardening introduced in PraisonAI npm 1.7.2 / Python 4.6.58 to fix GHSA-5jv7-2mjm-h6qj (utility-tools shell chaining) and GHSA-vjv9-7m7j-h833 (SandboxExecutor chaining) can be bypassed via find's built-in -exec action.
The fix blocks shell metacharacters (;|&`><$()${}) and uses spawn() with shell: false. However, find remains in the safe command allowlist, and its -exec ... {} + action executes commands without shell metacharacters — the + batch terminator replaces the blocked ; terminator. The same gap exists in 4 parallel implementations (verified by source inspection of each).
Root cause: Each of the four implementations validates the first token of the command against an allowlist or blocklist, then passes the remaining tokens as arguments to spawn()/subprocess.Popen() with shell: false. Shell metacharacter injection is indeed blocked.
However, find is a Unix command with built-in execution actions: -exec, -execdir, -delete, -ok, -okdir. These actions are interpreted by find itself, not by the shell. They execute programs or delete files without shell metacharacters (verified: the payload find /etc -name passwd -maxdepth 1 -execdir cat {} + passes the regex at line 240 of utility-tools.ts):
find /path -exec <command> {} +
The + terminator (batch mode) avoids ; which IS blocked by the metacharacter regex.
Affected components (4 implementations, same gap):
| # | Component | File | Gap |
|---|---|---|---|
| 1 | TS utility-tools shell() | src/praisonai-ts/src/tools/utility-tools.ts:255 | find in safeCommands allowlist |
| 2 | TS SandboxExecutor | src/praisonai-ts/src/cli/features/sandbox-executor.ts:30-50 | find absent from DEFAULT_BLOCKED_COMMANDS |
| 3 | Python safe_shell | src/praisonai/praisonai/cli/features/safe_shell.py:22-58 | find absent from BANNED_COMMANDS, present in SAFE_COMMANDS |
| 4 | Python…
Manual fix · PyPI
pip install --upgrade "praisonai>=4.6.78"Sources