CVE-2023-32786: Langchain Server-Side Request Forgery vulnerability
In LangChain before 0.0.329, prompt injection can make APIChain fetch data from any URL, giving server-side request forgery and a way to inject content into later steps. The fix adds a `limit_to_domains` allowlist to APIChain and makes the chain require it. Upgrade to 0.0.329.
Published Oct 21, 2023 · Updated Nov 11, 2023 · Analysis Nov 2, 2026
What an attacker can do
APIChain in libs/langchain/langchain/chains/api/base.py lets an LLM build an HTTP request from API documentation and a user's question, and then calls it. Before the fix there was no limit on which hosts the chain could reach. An attacker who can influence the prompt, directly or through content the model reads, can point the chain at a URL of their choice (CWE-918).
The server then makes the request from its own network position. That can reach internal services, admin interfaces and cloud metadata endpoints that the attacker cannot reach from outside. The response comes back into the chain, so the attacker can read it, which fits the high confidentiality impact in the CVSS vector. The advisory also says the retrieved data can inject content into downstream tasks, meaning the attacker's page can carry further instructions for the model.
The attacker needs only a way to send text to an app using the chain: no account, no user interaction.
Who is affected
The pip package langchain below 0.0.329, for applications that use APIChain, for example chat apps that let the model call external APIs. Check your version:
pip show langchainlangchain
- Ecosystem
- PyPI
- Affected
- < 0.0.329
- Fixed in
- 0.0.329
- Check
pip show langchain
How to fix it
Upgrade to langchain 0.0.329 or later.
pip install -U "langchain>=0.0.329"The fix, PR 12747, adds a limit_to_domains field to APIChain. It is a list of domains the chain may call. The author calls it a breaking change: creating the chain without the setting fails with an error instead of running unrestricted. Set the list to only the API hosts you intend to use. The sources list no other workaround.
How to tell if you were hit
Review the chain's outbound request logs for hosts you did not intend, especially internal IP ranges, localhost and the cloud metadata address. Check application logs for prompts that contain URLs or ask the model to fetch a page. Egress firewall logs from the application host can show the same requests.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
In Langchain before 0.0.329, prompt injection allows an attacker to force the service to retrieve data from an arbitrary URL, essentially providing SSRF and potentially injecting content into downstream tasks.
Credited to eyurtsev.
Questions
- Which LangChain version fixes CVE-2023-32786?
0.0.329. Earlier versions let APIChain call any URL.
- Will upgrading break my code?
It can. The chain now needs the
limit_to_domainssetting and fails with an error if it is missing. Set it to the hosts you want the chain to call.- Can the attacker see the response of the forged request?
The advisory says data from the URL is retrieved by the service and can reach downstream tasks, so responses can come back through the chain.
- Is it exploited in the wild?
No source I read says so, and the entry has no CISA KEV data.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More LangChain vulnerabilities
All LangChain entriesCVE-2026-55443
LangChain: Path traversal and sandbox escape in LangChain file-search middleware and loaders
medium5.1Jun 16, 2026CVE-2026-45134
LangSmith SDK: Public prompt pull deserializes untrusted manifests without trust boundary warning
high7.1May 13, 2026CVE-2026-44843
LangChain vulnerable to unsafe deserialization of attacker-controlled objects through overly broad `load()` allowlists
high8.2May 8, 2026CVE-2026-40087
LangChain has incomplete f-string validation in prompt templates
medium5.3Apr 8, 2026CVE-2026-34070
LangChain Core has Path Traversal vulnerabilites in legacy `load_prompt` functions
high7.5Mar 27, 2026CVE-2026-27795
LangChain Community: redirect chaining can lead to SSRF bypass via RecursiveUrlLoader
medium4.1Feb 25, 2026
