Skip to main content

Langroid CVE-2026-50181

HIGH
Path Traversal (CWE-22)
2026-07-02 https://github.com/langroid/langroid GHSA-fg23-3346-88f5
7.1
CVSS 3.1 · Vendor: https://github.com/langroid/langroid
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Gain ability to influence tool arguments (agent/prompt injection)
  2. Delivery
    Invoke ReadFileTool/WriteFileTool with '../' traversal path
  3. Exploit
    Path resolves outside curr_dir sandbox
  4. Execution
    Read secrets or write files on host
  5. Impact
    Exfiltrate credentials or tamper with adjacent files

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that the host application (1) enables Langroid's ReadFileTool and/or WriteFileTool, and (2) treats the configured curr_dir as a security boundary restricting file access to a project/workspace/sandbox. Given that, the attacker only needs the ability to influence the tool's file_path argument - supplying a traversal path such as '../secret.txt' (read) or '../written_by_tool.txt' (write), or an absolute path outside curr_dir. Limiting factors: this is NOT remotely exploitable by default (no attack surface exists unless the file tools are exposed to an LLM agent or user-controlled tool call, per the reporter's own disclaimer), file access is bounded by the OS privileges of the Langroid process, and applications that never enable these tools or never rely on curr_dir as a sandbox are not affected. The CVSS PR:L reflects that the attacker operates through an already-granted tool-invocation capability rather than as an anonymous remote user.

Impact

The CVSS 3.1 vector (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N, base 7.1) models a local, low-complexity, low-privilege attacker gaining high confidentiality and integrity impact with no availability impact, which fits arbitrary file read/write within the host's permissions. The realistic risk is highly deployment-dependent: the vulnerability only matters when an application actually exposes Langroid's file tools to an LLM agent or to user-influenced tool arguments and relies on curr_dir as a security boundary - the report explicitly disclaims default unauthenticated remote exploitation. In agentic pipelines this is a meaningful trust-boundary bypass (prompt-injected or malicious tool input can pivot to host file access), but in deployments that do not enable these tools or do not treat curr_dir as a sandbox the practical impact is negligible. No EPSS score, SSVC decision, or KEV entry is provided in the input, so exploitation-probability and automatable signals cannot be quantified; the confirmed working PoC establishes that exploitation is trivial where the preconditions hold, but PoC availability is not evidence of active exploitation.

Exploit ScenarioDerived

An application uses Langroid to run a coding/documentation agent, enables WriteFileTool and ReadFileTool, and sets curr_dir to the project workspace assuming the agent cannot touch files elsewhere. Via prompt injection or a malicious/user-supplied tool argument, the agent issues ReadFileTool(file_path='../../.env') to exfiltrate credentials, then WriteFileTool(file_path='../../.ssh/authorized_keys', ...) to plant data outside the workspace. A working PoC in the report confirms both the read and write escapes succeed.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 02, 2026

Path traversal in Langroid's ReadFileTool and WriteFileTool lets a tool caller escape the configured curr_dir workspace boundary by supplying '../' sequences in file_path, because the tools only chdir into curr_dir without resolving and enforcing that the final path stays inside it. Applications that expose these file tools to an LLM agent or user-influenced tool calls can have arbitrary files read or written outside the intended project/sandbox directory, exposing secrets, config, and source files or corrupting files elsewhere on the host. Publicly available exploit code exists (a working PoC is included in the report demonstrating both read and write escapes), but there is no public exploit identified as being used in active attacks and it is not listed in CISA KEV.

RemediationAI

Upstream fix available (PR/commit); released patched version not independently confirmed - apply the vendor fix in commit https://github.com/langroid/langroid/commit/56e2756ecab70a70a7e6edbee2f2187b8484683e (referenced from advisory GHSA-fg23-3346-88f5) and upgrade langroid to a release that includes it once published, then verify by confirming ReadFileTool(file_path='../secret.txt') and WriteFileTool(file_path='../outside.txt') are rejected. The fix pattern resolves the base directory and target path and rejects any target that escapes the base (including absolute paths and post-resolution symlink escapes) while still allowing legitimate in-tree paths like src/main.py. Until upgraded, the most effective compensating control is to not expose ReadFileTool/WriteFileTool/ListDirTool to LLM- or user-controlled input (disable these tools in agent configurations), which removes the attack surface at the cost of losing file-tool functionality; alternatively, run the agent process under a dedicated low-privilege OS user with filesystem access constrained to the intended workspace (e.g., a container bind-mount or chroot scoped to curr_dir) so that traversal cannot reach secrets or config outside the workspace - this adds deployment complexity but enforces the boundary at the OS layer regardless of the application bug.

Affected Packages

pypi langroid fix: 0.64.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Langroid is a Python multi-agent LLM framework (distributed as the PyPI package 'langroid'); the affected logic lives in langroid/agent/tools/file_tools.py and langroid/utils/system.py. The file tools implement a workspace sandbox by changing the process working directory to curr_dir and then calling read_file/create_file on the caller-supplied file_path - a design captured by the in-code comment 'ASSUME: file_path should be relative to the curr_dir.' The root cause is CWE-22 (Improper Limitation of a Pathname to a Restricted Directory): changing the CWD does not constrain path resolution, so relative traversal like ../secret.txt or absolute paths resolve outside curr_dir. Proper mitigation requires canonicalizing both the base and target (Path.resolve()) and rejecting any target that is not the base or a descendant of it, including after symlink resolution.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/langroid/langroid) PRIMARY 7.1 HIGH
AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
vuln.today AI 7.1 HIGH

