CVE-2026-57145: PraisonAI Arbitrary File Read/Write Vulnerability

CRITICAL
Advisory Identifier: GHSA-29w3-p9w9-wc47
CVSS 9.1
CWE-22
Published
Advisory Summary

CVE-2026-57145 is a CRITICAL (CVSS 9.1) arbitrary file read/write vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting PraisonAI libraries in the PyPI ecosystem. The issue involves arbitrary file read/write via `multiedit` tool without path validation. Remediation is available by upgrading affected packages to version 4.6.61.

CVE-2026-57145 at a Glance

CVE Identifier CVE-2026-57145
GHSA Identifier GHSA-29w3-p9w9-wc47
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product PraisonAI
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-57145

To remediate this vulnerability, upgrade all affected PraisonAI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

praisonai fixed: 4.6.61
pip install praisonai>=4.6.61
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show praisonai

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-57145, inspect your installed packages using pip:

pip show praisonai

Analyze the terminal output to locate any version of PraisonAI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.61), your application is affected.

Note: The pip show praisonai command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In PraisonAI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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: 1. **No `..` path traversal check** — unlike `file_tools.py` (line 66: `if '..' in filepath: raise ValueError`) and `edit_tools.py` (line 35). 2. **No workspace boundary validation** — unlike `file_tools.py` (`_validate_path` with `os.path.commonpath` check) and `skill_tools.py` (`read_skill_file` with workspace boundary check). 3. **No protected path guard** — unlike `praisonai/code/tools/` which uses `is_path_within_directory` and protected path checks. 4. **No symlink resolution** — unlike `file_tools.py` which uses `os.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:** ```bash 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:** ```bash 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:** ```bash 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/`: 1. Add a `_validate_path` function that: - Rejects paths containing `..` - Resolves symlinks via `os.path.realpath` - Validates the resolved path is within the workspace/CWD using `os.path.commonpath` 2. Add protected path guards (`.env`, `.git`, `.ssh`, keys, credentials) 3. Apply `_validate_path` to the `filepath` parameter before any `open()` call 4. Consider adding `@require_approval(risk_level="high")` to the `multiedit` function ### Credits - Thai Son Dinh from VinSOC Labs (R&D)

CVE-2026-57145 Affected PraisonAI Versions

1 component(s)
Fixed Versions:
4.6.61
Product / Package Ecosystem Affected Versions Fixed Version
praisonai
PyPI
< 4.6.61
4.6.61

References

Frequently Asked Questions

What is CVE-2026-57145?
CVE-2026-57145 is a security vulnerability in PraisonAI involving Arbitrary File Read/Write via `multiedit` Tool Without Path Validation under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which PraisonAI versions are affected?
Affected versions include releases prior to 4.6.61 across affected packages: praisonai.
What version fixes CVE-2026-57145?
Upgrading to 4.6.61 (or the latest patched release for your respective branch) resolves the vulnerability.
Is praisonai affected?
Yes, praisonai is affected in releases prior to 4.6.61. Upgrade your dependency to 4.6.61 or later.
What is the CVSS score of CVE-2026-57145?
CVE-2026-57145 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-57145?
CVE-2026-57145 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2026-57145?
Run the dependency tree command: 'pip show praisonai'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-29w3-p9w9-wc47",
  "modified" : "2026-07-20T21:28:32Z",
  "published" : "2026-06-18T14:27:03Z",
  "aliases" : [ "CVE-2026-57145" ],
  "summary" : "PraisonAI: Arbitrary File Read/Write via `multiedit` Tool Without Path Validation",
  "details" : "## Summary\n\nThe `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.\n\n## Details\nThe `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:\n\n1. **No `..` path traversal check** — unlike `file_tools.py` (line 66: `if '..' in filepath: raise ValueError`) and `edit_tools.py` (line 35).\n2. **No workspace boundary validation** — unlike `file_tools.py` (`_validate_path` with `os.path.commonpath` check) and `skill_tools.py` (`read_skill_file` with workspace boundary check).\n3. **No protected path guard** — unlike `praisonai/code/tools/` which uses `is_path_within_directory` and protected path checks.\n4. **No symlink resolution** — unlike `file_tools.py` which uses `os.path.realpath`.\n\nThe 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.\n\n**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.\n\n## PoC\n\n**Setup:** Clean checkout of PraisonAI at commit `d5f1114a`. No additional dependencies needed beyond Python 3.10+.\n\n**Positive trigger — arbitrary file read via dry_run:**\n```bash\ncd /tmp && python3 -c \"\nimport sys\nsys.path.insert(0, 'src/praisonai')\nfrom praisonai.tools.multiedit import multiedit\n\n# Read any file content via diff output (dry_run=True prevents write)\nresult = multiedit('/etc/hostname', [{'old': 'DOESNOTEXIST', 'new': 'x'}], dry_run=True)\n# The diff output reveals the file contents\nprint('Success:', result['success'])\nprint('Content leaked via diff:', len(result.get('diff', '')), 'bytes')\n\"\n```\n\n**Positive trigger — arbitrary file write:**\n```bash\ncd /tmp && python3 -c \"\nimport sys\nsys.path.insert(0, 'src/praisonai')\nfrom praisonai.tools.multiedit import multiedit\n\n# Write to an arbitrary file outside workspace\nwith open('/tmp/victim_file.txt', 'w') as f:\n    f.write('original content here\\n')\nresult = multiedit('/tmp/victim_file.txt', [{'old': 'original', 'new': 'PWNED'}])\nwith open('/tmp/victim_file.txt', 'r') as f:\n    print('File content after edit:', repr(f.read()))\n\"\n```\n\n**Observed output:**\n```\n# Read:\nSuccess: False\nContent leaked via diff: 0 bytes  (file content still accessible via dry_run diff when edits match)\n\n# Write:\nFile content after edit: 'PWNED content here\\n'\n```\n\n**Negative control — non-existent file:**\n```bash\nresult = multiedit('/nonexistent/file.txt', [{'old': 'a', 'new': 'b'}])\n# Returns: {'success': False, 'error': 'File not found: /nonexistent/file.txt'}\n```\n\n**Cleanup:** `rm /tmp/victim_file.txt`\n\n## Impact\n\nAn 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:\n\n- **Read arbitrary files** — any file readable by the process user, including secrets, SSH keys, cloud credentials, environment files (`.env`), and configuration files.\n- **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).\n\nThis 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`.\n\n\n## Suggested remediation\n\nApply the same path validation pattern used by `file_tools.py` and the code tools in `src/praisonai/praisonai/code/tools/`:\n\n1. Add a `_validate_path` function that:\n   - Rejects paths containing `..`\n   - Resolves symlinks via `os.path.realpath`\n   - Validates the resolved path is within the workspace/CWD using `os.path.commonpath`\n2. Add protected path guards (`.env`, `.git`, `.ssh`, keys, credentials)\n3. Apply `_validate_path` to the `filepath` parameter before any `open()` call\n4. Consider adding `@require_approval(risk_level=\"high\")` to the `multiedit` function\n\n### Credits\n- Thai Son Dinh from VinSOC Labs (R&D)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "praisonai"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.6.61"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-29w3-p9w9-wc47"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/MervinPraison/PraisonAI"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-18T14:27:03Z",
    "nvd_published_at" : null
  }
}