AgentbeamBeta
AI agent vulnerability · LangChain

CVE-2026-27795: LangChain Community: redirect chaining can lead to SSRF bypass via RecursiveUrlLoader

mediumCVSS 3.1 4.1GHSA-mphv-75cg-56wg

LangChain's @langchain/community 1.1.17 and earlier has a redirect-based SSRF bypass in RecursiveUrlLoader. The loader checks the first URL but follows redirects without checking them, so a public page can send the crawler to localhost, a private network host or a cloud metadata endpoint. Upgrade @langchain/community to 1.1.18.

Published Feb 25, 2026 · Analysis Nov 24, 2026

What an attacker can do

RecursiveUrlLoader crawls a site by following links from a start URL. After the earlier fix for CVE-2026-26019, it ran validateSafeUrl() on the initial URL only. The underlying fetch follows redirects by default, so the final destination is never checked. That is a check-then-act gap (CWE-918).

The attacker needs to influence a page the crawler visits: user-generated content, or an untrusted external site. They point the crawler at a public URL that passes validation, and that URL answers with a 3xx redirect to an internal address. The crawler follows it and fetches the internal response. The advisory lists cloud metadata endpoints on AWS, GCP and Azure, private ranges such as 10.x, 172.16.x and 192.168.x, and localhost services as targets.

What the attacker gets depends on what the host can reach. Metadata services can hand out cloud credentials. Internal services can leak data, and the response text becomes loaded document content, which can flow into a RAG index or an agent's context. The score is medium because the attacker needs a crawl to reach their page and the reply must flow back to them.

Who is affected

Affected: the npm package @langchain/community, version 1.1.17 and earlier. Version 1.1.18 is patched. Only code that uses RecursiveUrlLoader is exposed, and the default preventOutside setting of true does not stop this bypass.

Check your version:

npm ls @langchain/community

Search your code for RecursiveUrlLoader to see where crawls start and whether the start URL or crawled pages can be controlled by others.

@langchain/community

Ecosystem
npm
Affected
<= 1.1.17
Fixed in
1.1.18
Check
npm ls @langchain/community

How to fix it

Upgrade @langchain/community to 1.1.18 or later:

npm install @langchain/[email protected]

The fix turns off automatic redirects, resolves and validates every Location header with validateSafeUrl() before the next request, and sets a maximum redirect count. The advisory lists no workaround. Until you upgrade, limit the loader to trusted start URLs and block the metadata address and private ranges at the network level.

How to tell if you were hit

Check outbound request logs from the crawler host for connections to 169.254.169.254, private ranges or localhost that follow a request to a public site. Look for 3xx responses in crawl logs whose Location points to internal addresses. On cloud hosts, review metadata access logs and credential use from unexpected places after a crawl.

If a crawl fetched metadata, rotate the credentials of the role attached to that host.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

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).

Affected Component

  • Package: @langchain/community
  • Component: RecursiveUrlLoader
  • Configuration: preventOutside (default: true) is insufficient to prevent this bypass when redirects are followed automatically.

Description

RecursiveUrlLoader is a web crawler that recursively follows links from a starting URL. The existing SSRF mitigation validates the initial URL before fetching, but it does not re-validate when the request follows redirects. Because fetch follows redirects by default, an attacker can supply a public URL that passes validation and then redirects to a private network address, localhost, or cloud metadata endpoint.

This constitutes a “check‑then‑act” gap in the request lifecycle: the safety check occurs before the redirect chain is resolved, and the final destination is never validated.

Impact

If an attacker can influence content on a page being crawled (e.g., user‑generated content, untrusted external pages), they can cause the crawler to:

  • Fetch cloud instance metadata (AWS, GCP, Azure), potentially exposing credentials or tokens
  • Access internal services on private networks (10.x, 172.16.x, 192.168.x)
  • Connect to localhost services
  • Exfiltrate response data through attacker-controlled redirect chains

This is exploitable in any environment where RecursiveUrlLoader runs with access to internal networks or metadata services, which includes most cloud-hosted deployments.

Attack Scenario

  1. The crawler is pointed at a public URL that passes initial SSRF validation.
  2. That URL responds with a 3xx redirect to an internal target.
  3. The fetch follows the redirect automatically without revalidation.
  4. The crawler accesses the internal or metadata endpoint.

Example redirector:

https://302.r3dir.me/--to/?url=http://169.254.169.254/latest/meta-data/

Root Cause

  • SSRF validation (validateSafeUrl) is only performed on the initial URL.
  • Redirects are followed automatically by fetch (redirect: "follow" default), so the request can change destinations without additional validation.

Resolution

Upgrade to @langchain/community >= 1.1.18, which validates every redirect hop by disabling automatic redirects and re-validating Location targets before following them.

  • Automatic redirects are disabled (redirect: "manual").
  • Each 3xx Location is resolved and validated with validateSafeUrl() before the next request.
  • A maximum redirect limit prevents infinite loops.

Reources

  • Original SSRF fix (CVE-2026-26019): enforced origin comparison and added initial URL validation
  • https://github.com/langchain-ai/langchainjs/security/advisories/GHSA-gf3v-fwqg-4vh7

Credited to r3dbrothers, hntrl.

Questions

Is @langchain/community 1.1.14 enough to stop the SSRF?

No. Version 1.1.14 fixed CVE-2026-26019 by validating the initial URL. This advisory is a bypass of that fix through redirects, and it needs 1.1.18 or later.

Does the preventOutside setting protect against this?

No. The advisory says preventOutside, which defaults to true, is not enough to stop the redirect bypass.

What can an attacker reach?

Anything the crawler host can reach: cloud metadata endpoints, private network services and localhost. The attacker must control or influence a page the loader crawls.

Is CVE-2026-27795 exploited in the wild?

The sources do not say so. The entry has no CISA catalog data, and the EPSS score is about 0.25 percent.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LangChain vulnerabilities

All LangChain entries