CVE-2024-0243 Server-side Request Forgery In Recursive URL Loader
Attackers can bypass URL restrictions in LangChain's RecursiveUrlLoader to fetch arbitrary external resources, potentially exposing internal data.
- Exploited in the wild
- Not known
- Login needed
- An administrator
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2024-0243?
CVE-2024-0243 is a low-severity server-side request forgery vulnerability in langchain-ai/langchain, published on 24 Feb 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official description
With the following crawler configuration:
```python from bs4 import BeautifulSoup as Soup
url = "https://example.com" loader = RecursiveUrlLoader( url=url, max_depth=2, extractor=lambda x: Soup(x, "html.parser").text ) docs = loader.load() ```
An attacker in control of the contents of `https://example.com` could place a malicious HTML file in there with links like "https://example.completely.different/my_file.html" and the crawler would proceed to download that file as well even though `prevent_outside=True`.
https://github.com/langchain-ai/langchain/blob/bf0b3cc0b5ade1fb95a5b1b6fa260e99064c2e22/libs/community/langchain_community/document_loaders/recursive_url_loader.py#L51-L51
Resolved in https://github.com/langchain-ai/langchain/pull/15559
Weakness: CWE-918
Which versions are affected by CVE-2024-0243?
4 open source packages ship an affected version, including langchain and langchain-exa. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
langchain PyPI | All versions | 0.1.0 |
langchain PyPI | All versions | 0.1.0 |
langchain PyPI | All versions | 0.1.0 |
langchain-exa PyPI | All versions | 0.1.0 |
Products include Langchain Langchain.
How do I fix CVE-2024-0243?
Upgrade langchain to 0.1.0 or later.
Upgrade, and send outbound requests through an allow-list that blocks internal addresses. More about Server-side request forgery.
Is CVE-2024-0243 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-0243 exists.
Other vulnerabilities in langchain-ai/langchain
- CVE-2023-39631 Langchain vulnerable to arbitrary code execution via the evaluate function in the numexpr library
- CVE-2023-36281 langchain vulnerable to arbitrary code execution
- CVE-2023-38860 LangChain vulnerable to arbitrary code execution
- CVE-2023-38896 LangChain vulnerable to arbitrary code execution
- CVE-2023-39659 LangChain vulnerable to arbitrary code execution
Sources
Also known as GHSA-h9j7-5xvc-qhg5, PYSEC-2024-235, PYSEC-2026-1509.