Attacker acts through an already-granted tool-call capability (PR:L, AV:L) with trivial traversal (AC:L), yielding arbitrary host-permission file read/write (C:H/I:H) but no availability loss (A:N).

3.1 AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
4.0 AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/langroid/langroid).

CVSS VectorVendor: https://github.com/langroid/langroid

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

DescriptionCVE.org

Summary

Langroid's ReadFileTool and WriteFileTool appear to treat curr_dir as the intended working-directory boundary for file operations. However, the tools only change the process working directory to curr_dir and then operate on the user-supplied file_path without resolving and enforcing that the final path remains inside curr_dir.

As a result, a tool caller can supply path traversal sequences such as ../secret.txt to read files outside the configured current directory, or ../written_by_tool.txt to write files outside that directory.

This can impact applications that expose Langroid file tools to an LLM agent, user-controlled tool call, or delegated coding/documentation agent while relying on curr_dir to restrict file access to a project/workspace directory.

Details

Affected components:

  • langroid/agent/tools/file_tools.py
  • langroid/utils/system.py

Relevant behavior observed:

ReadFileTool contains a comment indicating the intended assumption:

text
# ASSUME: file_path should be relative to the curr_dir

The tool then changes into the configured current directory and calls read_file(self.file_path).

WriteFileTool similarly resolves curr_dir, changes into that directory, and calls create_file(self.file_path, self.content).

The issue is that changing the process working directory does not prevent traversal. A path such as ../secret.txt is still valid and resolves outside the configured curr_dir.

In local testing, ReadFileTool successfully read a file outside the configured sandbox directory, and WriteFileTool successfully wrote a file outside the configured sandbox directory.

PoC

Tested locally against the current Langroid repository checkout.

Environment:

Python 3.12
Langroid installed in editable mode with pip install -e .

PoC script:

from pathlib import Path
from tempfile import TemporaryDirectory
import os

os.environ["docker"] = "false"
os.environ["DOCKER"] = "false"

from langroid.agent.tools.file_tools import ReadFileTool, WriteFileTool


class DummyIndex:
    def add(self, files):
        print("dummy git add:", files)

    def commit(self, message):
        print("dummy git commit:", message)


class DummyRepo:
    index = DummyIndex()


