Browse / Direct Prompt Injection / CVE-2026-61445
PraisonAI: AICoder Arbitrary File Write and Command Execution via LLM Tool Calls
- Class
- Direct Prompt Injection (filed by a model that read the advisory)
- Technique
- Code and command execution
- Also involves
- Tool and Agent Misuse
- Affected
- praisonai (PyPI)
- CVSS
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
- EPSS
- 0.6% chance of exploitation in 30 days
How it works, in short
Prompt injection in the chat can make the coding assistant call unvalidated file-write and shell tools, writing arbitrary paths and running attacker commands. (Our summary, written by a model. The source text is below.)
Details
Summary
The AICoder UI component exposes write_to_file and execute_command tools to the LLM with no path validation and no command sanitization. An attacker can achieve arbitrary file write to any location on the filesystem (including /root/.ssh/authorized_keys, /etc/crontab) and arbitrary command execution through prompt injection in the chat interface. Docker containers run as root, maximizing impact.
Details
Path Traversal in write_to_file
src/praisonai/praisonai/ui/components/aicoder.py (lines 122-131):
async def write_to_file(self, file_path, content, existing=False):
if not existing:
await self.create_directories(file_path)
try:
with open(file_path, 'w') as file: # No path validation
file.write(content)
return True
except Exception as e:
return False
The apply_llm_response method at line 269 uses os.path.join which does not prevent absolute paths:
file_path = os.path.join(self.cwd, args["path"].strip())
# os.path.join("/app", "/etc/passwd") = "/etc/passwd"
Command Injection in execute_command
src/praisonai/praisonai/ui/components/aicoder.py (lines 159-180):
async def execute_command(self, command: str):
cmd_args = self.get_shell_command(command)
process = await asyncio.create_subprocess_exec(
*cmd_args,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
cwd=self.cwd
)
No command sanitization, no allowlist, no sandbox. The command string comes from LLM tool-call responses (line 279), which are influenced by user input.
PoC
1. Path traversal via prompt injection: 3
The LLM calls write_to_file("/etc/cron.d/backdoor", "* * * * * root curl ..."), no path validation blocks this.
- Command injection: