# 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.

- **Severity:** Low 3.7 (`CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N`)
- **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:** Yes
- **Published:** 24 Feb 2024
- **Updated:** 22 Apr 2025
- **Also known as:** GHSA-h9j7-5xvc-qhg5, PYSEC-2024-235, PYSEC-2026-1509

## 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 (Server-Side Request Forgery)

## 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 | Ecosystem | 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: Langchain Langchain.

## How do I fix CVE-2024-0243?

Upgrade langchain to 0.1.0 or later.

## 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](https://insights.sbomify.com/CVE-2023-39631/): Langchain vulnerable to arbitrary code execution via the evaluate function in the numexpr library (critical 9.8)
- [CVE-2023-36281](https://insights.sbomify.com/CVE-2023-36281/): langchain vulnerable to arbitrary code execution (critical 9.8)
- [CVE-2023-38860](https://insights.sbomify.com/CVE-2023-38860/): LangChain vulnerable to arbitrary code execution (critical 9.8)
- [CVE-2023-38896](https://insights.sbomify.com/CVE-2023-38896/): LangChain vulnerable to arbitrary code execution (critical 9.8)
- [CVE-2023-39659](https://insights.sbomify.com/CVE-2023-39659/): LangChain vulnerable to arbitrary code execution (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-0243 and fix it if it is affected.

What it is: 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.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-0243 exists.

Affected packages and fixed versions:
- langchain (PyPI): affected all versions; fixed in 0.1.0
- langchain (PyPI): affected all versions; fixed in 0.1.0
- langchain (PyPI): affected all versions; fixed in 0.1.0
- langchain-exa (PyPI): affected all versions; fixed in 0.1.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-0243/ (Markdown: https://insights.sbomify.com/CVE-2024-0243/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-0243
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-0243
- OSV: https://osv.dev/vulnerability/CVE-2024-0243

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-0243/
Summaries are generated and may contain mistakes; the official description above is the record.