with TemporaryDirectory() as root:
    base = Path(root)
    sandbox = base / "sandbox"
    sandbox.mkdir()

    secret = base / "secret.txt"
    secret.write_text("LANGROID_TOOL_ESCAPE_PROOF", encoding="utf-8")

    ReadSandbox = ReadFileTool.create(get_curr_dir=lambda: sandbox)
    read_tool = ReadSandbox(file_path="../secret.txt")

    print("READ TOOL RESULT:")
    print(read_tool.handle())

    WriteSandbox = WriteFileTool.create(
        get_curr_dir=lambda: sandbox,
        get_git_repo=lambda: DummyRepo(),
    )

    write_tool = WriteSandbox(
        file_path="../written_by_tool.txt",
        content="WRITTEN_BY_LANGROID_TOOL",
        language="text",
    )

    print("WRITE TOOL RESULT:")
    print(write_tool.handle())

    outside = base / "written_by_tool.txt"
    print("outside exists:", outside.exists())
    print("outside content:", outside.read_text(encoding="utf-8"))

Observed output:

READ TOOL RESULT:

    CONTENTS of ../secret.txt:
    (Line numbers added for reference only!)
    ---------------------------
    1: LANGROID_TOOL_ESCAPE_PROOF

WRITE TOOL RESULT:
Content created/updated in: ..\written_by_tool.txt
dummy git add: ['../written_by_tool.txt']
dummy git commit: Agent write file tool
Content written to ../written_by_tool.txt and committed
outside exists: True
outside content: WRITTEN_BY_LANGROID_TOOL

This demonstrates that both read and write operations can escape the configured curr_dir using ../ traversal.

Impact

If an application enables Langroid's file tools and treats curr_dir as a project, workspace, repository, or sandbox boundary, a tool caller can escape that boundary.

Potential impact includes:

Reading files outside the intended workspace.
Writing files outside the intended workspace.
Exposing local secrets, configuration files, source files, environment files, or other project-adjacent files.
Modifying files outside the intended project directory if WriteFileTool is enabled.

This is especially relevant in agentic workflows where an LLM or external user can influence tool arguments.

This report does not claim unauthenticated remote exploitation by default. The impact depends on how an application exposes Langroid file tools and whether curr_dir is intended to restrict file access.

Suggested remediation

Before reading, writing, or listing files, resolve the configured base directory and the requested target path, then reject any path that escapes the base directory.

Example patch pattern:

from pathlib import Path

def safe_join(base_dir: str | Path, user_path: str | Path) -> Path:
    base = Path(base_dir).resolve()
    target = (base / user_path).resolve()

    if target != base and base not in target.parents:
        raise ValueError("Path escapes configured current directory")

    return target

Then use the resolved safe path for ReadFileTool, WriteFileTool, and ListDirTool.

Suggested regression tests:

ReadFileTool(file_path="../secret.txt") should be rejected.
WriteFileTool(file_path="../outside.txt") should be rejected.
Absolute paths outside curr_dir should be rejected.
Symlink-based escapes should be rejected after final path resolution.
Normal relative paths inside curr_dir, such as src/main.py, should continue to work.

[Langroid CVE Report.pdf](https://github.com/user-attachments/files/28333958/Langroid.CVE.Report.pdf)

Executive ViewAI

Why It Matters

Langroid contains a path traversal vulnerability in its file access tools that permits unauthorized reading and writing of files outside the configured workspace, potentially exposing sensitive configurations, source code, and credentials. Any organization running Langroid-based LLM applications that expose file operations to agents or end users faces risk of data breach and system compromise. Immediate patching is required to contain this exposure.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.2%
Top 92% exploitable
Prevalence
Low
niche Python LLM-agent framework, limited production deployment footprint
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Social Media
1
Sightings
Data Quality
4 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA CIRCL GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

56
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +36
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)CVE.org

pkg:pip/langroid

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy