/

CVE-2026-44336

Severity:

CRITICAL RISK

(9.6)

Path Traversal File Write in PraisonAI MCP File-Handling

CVE-2026-44336

Modified

Vulnerability type

Category:

Path Traversal / Arbitrary File Write

CWE:

CWE-20, CWE-22, CWE-94, CWE-829, CWE-913

Impact:

Arbitrary File Write leading to Remote Code Execution

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PraisonAI's MCP server exposes file-handling tools that accept user-controlled path strings and join them to a rules directory without containment checks, allowing path traversal outside the intended folder.

When combined with permissive writes, an attacker can create or overwrite arbitrary files the PraisonAI user can access, which can escalate to arbitrary code execution by dropping Python loader artifacts in site-packages or other sensitive locations.

Affected context

This vulnerability affects PraisonAI deployments where the MCP server (praisonai mcp serve) is exposed to external tools or agents that can invoke its JSON-RPC tools.

The at-risk context includes:

  • Installations using the default file-handling tools: praisonai.rules.create, praisonai.rules.show, praisonai.rules.delete, and praisonai.workflow.show
  • Environments where MCP tool arguments are influenced by untrusted or semi-trusted clients, plugins, or automation
  • Systems where the PraisonAI process runs with access to sensitive filesystem locations such as user site-packages, configuration directories, or scripts that are later executed by Python

The issue is most dangerous when PraisonAI runs under a user account that is also used to run other Python processes, since written files can be consumed by those processes automatically.

Exploit preconditions

  • Attack surface: MCP JSON-RPC interface (praisonai mcp serve) and the exposed file-handling tools.
  • Required access: Ability to invoke MCP tools or influence params["arguments"] for:
  • praisonai.rules.create
  • praisonai.rules.show
  • praisonai.rules.delete
  • praisonai.workflow.show (accepts absolute paths)
  • Trigger point: A tool invocation that supplies a crafted rule_name or equivalent path/filename argument (e.g., ../../relative/path), which the server joins onto ~/.praison/rules/ without containment checks, or uses as an absolute path for workflows.
  • Why exploitation is possible:
  • The JSON-RPC dispatcher forwards params["arguments"] directly to handlers via **kwargs, bypassing validation against the declared input schema (CWE-20, CWE-913).
  • The handlers perform naive path concatenation and accept absolute or traversal paths without sanitization or normalization (CWE-22).
  • The tools can write files in attacker-chosen locations that the PraisonAI-running user can write to, enabling crafted Python .pth or similar loader files to be dropped into directories automatically processed by Python (CWE-94, CWE-829).

Why this happens

The underlying bug is a combination of improper input validation and unsafe filesystem handling.

The MCP server assumes that incoming tool arguments conform to the advertised schema and represent safe, relative rule names, but it does not enforce this assumption.

The JSON-RPC dispatcher passes params["arguments"] directly to tool handlers using **kwargs, skipping type, shape, or value checks (CWE-20: Improper Input Validation, CWE-913: Improper Control of Dynamically-Managed Code Resources).

Inside the handlers, the path handling logic naively appends user-controlled strings to ~/.praison/rules/ or accepts absolute paths, without normalizing or verifying that the resulting path resides within the intended directory.

This pattern is a classic path traversal / directory breakout (CWE-22), which becomes more severe because the tools can create or modify arbitrary files.

When an attacker chooses locations the Python interpreter consults automatically (e.g., user site-packages and .pth files), this arbitrary write primitive escalates into arbitrary code execution in later Python processes (CWE-94, CWE-829).

Potential impact

  • Creation or modification of arbitrary files writable by the PraisonAI user account
  • Insertion of malicious .pth or other loader files into Python site-packages, enabling arbitrary code execution in subsequent Python processes
  • Persistence of attacker code that runs whenever the user launches PraisonAI, an IDE script, or a Python REPL
  • Overwriting or corrupting user configuration files, workflows, or other application data
  • Potential lateral movement within the user's environment by tampering with scripts or tooling invoked by automation

General mitigation guidance

Effective mitigation focuses on strictly validating tool inputs and constraining filesystem operations to safe, well-defined locations.

Pattern-based defensive measures include:

  • Enforce input schemas server-side: Validate JSON-RPC parameters against declared schemas before invoking handlers, including type checks, allowed fields, and disallowing unexpected keyword arguments.
  • Normalize and validate paths: Resolve user-supplied path segments to canonical absolute paths and verify that they remain within an approved base directory before performing any file I/O.
  • Disallow traversal sequences: Reject inputs containing .., absolute path prefixes, or path separators where only logical identifiers (e.g., rule names) are expected.
  • Use explicit allowlists: Treat rule names as opaque identifiers and map them to filenames via internal lookup tables or sanitized mappings, rather than accepting arbitrary filesystem paths.
  • Limit tool capabilities by default: Disable or restrict file-writing tools in untrusted or multi-tenant MCP deployments; prefer read-only operations unless write access is absolutely necessary.
  • Apply least privilege: Run PraisonAI under a dedicated, low-privilege user with limited write access, reducing the impact of any arbitrary file writes.

How teams detect issues like this

Detection should combine code-level analysis with runtime monitoring:

  • Static analysis and code review:
  • Flag handlers that:
  • Accept arbitrary **kwargs or dynamic parameter maps from RPC layers (indicative of CWE-20/CWE-913).
  • Directly concatenate user-controlled strings into filesystem paths.
  • Search for uses of os.path.join, Path(...), or file APIs where inputs originate from networked or external RPC arguments without normalization or containment checks.
  • Review MCP tool definitions to ensure their declared schemas are actually enforced server-side.
  • Automated tooling and CI policies:
  • Use static analysis tools or linters configured with custom rules to detect path traversal patterns and unsanitized path joins.
  • Enforce secure coding policies in code review that require path normalization and base-directory enforcement for all file-handling tools.
  • Runtime and operational monitoring:
  • Log MCP tool invocations along with normalized target paths and alert on suspicious patterns, such as .. components or unexpected directories.
  • Monitor file system changes in sensitive locations (e.g., Python site-packages, configuration directories) for unexpected new or modified files generated by PraisonAI processes.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-9mqq-jqxf-grvw

Frequently asked

questions

Exploitability depends on who can invoke the MCP tools.

If untrusted or semi-trusted clients, plugins, or remote agents can supply tool arguments to praisonai mcp serve, they can potentially abuse the file-handling tools to perform path traversal and arbitrary file writes.

It requires the ability to trigger MCP JSON-RPC tool calls with controlled arguments, which might be local or remote depending on how PraisonAI and its MCP server are deployed and integrated.

The process runs under the user's account, so the attacker is constrained to files that user can write, but does not necessarily need shell access.

The most robust fix pattern is to strictly validate and normalize all tool inputs server-side, reject any paths that escape a designated base directory, and avoid passing unchecked **kwargs from the dispatcher to handlers.

Treat rule identifiers as logical names, not raw filesystem paths, and resolve them only through controlled mappings.

Adopt a defensive design approach where:

  • RPC inputs are always validated against explicit schemas.
  • File operations are confined to whitelisted directories with canonical path checks.
  • Code review and automated analysis specifically look for path concatenation using user-controlled input.

Additionally, run services like PraisonAI with minimal filesystem privileges so that, even if a validation gap exists, the impact of arbitrary writes remains limited.

Find out what's already
exploitable in your codebase.