Skip to content

LangChain Text Splitters: HTMLHeaderTextSplitter.split_text_from_url SSRF Redirect Bypass

Moderate severity GitHub Reviewed Published Apr 16, 2026 in langchain-ai/langchain • Updated Apr 16, 2026

Package

pip langchain-text-splitters (pip)

Affected versions

< 1.1.2

Patched versions

1.1.2

Description

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 (requires langchain-core >= 1.2.31)

Affected code

File: libs/text-splitters/langchain_text_splitters/html.pysplit_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

  1. A developer passes external URLs to split_text_from_url(), relying on its
    built-in validate_safe_url() check to block requests to internal networks.
  2. An attacker supplies a URL pointing to a public host they control. The URL
    passes validate_safe_url() (public hostname, public IP).
  3. The attacker's server responds with a 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).
  4. requests.get() follows the redirect automatically. The redirect target is
    not revalidated.
  5. The response body is parsed and returned as Document objects to the
    application.

Notes:

  • The core issue is a bypass of an explicitly provided SSRF protection.
    split_text_from_url() included validate_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.

References

@ccurme ccurme published to langchain-ai/langchain Apr 16, 2026
Published to the GitHub Advisory Database Apr 16, 2026
Reviewed Apr 16, 2026
Last updated Apr 16, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

EPSS score

Weaknesses

Server-Side Request Forgery (SSRF)

The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. Learn more on MITRE.

CVE ID

No known CVE

GHSA ID

GHSA-fv5p-p927-qmxr

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.