NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · LangChain

CVE-2023-46229: LangChain Server Side Request Forgery vulnerability

highCVSS 4.0 8.6 · 3.1 8.8GHSA-655w-fm8m-m478

LangChain before 0.0.317 has an SSRF flaw in its web crawling document loaders. A crawl that starts at an external server can follow links to an internal server, so an attacker who controls a crawled page can make the application fetch internal URLs. Upgrade the langchain package to 0.0.317.

Published Oct 19, 2023 · Updated Sep 30, 2024 · Analysis Nov 2, 2026

What an attacker can do

The advisory ties the flaw to document_loaders/recursive_url_loader.py: crawling can proceed from an external server to an internal one. The loader follows links found on pages. An attacker who controls or influences a page that your application crawls can place links to internal addresses, such as localhost services, private network hosts or a cloud metadata endpoint. The application then fetches them from inside your network and may load the response into documents or a vector store.

The CVSS 3.1 vector (AV:N, PR:N, UI:R) shows a network attacker with no privileges who needs some user action, such as someone pointing the app at a URL. It rates confidentiality, integrity and availability impact as high. In practice the risk depends on what the application does with crawled text: if the content reaches users or an LLM prompt, internal data can leak.

The linked fix, pull request 11925, edits the sitemap loader, sitemap.py. It makes that loader fetch only URLs under the same scheme and domain as the sitemap by default, adding a restrict_to_same_domain option. The page does not mention recursive_url_loader.py, so verify behavior of the loader you use.

Who is affected

The pip package langchain in every version before 0.0.317. Applications that use the recursive URL loader, or the sitemap loader, to crawl sites they do not control are the exposed ones. Check:

pip show langchain

Search your code for RecursiveUrlLoader and SitemapLoader.

langchain

Ecosystem
PyPI
Affected
>= 0, < 0.0.317
Fixed in
0.0.317
Check
pip show langchain

How to fix it

Upgrade langchain to 0.0.317 or later:

pip install --upgrade "langchain>=0.0.317"

The sources give no other workaround. After upgrading, keep crawl targets to sites you trust, and block the application's access to internal ranges and 169.254.169.254 at the network layer. Those two steps are general hardening and not advice from the advisory.

How to tell if you were hit

Look at egress and proxy logs from hosts that run LangChain crawlers for requests to private ranges, localhost or 169.254.169.254 that follow a crawl of an external page. Internal services may log requests from the application host with unfamiliar paths. Review the documents your loaders produced for text that looks like internal pages or metadata responses.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

LangChain before 0.0.317 allows SSRF via document_loaders/recursive_url_loader.py because crawling can proceed from an external server to an internal server.

Questions

Which loader is affected?

The advisory names document_loaders/recursive_url_loader.py. The linked pull request changes the sitemap loader as well, so check both if you crawl.

Does it need user interaction?

The CVSS vector sets user interaction to required, for example a user or workflow supplying the attacker's URL. No privileges are required.

Which version fixes CVE-2023-46229?

langchain 0.0.317 is the patched version in the advisory data. Upgrade with pip and re-check your crawler code.

Is it exploited in the wild?

The sources do not say so. The entry has no CISA catalog data, though its EPSS score is high at about 0.48.

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 entries