CVE-2023-46229: LangChain: SSRF in URL loader exposes internal network
HIGH ACTIVELY EXPLOITED PoC AVAILABLELangChain's RecursiveURLLoader follows redirects from external to internal addresses, enabling attackers to reach cloud metadata services (AWS IMDS at 169.254.169.254), internal APIs, and credential stores. Any RAG pipeline or agent deployment that processes user-supplied or untrusted URLs via document loaders is exposed. Upgrade to LangChain 0.0.317+ immediately and enforce network-level blocks on RFC 1918 and link-local ranges for LangChain hosts.
What is the risk?
High risk (CVSS 8.8). Attack complexity is low and no privileges are required — an attacker only needs to supply a URL that triggers a redirect to an internal target. The 'UI:Required' reflects that a user or automated pipeline must invoke the loader, which in practice is the default operating mode for RAG ingestion jobs and AI agents. The primary escalation path is cloud credential theft via metadata services, which can result in full cloud account takeover. LangChain's ubiquity across AI/ML deployments significantly amplifies blast radius.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| LangChain | pip | — | No patch |
Do you use LangChain? You're affected.
How severe is it?
What is the attack surface?
What should I do?
5 steps-
PATCH
Upgrade LangChain to >= 0.0.317 immediately (commit 9ecb724 addresses this).
-
NETWORK CONTROL
Block outbound HTTP/S from LangChain processes to RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and link-local (169.254.0.0/16) ranges at the firewall or security group level.
-
INPUT VALIDATION
If patching is delayed, implement a domain allowlist for all inputs to RecursiveURLLoader — reject any URL not on the allowlist before instantiating the loader.
-
CLOUD HARDENING
Enable IMDSv2 (AWS), disable legacy IMDS, and apply equivalent protections on GCP/Azure to limit credential exposure via SSRF.
-
DETECTION
Alert on HTTP requests from LangChain processes to private IP ranges, metadata service IPs, or internal hostnames; review application logs for unexpected content in loader outputs.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2023-46229?
LangChain's RecursiveURLLoader follows redirects from external to internal addresses, enabling attackers to reach cloud metadata services (AWS IMDS at 169.254.169.254), internal APIs, and credential stores. Any RAG pipeline or agent deployment that processes user-supplied or untrusted URLs via document loaders is exposed. Upgrade to LangChain 0.0.317+ immediately and enforce network-level blocks on RFC 1918 and link-local ranges for LangChain hosts.
Is CVE-2023-46229 actively exploited?
Yes, CVE-2023-46229 is confirmed actively exploited and listed in CISA Known Exploited Vulnerabilities catalog.
How to fix CVE-2023-46229?
1. PATCH: Upgrade LangChain to >= 0.0.317 immediately (commit 9ecb724 addresses this). 2. NETWORK CONTROL: Block outbound HTTP/S from LangChain processes to RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and link-local (169.254.0.0/16) ranges at the firewall or security group level. 3. INPUT VALIDATION: If patching is delayed, implement a domain allowlist for all inputs to RecursiveURLLoader — reject any URL not on the allowlist before instantiating the loader. 4. CLOUD HARDENING: Enable IMDSv2 (AWS), disable legacy IMDS, and apply equivalent protections on GCP/Azure to limit credential exposure via SSRF. 5. DETECTION: Alert on HTTP requests from LangChain processes to private IP ranges, metadata service IPs, or internal hostnames; review application logs for unexpected content in loader outputs.
What systems are affected by CVE-2023-46229?
This vulnerability affects the following AI/ML architecture patterns: RAG pipelines, agent frameworks, document processing pipelines, LLM application frameworks, knowledge base ingestion pipelines.
What is the CVSS score for CVE-2023-46229?
CVE-2023-46229 has a CVSS v3.1 base score of 8.8 (HIGH). The EPSS exploitation probability is 44.71%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0025 Exfiltration via Cyber Means AML.T0037 Data from Local System AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
LangChain before 0.0.317 allows SSRF via document_loaders/recursive_url_loader.py because crawling can proceed from an external server to an internal server.
Exploitation Scenario
An attacker controls an external web server at attacker-site.com. They submit this URL as a document source to a LangChain-based RAG pipeline that indexes web content for a corporate AI assistant. When RecursiveURLLoader crawls attacker-site.com, the server responds with HTTP 301 redirecting to http://169.254.169.254/latest/meta-data/iam/security-credentials/MyRole. LangChain follows the redirect and fetches the AWS IAM temporary credentials. The attacker extracts these from the indexed content, application logs, or error messages, then uses them to access the organization's S3 buckets containing training data, model weights, and proprietary documents — or to pivot into the broader AWS environment.
Weaknesses (CWE)
CWE-918 — 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.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H References
Timeline
Related Vulnerabilities
CVE-2025-2828 10.0 LangChain RequestsToolkit: SSRF exposes cloud metadata
Same package: langchain CVE-2023-34540 9.8 LangChain: RCE via JiraAPIWrapper crafted input
Same package: langchain CVE-2023-29374 9.8 LangChain: RCE via prompt injection in LLMMathChain
Same package: langchain CVE-2023-34541 9.8 LangChain: RCE via unsafe load_prompt deserialization
Same package: langchain CVE-2023-36258 9.8 LangChain: unauthenticated RCE via code injection
Same package: langchain