CVE-2025-2828:
LangChain Community SSRF vulnerability exists in RequestsToolkit component
8.4
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
langchain-community | pip | < 0.0.27 | 0.0.28 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The root cause of the vulnerability is a Server-Side Request Forgery (SSRF) in the RequestsToolkit
component of the langchain-community
package. The request-making tools (RequestsGetTool
, RequestsPostTool
, etc.) did not have any restrictions on the URLs they could be instructed to access. This allowed an attacker to potentially scan internal networks, access local services, or query cloud metadata endpoints.
The vulnerability was not in a single line of code but rather in the design of how these powerful tools were provided to the end-developer. They were insecure by default. The investigation of the patch e188d4ecb085d4561a0be3c583d26aa9c2c3283f
reveals that the fix was to introduce a mandatory opt-in mechanism.
-
A check was added to the
__init__
method ofBaseRequestsTool
, the parent class for all request tools. This check ensures that a developer must explicitly passallow_dangerous_requests=True
to instantiate any of these tools, preventing accidental insecure use. -
Factory functions like
RequestsToolkit.get_tools
and the high-levelload_tools
function were modified to propagate this new security flag. Before the patch, these functions would create and return the request tools in their default, vulnerable state.
Therefore, the vulnerable functions are the ones responsible for creating and providing these insecurely configured tools to the end-user, as they were the entry points for introducing the SSRF risk into an application.
Vulnerable functions
langchain_community.tools.requests.tool.BaseRequestsTool.__init__
libs/community/langchain_community/tools/requests/tool.py
langchain_community.agent_toolkits.openapi.toolkit.RequestsToolkit.get_tools
libs/community/langchain_community/agent_toolkits/openapi/toolkit.py
langchain.agents.load_tools.load_tools
libs/langchain/langchain/agents/load_tools.py