langchain-text-splitters
Affected
- introduced
0, fixed1.1.2(ecosystem)
Fixed versions
1.1.2
Fix
- Fixed version
1.1.2pip install --upgrade langchain-text-splitters==1.1.2
Advisory
Also known as: CVE-2026-41481, PYSEC-2026-77
LangChain Text Splitters: HTMLHeaderTextSplitter.split_text_from_url SSRF Redirect Bypass
Summary
HTMLHeaderTextSplitter.split_text_from_url() validated the initial URL using validate_safe_url() but then performed the fetch with requests.get() with redirects enabled (the default). Because redirect targets were not revalidated, a URL pointing to an attacker-controlled server could redirect to internal, localhost, or cloud metadata endpoints, bypassing SSRF protections.
The response body is parsed and returned as Document objects to the calling application code. Whether this constitutes a data exfiltration path depends on the application: if it exposes Document contents (or derivatives) back to the requester who supplied the URL, sensitive data from internal endpoints could be leaked. Applications that store or process Documents internally without returning raw content to the requester are not directly exposed to data exfiltration through this issue.
Affected versions
langchain-text-splitters < 1.1.2Patched versions
langchain-text-splitters >= 1.1.2 (requires langchain-core >= 1.2.31)Affected code
File: libs/text-splitters/langchain_text_splitters/html.py — split_text_from_url()
The vulnerable pattern validated the URL once then fetched with redirects enabled:
validate_safe_url(url, allow_private=False, allow_http=True)
response = requests.get(url, timeout=timeout, **kwargs)
Attack scenario
split_text_from_url(), relying on its built-in validate_safe_url() check to block requests to internal networks.validate_safe_url() (public hostname, public IP).302 redirect to an internal endpoint (e.g., an unauthenticated internal admin API, or a cloud instance metadata service that does not require request headers — such as AWS IMDSv1).requests.get() follows the redirect automatically. The redirect target is not revalidated.Document objects to the application.Notes:
split_text_from_url() included validate_safe_url() specifically to be safe with untrusted URLs — the redirect loophole defeated that guarantee.Fix
The fix replaces requests.get() with an SSRF-safe httpx transport (SSRFSafeSyncTransport from langchain-core) that validates DNS results and pins connections to validated IPs on every request, including redirect targets, eliminating redirect-based bypasses.
Additionally, split_text_from_url() has been deprecated. Users should fetch HTML content themselves and pass it to split_text() directly.
Medium Basis: The source's own band: MODERATE
0, fixed 1.1.2 (ecosystem)1.1.2
1.1.2pip install --upgrade langchain-text-splitters==1.1.2Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0