HIGH 7.1

CVE-2026-50181: Langroid Path Traversal in File Tools – Patch to 0.64.0

Langroid is a framework that helps developers build applications powered by large language models (LLMs). Versions before 0.64.0 contain a path traversal vulnerability in the file reading and writing tools. While these tools are meant to restrict file operations to a specified directory, they fail to properly validate file paths. An attacker with access to trigger tool calls can use path traversal sequences like `../` to read sensitive files outside the intended directory or write malicious files in unexpected locations. This is particularly concerning when Langroid applications expose these tools directly to LLM agents or accept user-controlled instructions, as the safety boundary meant to isolate file access can be completely bypassed.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.1 HIGH · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Weaknesses (CWE)
CWE-22, CWE-23
Affected products
0 configuration(s)
Published / Modified
2026-07-10 / 2026-07-14

NVD description (verbatim)

Langroid is a framework for building large-language-model-powered applications. Prior to version 0.64.0, 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. Version 0.64.0 patches the issue.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability exists in Langroid's `ReadFileTool` and `WriteFileTool` implementations. The tools set the process working directory to `curr_dir` but then operate directly on unsanitized user-supplied `file_path` values without canonicalizing the path and verifying that the final resolved location remains within the `curr_dir` boundary. This allows attackers to supply relative path sequences containing traversal operators (e.g., `../secret.txt`) that escape the intended sandbox. The root cause is a logic gap between directory enforcement (changing the working directory) and path validation (not checking whether the final path is within bounds). Version 0.64.0 addresses this by implementing proper path resolution and boundary enforcement.

Business impact

Applications relying on Langroid file tools as a controlled interface between LLM agents and the filesystem face significant confidentiality and integrity risks. An LLM agent—whether autonomous or directed by a user—could read sensitive configuration files, credentials, source code, or private data stored outside the intended workspace. Similarly, an attacker could write malicious files, inject code into application directories, or overwrite critical files. For organizations using Langroid in production document-processing, code-generation, or multi-agent systems, this vulnerability could lead to data exfiltration, supply chain compromise, or system manipulation. The impact is heightened if the Langroid application runs with elevated privileges or has broad filesystem access.

Affected systems

Langroid framework versions prior to 0.64.0 are affected. This includes all earlier minor and patch versions. The vulnerability is only exploitable if an application explicitly exposes `ReadFileTool` or `WriteFileTool` to an LLM agent, user-controlled tool invocation interface, or delegated agent. Applications that do not use these tools, or that restrict tool access to authenticated and strictly-validated inputs, are not affected. Developers should verify their Langroid version and review how file tools are exposed in their architecture.

Exploitability

Exploitation requires the ability to influence tool calls—either through direct control of an LLM agent prompt, user input that reaches tool invocation, or a delegated agent scenario. The CVSS vector (AV:L/AC:L/PR:L/UI:N) indicates local access and low privilege are needed, with no user interaction required. An attacker does not need special system knowledge or complex setup; simple path traversal syntax is sufficient. However, real-world exploitability depends on the application's architecture and how strictly it controls tool access. High-risk deployments include chatbots or coding assistants that directly execute user-supplied tool calls, or autonomous agent systems with broad system access.

Remediation

Upgrade Langroid to version 0.64.0 or later immediately. This version implements proper path resolution and boundary checking to ensure file operations remain within the configured `curr_dir`. After upgrading, validate that your application's configuration still provides the intended security posture. If you cannot upgrade immediately, consider restricting exposure of file tools by limiting which agents or user roles can invoke them, implementing strict allowlists for file paths, or running Langroid applications in isolated environments with minimal filesystem permissions.

Patch guidance

Apply the upgrade to Langroid 0.64.0 at your earliest convenience, particularly for any production systems exposing file tools to untrusted or LLM-controlled invocations. Verify the upgrade via your package manager (e.g., `pip install langroid==0.64.0` or later) and confirm the version in your deployment logs. Test file tool functionality after upgrade to ensure no regressions in your application's intended behavior. For development environments, upgrade during your next dependency refresh cycle; for production, prioritize based on how exposed your file tools are to potential attacks.

Detection guidance

Monitor application logs and agent/tool invocation records for file path arguments containing traversal sequences (`../`, `..\`, or URL-encoded variants like `%2e%2e%2f`). Review Langroid application metrics for unusual file read/write patterns outside expected workspace boundaries. If available, enable filesystem auditing on systems running Langroid to detect unauthorized file access attempts. Examine agent interaction logs for requests that suggest path traversal probing. In post-incident analysis, correlate file tool invocations with actual filesystem modifications to identify what data was accessed or corrupted.

Why prioritize this

This vulnerability merits prompt remediation despite not being listed on the KEV catalog. Path traversal in file access tools is a fundamental security boundary failure. The CVSS score of 7.1 reflects high confidentiality and integrity impact. For organizations using Langroid as a bridge between AI agents and the filesystem, this vulnerability directly undermines trust in the sandbox model. The ease of exploitation (simple path syntax, no special tooling) and the broad scope of potential harm (reading/writing arbitrary files) justify treating this as a near-term fix, especially if your application runs with meaningful system privileges or handles sensitive data.

Risk score, explained

CVSS 7.1 (HIGH) is appropriate: the vulnerability allows unauthorized file read and write access (high confidentiality and integrity impact), requires local access and low privilege (typical for service accounts or containers), and can be exploited directly without additional user interaction or complex attack setup. The score reflects the severity of a broken sandbox boundary rather than a high-complexity remote code execution. Organizations with direct exposure of Langroid file tools should treat this as effectively critical in their own risk model, despite the CVSS rating.

Frequently asked questions

Does this affect my Langroid app if I don't use ReadFileTool or WriteFileTool?

No. The vulnerability is specific to those two tools. If your application uses only other Langroid tools (document parsing, API calling, etc.) and does not expose `ReadFileTool` or `WriteFileTool`, you are not affected. Review your tool configuration to confirm.

What's the difference between changing working directory and validating the final path?

Changing the working directory sets the process context, but relative paths supplied afterward (like `../file`) are still resolved relative to that context and can escape it. True boundary enforcement requires resolving the full path and checking that its canonical form lies within the intended directory. Langroid 0.64.0 implements this check.

Can a read-only file tool still be dangerous if path-traversal works?

Yes. A read-only tool can expose sensitive files (credentials, keys, proprietary code, private data). Attackers can extract this information for further compromise or selling. A write tool is additionally dangerous because it enables file corruption, injection attacks, and privilege escalation.

What if I run my Langroid app in a container with a read-only filesystem?

A read-only root filesystem significantly mitigates the write vulnerability but does not eliminate the read risk. You would still be exposed to information disclosure via `ReadFileTool`. Also, if the container has any writable mount (e.g., `/tmp`, a volume), the write tool could still abuse it. Upgrade to 0.64.0 for proper path validation.

This analysis is provided for informational purposes and reflects the vulnerability as described in available sources. Organizations should verify patch availability, version numbers, and compatibility with their deployments against the official Langroid project and security advisories. SEC.co makes no warranty regarding the completeness or real-time accuracy of this intelligence. Always conduct internal testing before deploying security patches to production systems, and consider consulting vendor documentation or professional security advisors for environment-specific guidance. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).