Server-Side Request Forgery in langchain-community.retrievers.web_research.WebResearchRetriever
The Web Research Retriever in langchain-community did not restrict requests to remote internet addresses, allowing it to reach local addresses. An attacker could use this to perform port scans, access local services, and in some cases read cloud instance metadata.
langchain-ai/langchain
Originally disclosed on huntr
A Server-Side Request Forgery (SSRF) vulnerability exists in the Web Research Retriever component in langchain-community (langchain-community.retrievers.web_research.WebResearchRetriever). The vulnerability arises because the Web Research Retriever does not restrict requests to remote internet addresses, allowing it to reach local addresses. This flaw enables attackers to execute port scans, access local services, and in some scenarios, read instance metadata from cloud environments. The vulnerability is particularly concerning as it can be exploited to abuse the Web Explorer server as a proxy for web attacks on third parties and interact with servers in the local network, including reading their response data. This could potentially lead to arbitrary code execution, depending on the nature of the local services. The vulnerability is limited to GET requests, as POST requests are not possible, but the impact on confidentiality, integrity, and availability is significant due to the potential for stolen credentials and state-changing interactions with internal APIs.
The patched code:
- Requires users to opt-in
- Suggests using a proxy to prevent requests to local addresses
From the GitHub Advisory Database (GHSA-q25c-c977-4cmh, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could perform port scans, access local services, read cloud instance metadata, and use the server as a proxy for attacks on third parties, potentially leading to arbitrary code execution depending on the local services; only GET requests are possible.
What the attacker needed
Use of WebResearchRetriever; attacker can influence the URL fetched
The fix
The patched code requires users to opt in and suggests using a proxy to prevent requests to local addresses.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a server-side request forgery (SSRF) bug. A part of the library that fetches web pages for research could be tricked into making requests to internal addresses, like services on the same machine or network, instead of only public websites. That lets an attacker probe or interact with things that should not be reachable from outside.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.