Langroid
- <= 0.63.0
A path traversal vulnerability has been identified in Langroid's file handling tools, specifically in versions through 0.63.0. The issue arises because the ReadFileTool and WriteFileTool do not properly enforce directory boundaries when performing file operations. Instead of validating that the final file path remains within the designated current directory, the tools allow traversal sequences to escape this boundary. This flaw can be exploited to read or write files outside the intended workspace, potentially exposing sensitive information or modifying files in unintended ways. The vulnerability is particularly concerning in applications that delegate file operations to an LLM agent or similar user-controlled context.
Exploitation of this vulnerability allows for unauthorized reading and writing of files outside the designated current directory, potentially leading to exposure of sensitive information or modification of important files. In applications where these file tools are exposed to an LLM agent or user-controlled environment, the risk is amplified, as local secrets and project-related files could be accessed or altered.
The vulnerability can be reproduced by creating a sandbox directory and using the ReadFileTool or WriteFileTool with file paths that traverse outside this directory. For instance, a path like '../secret.txt' can be used to read a file located just outside the sandbox, or '../escaped.txt' to write a file outside the allowed directory.
Users are advised to update to Langroid version 0.64.0 or later, where this vulnerability has been patched. In addition, applications should ensure that file paths are properly validated to prevent traversal outside of intended directory boundaries.
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.