CVE-2026-27795: The Chain Breaker: Bypassing LangChain's SSRF Guards
Source: Dev.to
Vulnerability Overview
Vulnerability ID: CVE-2026-27795
CVSS Score: 4.1 (Medium)
Published: 2026-02-25
A sophisticated Server-Side Request Forgery (SSRF) bypass was discovered in the @langchain/community package, specifically within the RecursiveUrlLoader. The component performed a safety check on the URL before fetching it, but allowed the underlying fetch client to automatically follow redirects. An attacker could supply a benign, validated URL that redirected to sensitive internal resources (e.g., AWS metadata service at 169.254.169.254), bypassing the initial security checks. This is a classic “Check‑Then‑Act” race condition.
TL;DR
LangChain’s URL loader validated a URL before fetching it, but the fetch client automatically followed redirects to unsafe destinations. An attacker could use a “safe” URL that redirects to 169.254.169.254 to steal cloud credentials.
⚠️ Exploit Status: Proof‑of‑Concept (PoC)
Technical Details
- CWE ID: CWE-918 (Server‑Side Request Forgery)
- Attack Vector: Network
- Impact: Information Disclosure
- Exploit Status: PoC Available
- Patch Status: Released (v1.1.18)
Affected Systems
@langchain/community< 1.1.18 (fixed in1.1.18)
Code Analysis
Commit: 2812d2b – Fix handles redirects manually to prevent SSRF bypass.
fetch(currentUrl, { redirect: "manual" })
Exploit Details
The unit tests added in the fix commit serve as a functional PoC for the redirect bypass. See the commit for the PoC implementation.
Mitigation Strategies
- Upgrade
@langchain/communityto version 1.1.18 or later. - Network‑level egress filtering to block access to metadata services (e.g.,
169.254.169.254). - Isolation: Run LLM workers in isolated containers or VPCs.
Remediation Steps
- Identify projects using
@langchain/community< 1.1.18. - Run
npm install @langchain/community@latestoryarn upgrade @langchain/community. - Verify the installed version (
node_modules/@langchain/community/package.json) is 1.1.18 or newer. - Review firewall rules to ensure
169.254.169.254is blocked for application containers.