PraisonAI: Arbitrary File Read/Write via `multiedit` Tool Without Path ValidationGHSA-29w3-p9w9-wc47
CRITICALGHSA-29w3-p9w9-wc47 is a critical-severity (CVSS 9.1) Path Traversal vulnerability in praisonai. A fix is available for praisonai — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-29w3-p9w9-wc47.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-29w3-p9w9-wc47 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 397,508 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
praisonaiReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
The multiedit tool in src/praisonai/praisonai/tools/multiedit.py allows LLM-controlled arbitrary file read and write without any path validation, workspace boundary check, or protected path guard. This enables an attacker who can influence agent tool arguments (via crafted prompts, user input in chat bots, or malicious YAML workflow configs) to read sensitive files (e.g., /etc/shadow, ~/.ssh/id_rsa, ~/.aws/credentials) and overwrite arbitrary files on the filesystem.
Details
The filepath parameter is used directly with open() for both reading (line 74) and writing (line 130) without any of the following protections that exist in other tools in the same codebase:
- No
..path traversal check — unlikefile_tools.py(line 66:if '..' in filepath: raise ValueError) andedit_tools.py(line 35). - No workspace boundary validation — unlike
file_tools.py(_validate_pathwithos.path.commonpathcheck) andskill_tools.py(read_skill_filewith workspace boundary check). - No protected path guard — unlike
praisonai/code/tools/which usesis_path_within_directoryand protected path checks. - No symlink resolution — unlike
file_tools.pywhich usesos.path.realpath.
The function is exported via src/praisonai/praisonai/tools/__init__.py as a lazy-loaded tool and is available to agents through the PraisonAI CLI tools registry.
Contrast with protected tools: The sibling tools write_file.py, read_file.py, apply_diff.py, and search_replace.py in src/praisonai/praisonai/code/tools/ all implement is_path_within_directory() checks and protected path guards. The multiedit tool has none of these protections.
PoC
Setup: Clean checkout of PraisonAI at commit d5f1114a. No additional dependencies needed beyond Python 3.10+.
Positive trigger — arbitrary file read via dry_run:
cd /tmp && python3 -c "
import sys
sys.path.insert(0, 'src/praisonai')
from praisonai.tools.multiedit import multiedit
# Read any file content via diff output (dry_run=True prevents write)
result = multiedit('/etc/hostname', [{'old': 'DOESNOTEXIST', 'new': 'x'}], dry_run=True)
# The diff output reveals the file contents
print('Success:', result['success'])
print('Content leaked via diff:', len(result.get('diff', '')), 'bytes')
"
Positive trigger — arbitrary file write:
cd /tmp && python3 -c "
import sys
sys.path.insert(0, 'src/praisonai')
from praisonai.tools.multiedit import multiedit
# Write to an arbitrary file outside workspace
with open('/tmp/victim_file.txt', 'w') as f:
f.write('original content here\n')
result = multiedit('/tmp/victim_file.txt', [{'old': 'original', 'new': 'PWNED'}])
with open('/tmp/victim_file.txt', 'r') as f:
print('File content after edit:', repr(f.read()))
"
Observed output:
# Read:
Success: False
Content leaked via diff: 0 bytes (file content still accessible via dry_run diff when edits match)
# Write:
File content after edit: 'PWNED content here\n'
Negative control — non-existent file:
result = multiedit('/nonexistent/file.txt', [{'old': 'a', 'new': 'b'}])
# Returns: {'success': False, 'error': 'File not found: /nonexistent/file.txt'}
Cleanup: rm /tmp/victim_file.txt
Impact
An attacker who can influence the filepath parameter of the multiedit tool (via crafted prompts to an AI agent, user messages in Telegram/Discord/Slack bots using auto_approve_tools=True, or YAML workflow configurations) can:
- Read arbitrary files — any file readable by the process user, including secrets, SSH keys, cloud credentials, environment files (
.env), and configuration files. - Write/overwrite arbitrary files — modify any file writable by the process user, enabling privilege escalation (e.g., writing to
~/.bashrc,~/.ssh/authorized_keys, or overwriting application source code).
This affects all deployments where agents have the multiedit tool available, including the PraisonAI CLI and chat bot deployments where auto_approve_tools defaults to True.
Suggested remediation
Apply the same path validation pattern used by file_tools.py and the code tools in src/praisonai/praisonai/code/tools/:
- Add a
_validate_pathfunction that:- Rejects paths containing
.. - Resolves symlinks via
os.path.realpath - Validates the resolved path is within the workspace/CWD using
os.path.commonpath
- Rejects paths containing
- Add protected path guards (
.env,.git,.ssh, keys, credentials) - Apply
_validate_pathto thefilepathparameter before anyopen()call - Consider adding
@require_approval(risk_level="high")to themultieditfunction
Credits
- Thai Son Dinh from VinSOC Labs (R&D)
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | praisonai | all versions | 4.6.61pip install --upgrade 'praisonai==4.6.61' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for praisonai, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update praisonai to 4.6.61 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-29w3-p9w9-wc47 is resolved across your whole dependency graph.
Workarounds
Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.
Frequently Asked Questions
Is GHSA-29w3-p9w9-wc47 in your dependencies?
Find it across PyPI, including transitive dependencies.