/

CVE-2026-37007

Severity:

CRITICAL RISK

(9.8)

Path Traversal (CWE-22) in CrewAI FileWriterTool RCE

CVE-2026-37007

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

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 critical path traversal vulnerability in CrewAI's FileWriterTool allows a remote attacker to supply malicious filename values that escape the intended output directory. Under conditions where the tool is remotely reachable and accepts attacker-controlled filenames, this may enable arbitrary file writes and potentially code execution.

Affected context

The vulnerability affects deployments using the FileWriterTool in affected CrewAI Tools releases. Risk is present when the tool processes filename arguments influenced by an external or insufficiently trusted caller and writes files without reliably constraining the resolved destination to an approved directory. Exploitation impact depends on the service's exposure, filesystem permissions, and whether written content can later be executed or loaded as code.

Exploit preconditions

  • Attack surface: A remotely accessible interface, workflow, agent, or service that invokes FileWriterTool
  • Required access: Ability to submit or influence the filename argument; authentication requirements depend on the surrounding application
  • Trigger point: File creation or writing performed using the supplied filename
  • Why exploitation is possible: Path traversal sequences may cause the resolved path to escape the intended directory, allowing writes to locations with security-relevant effects

Why this happens

The underlying bug is insufficient validation and canonicalization of a user-influenced filename before it is used for filesystem access. When path components are accepted without enforcing confinement to an approved base directory, relative traversal can redirect writes outside that directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal. If an attacker can place content in a location later interpreted or executed by the runtime, the file-write primitive may become code execution.

Potential impact

  • An attacker may write or overwrite files outside the intended output directory
  • Application configuration, source, or operational files could be modified
  • The service may experience data loss, tampering, or denial of service
  • Written content could enable code execution when placed in an executable or automatically loaded location
  • Compromise could extend to other systems reachable with the process identity

General mitigation guidance

Mitigation generally focuses on enforcing a strict filesystem trust boundary around tool-generated files.

Common defensive patterns include:

  • Resolve candidate paths against a fixed, approved base directory and verify that the final path remains within that directory
  • Prefer generated identifiers or controlled basenames over caller-supplied paths
  • Reject traversal components, absolute paths, symlink escapes, and platform-specific path variants
  • Apply allowlists for permitted filenames and extensions where the workflow permits
  • Use dedicated low-privilege service identities with minimal filesystem write permissions
  • Store generated content outside executable, importable, configuration, and deployment-controlled locations
  • Treat filename and content inputs as untrusted even when requests originate from an internal workflow

How teams detect issues like this

Organizations can detect this class of issue through:

  • Static analysis rules for filesystem APIs receiving request, agent, or tool arguments
  • Code review checks for string concatenation or path joining without canonicalization and containment verification
  • Tests covering relative traversal, absolute paths, encoded separators, alternate platform separators, and symlink-based escapes
  • Runtime monitoring for file writes outside approved directories and unexpected modifications to executable or configuration paths
  • Policy enforcement that restricts tool output directories and service filesystem permissions
  • Automated security review tools that flag untrusted path construction and missing path-boundary checks

Sources

SourceLink
github.comgithub.com/crewAIInc/crewAI/commit/713fa7d
yerangamage.comyerangamage.com/cves/detail/?slug=crewai-file-write

Frequently asked

questions

It can be remotely exploitable when FileWriterTool is exposed through a network-accessible application, agent workflow, or API that permits an attacker to influence the filename argument. The surrounding service's authentication and authorization controls affect practical reachability.

An attacker needs a way to invoke the tool or control a request, task, or workflow that passes a malicious filename to it. The final impact also depends on the process's filesystem permissions and the files it can reach.

Constrain every resolved output path to a fixed, approved directory, reject unsafe path forms, and avoid using attacker-controlled paths when a generated filename or identifier is sufficient.

Treat all path components as untrusted, apply canonicalization and containment checks, test platform-specific traversal cases, and run file-writing components with least-privilege filesystem access.

Find out what's already
exploitable in your codebase.