PT-2026-35311 · Pypi · Langchain-Text-Splitters
Published
2026-04-16
·
Updated
2026-04-16
CVSS v3.1
6.5
Medium
| Vector | AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N |
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.2
Patched versions
langchain-text-splitters>= 1.1.2 (requireslangchain-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:
python
validate safe url(url, allow private=False, allow http=True)
response = requests.get(url, timeout=timeout, **kwargs)Attack scenario
- A developer passes external URLs to
split text from url(), relying on its built-invalidate safe url()check to block requests to internal networks. - An attacker supplies a URL pointing to a public host they control. The URL
passes
validate safe url()(public hostname, public IP). - The attacker's server responds with a
302redirect 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.- The response body is parsed and returned as
Documentobjects to the application.
Notes:
- The core issue is a bypass of an explicitly provided SSRF protection.
split text from url()includedvalidate safe url()specifically to be safe with untrusted URLs — the redirect loophole defeated that guarantee. - Cloud metadata endpoints that require special headers (AWS IMDSv2, GCP, Azure) are not reachable through this bug because the attacker does not control request headers. AWS IMDSv1, which requires no headers, is reachable.
- Data exfiltration requires the application to return Document contents to the party that supplied the URL. The SSRF itself — forcing the server to issue a request to an internal endpoint — does not require this.
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.Fix
SSRF
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Langchain-Text-Splitters