CVE-2026-27795
MEDIUMIf your LangChain JS applications use RecursiveUrlLoader—common in RAG pipelines and web-scraping agents—upgrade @langchain/community to 1.1.18 immediately. This is a bypass of the prior SSRF patch (CVE-2026-26019), meaning the attack surface was not fully closed; expect the fix history to raise auditor flags. In cloud environments without IMDSv2 enforcement, successful exploitation leads directly to IAM credential exposure.
Severity & Risk
Recommended Action
- 1) Patch: Upgrade @langchain/community to >=1.1.18 immediately—this is the only complete fix. 2) Cloud hardening (independent control): Enforce IMDSv2 (token-required mode) on all EC2/cloud instances running LangChain; this blocks the metadata endpoint vector even on unpatched versions. 3) Network egress filtering: Restrict outbound HTTP from LangChain processes to known-safe IP ranges; block RFC1918 and link-local (169.254.0.0/16) ranges at the network layer. 4) Audit: Grep codebase for 'RecursiveUrlLoader' usage and trace all URL input paths to identify user-controllable trust boundaries. 5) Detection: Alert on outbound requests to 169.254.169.254, 100.100.100.200 (Alibaba Cloud), or internal RFC1918 targets originating from LangChain container/process network namespaces. 6) Verify no prior exploitation: Review cloud access logs for unusual IAM credential usage or metadata service calls from LangChain hosts.
Classification
Compliance Impact
This CVE is relevant to:
Technical Details
NVD Description
LangChain is a framework for building LLM-powered applications. Prior to version 1.1.8, a redirect-based Server-Side Request Forgery (SSRF) bypass exists in `RecursiveUrlLoader` in `@langchain/community`. The loader validates the initial URL but allows the underlying fetch to follow redirects automatically, which permits a transition from a safe public URL to an internal or metadata endpoint without revalidation. This is a bypass of the SSRF protections introduced in 1.1.14 (CVE-2026-26019). Users should upgrade to `@langchain/community` 1.1.18, which validates every redirect hop by disabling automatic redirects and re-validating `Location` targets before following them. In this version, automatic redirects are disabled (`redirect: "manual"`), each 3xx `Location` is resolved and validated with `validateSafeUrl()` before the next request, and a maximum redirect limit prevents infinite loops.
Exploitation Scenario
An attacker with authenticated access to a LangChain-based research agent or RAG pipeline submits a request containing a URL pointing to their controlled server (which passes RecursiveUrlLoader's initial URL validation). The attacker's server responds with an HTTP 301 redirect to http://169.254.169.254/latest/meta-data/iam/security-credentials/. On versions 1.1.14–1.1.17, the loader follows the redirect without revalidating the Location header. The metadata endpoint returns IAM role credentials as plain text, which the loader ingests as a document. Depending on application design, these credentials may be passed to the LLM as context, stored in the RAG vector database, or surfaced in API responses. The attacker retrieves the credentials and uses them to access AWS resources—S3 buckets, Secrets Manager, or RDS—outside the application's intended scope.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:N/A:N References
- github.com/langchain-ai/langchainjs/commit/2812d2b2b9fd9343c4850e2ab906b8cf440975ee
- github.com/langchain-ai/langchainjs/commit/2812d2b2b9fd9343c4850e2ab906b8cf440975ee
- github.com/langchain-ai/langchainjs/commit/2812d2b2b9fd9343c4850e2ab906b8cf440975ee
- github.com/langchain-ai/langchainjs/commit/2812d2b2b9fd9343c4850e2ab906b8cf440975ee
- github.com/langchain-ai/langchainjs/commit/d5e3db0d01ab321ec70a875805b2f74aefdadf9d
- github.com/langchain-ai/langchainjs/commit/d5e3db0d01ab321ec70a875805b2f74aefdadf9d
- github.com/langchain-ai/langchainjs/commit/d5e3db0d01ab321ec70a875805b2f74aefdadf9d
- github.com/langchain-ai/langchainjs/commit/d5e3db0d01ab321ec70a875805b2f74aefdadf9d
- github.com/langchain-ai/langchainjs/pull/9990
- github.com/langchain-ai/langchainjs/pull/9990
- github.com/langchain-ai/langchainjs/pull/9990
- github.com/langchain-ai/langchainjs/pull/9990
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.14
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.14
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.14
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.14
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.18
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.18
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.18
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcommunity%401.1.18
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-gf3v-fwqg-4vh7
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-gf3v-fwqg-4vh7
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-gf3v-fwqg-4vh7
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-gf3v-fwqg-4vh7
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-mphv-75cg-56wg
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-mphv-75cg-56wg
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-mphv-75cg-56wg
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-mphv-75cg-56wg