/

CVE-2026-56839

Severity:

HIGH RISK

(7.3)

Path Traversal (CWE-22) in PraisonAI CODE_TOOLS Wrappers

CVE-2026-56839

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-200, CWE-863

Impact:

Unauthorized File Read and Modification

Severity:

HIGH RISK

(7.3)

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

A path traversal vulnerability in PraisonAI's CODE_TOOLS wrappers can allow prompt-influenced operations to access files outside the intended project workspace. When a workspace has not been configured, exposed file-reading and file-modification helpers may process paths without containment checks.

Affected context

The vulnerability occurs in PraisonAI deployments that expose code_read_file, code_search_replace, or code_apply_diff before set_workspace establishes a valid project directory. In this state, the wrappers retain a null workspace and pass it to helpers that enforce path containment only when a workspace value is present. Explicitly configured workspaces can continue to provide effective path restrictions.

Exploit preconditions

  • Attack surface: CODE_TOOLS file-access and file-editing helpers exposed to an agent or application
  • Required access: Ability to influence prompts or tool calls processed by the application
  • Trigger point: Invocation of file-reading or file-modification operations before workspace initialization
  • Why exploitation is possible: A missing workspace disables the intended path-containment check, allowing supplied paths to resolve outside the project directory

Why this happens

The underlying bug is an unsafe authorization and path-validation pattern. The CODE_TOOLS wrappers preserve _workspace_root as None and pass workspace=None to helper functions whose containment checks are conditional on a truthy workspace value. As a result, file paths are not consistently constrained to an approved directory when initialization is skipped. This primarily maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related exposure and authorization concerns represented by CWE-200 and CWE-863.

Potential impact

  • An attacker may read sensitive files accessible to the application process.
  • An attacker could modify, replace, or delete files outside the intended project directory.
  • Exposed credentials, configuration data, or source code may be disclosed.
  • Application integrity could be undermined through unauthorized workspace changes.
  • Further compromise may be possible if modified files are later executed or trusted by another process.

General mitigation guidance

Mitigation generally focuses on making workspace initialization mandatory and enforcing path containment independently of optional configuration values.

Common defensive patterns include:

  • Fail closed when no valid workspace has been configured.
  • Resolve and canonicalize paths before comparing them with an approved workspace root.
  • Apply containment checks to every file operation, including reads, writes, replacements, and diffs.
  • Avoid deriving tool paths directly from prompt-controlled values without validation.
  • Expose file-modification tools only to trusted workflows and use least-privilege process accounts.
  • Restrict accessible directories through sandboxing, filesystem permissions, and policy enforcement.

How teams detect issues like this

Organizations can detect similar issues through:

  • Static analysis rules that identify optional or null path-validation guards.
  • Code review checks for file operations that accept user- or prompt-influenced paths.
  • Tests that invoke tools before initialization and verify that they fail closed.
  • Policy checks requiring canonicalization and containment validation for filesystem access.
  • Runtime monitoring for tool calls accessing paths outside approved project roots.

Automated code review and security scanning tools may help identify missing authorization checks and unsafe filesystem patterns.

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/commit/b4270173d4123fb1ee8910588f0896668ee21b59
github.comgithub.com/MervinPraison/PraisonAI/releases/tag/v4.6.59
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-gcq3-mfvh-3x25

Frequently asked

questions

It can be exploitable through an exposed application interface when an attacker can influence prompts or tool calls and the relevant CODE_TOOLS are available before workspace setup. The precise scope depends on how the application exposes and authenticates those tools.

Authentication is not inherently required by the underlying flaw, but any access control protecting the application or its tools may limit exploitation. The important condition is the ability to cause the affected helpers to run before a workspace is configured.

Require successful workspace initialization before enabling file tools, and make every operation reject paths that are not canonically contained within the approved workspace.

Treat prompt-derived paths as untrusted input, enforce fail-closed authorization at the filesystem boundary, test uninitialized and misconfigured states, and apply least-privilege permissions and sandboxing.

Find out what's already
exploitable in your codebase.