Executive brief
Langflow is a visual framework used to build and deploy Large Language Model (LLM) applications. A security flaw in its PythonCodeTool component allows an attacker to run arbitrary commands on the server hosting the application. This could lead to a complete system takeover, unauthorized access to sensitive data, or disruption of services.
Technical details
A remote code execution (RCE) vulnerability exists in Langflow v1.0.12 and earlier within the PythonCodeTool component. The vulnerability stems from the 'build' method in the component, which utilizes the Python 'exec()' function to process the 'tool_code' parameter without sufficient validation or sandboxing. An attacker can exploit this by providing malicious Python code (e.g., using os.popen to read sensitive files like /etc/passwd) through the tool's configuration. Successful exploitation allows for arbitrary code execution in the context of the server process. The attack can be performed over the network without authentication if the Langflow interface or API is exposed.
Affected products
- langflow-ai langflow <= 1.0.12
Timeline
- 2024-07-24: disclosed: Issue reported on GitHub repository
- 2024-10-31: advisory: GitHub Advisory and NVD entry published