GHSA-w6h2-fr4q-xvxv: PraisonAI: Compute-bridged file tools allow shell command injection
Compute-bridged file tools allow shell command injectionSummary`LocalManagedAgent` / `SandboxedAgent` compute bridging wraps
`read_file`, `list_files`, and `write_file` when a compute provider is
attached. The bridge converts those file operations into shell command strings
using raw path arguments, then sends those strings to shell-backed compute
providers.An attacker who can influence a file-tool path argument can break out of the
quoted path and execute arbitrary shell commands in the compute environment.
With `compute="local"`, commands execute through the local subprocess compute
provider on the host. With Docker, commands execute in the container.Affected ProductRepository: `MervinPraison/PraisonAI`Package: `praisonai`Component: `src/praisonai/praisonai/integrations/managed_local.py`Confirmed affected:`v4.6.10``v4.6.56``v4.6.57`current `main` at `2f9677abb2ea68eab864ee8b6a828fd0141612e1`Confirmed not affected:`v4.6.9``v4.6.1``v4.5.149`Suggested affected range: `>= 4.6.10, <= 4.6.57`Root CauseCurrent `managed_local.py` defines the bridged tool set:For file tools, `_bridge_file_tool()` constructs shell command strings:The local compute provider executes the string with
`asyncio.create_subprocess_shell(...)`; the Docker compute provider executes it
with `["sh", "-c", command]`.The bridge keeps the low-risk `read_file` / `list_files` tool names and
signatures while changing their execution primitive into shell interpretation.Why This Is Not Intended BehaviorCompute bridging itself is documented and intentional. The vulnerability is
that file path data is interpreted as shell syntax.The normal `read_file` and `list_files` implementations treat the same payload
as a literal path and do not expand shell metacharacters. The approval registry
also marks `execute_command` as `critical`, while `read_file` and `list_files`
are not dangerous-tool entries.ImpactAn application that exposes a PraisonAI agent using `LocalManagedAgent` or
`SandboxedAgent` with a compute provider and a restricted file-tool set can be
tricked into executing shell commands through a path argument to `read_file` or
`list_files`.This can bypass least-privilege tool configuration and tool-approval
expectations. A prompt-injection path, chat endpoint, automation webhook, or
other user-controlled agent task can supply the file path argument without the
operator granting `execute_command`.Local PoVThe PoV is local-only and harmless. It uses an environment canary and compares
normal file tools against compute-bridged file tools.Minimal inline reproducer:Command:Current-head result:The payload used by the PoV is:Normal `read_file` treats this as a literal missing filename. The bridged tool
constructs:and returns the canary from the compute shell.Suggested FixDo not implement file operations by constructing shell command strings from
path/content arguments.Preferred fix:Add provider-native file APIs for read, write, and list operations, or pass
arguments as structured argv where the provider supports it.Preserve the normal file-tool path validation and workspace boundary checks
for compute-bridged file tools.Treat `write_file` content as data, not shell source. The current heredoc
construction is also unsafe if content can contain the delimiter.Add regression tests that use paths containing `"`, `;`, `$()`, backticks,
newline, and `#` and assert no shell execution occurs.Keep `execute_command` as the only bridge path that intentionally accepts a
shell command string, with critical approval semantics.A minimal stopgap is to remove `read_file`, `list_files`, and `write_file` from
`compute_bridged_tools` until safe provider-native file operations exist.Suggested SeverityThe vector assumes an attacker has low-privilege access to an agent interface
that can request file-tool use. If a deployment exposes such an agent without
authentication, `PR:N` may be appropriate.
CVSS v3.1: 8.8