The Chain Breaker: Bypassing LangChain's SSRF Guards
Vulnerability ID: CVE-2026-27795
CVSS Score: 4.1
Published: 2026-02-25
A sophisticated Server-Side Request Forgery (SSRF) bypass was discovered in the @langchain/community package, specifically within the RecursiveUrlLoader. Despite previous attempts to secure this component against internal network scanning, the implementation failed to handle HTTP redirects manually. This allowed attackers to supply a benign, validated URL that subsequently redirected the server's HTTP client to sensitive internal resources (like AWS Metadata services or local admin panels), completely bypassing the initial security checks. This vulnerability highlights the classic 'Check-Then-Act' race condition in web security.
TL;DR
LangChain's URL loader checked if a URL was safe before fetching it, but let the fetch client automatically follow redirects to unsafe places. Attackers could use a 'safe' URL that redirects to 169.254.169.254 to steal cloud credentials.
⚠️ Exploit Status: POC
Technical Details
- CWE ID: CWE-918
- Attack Vector: Network
- CVSS: 4.1 (Medium)
- Impact: Information Disclosure
- Exploit Status: PoC Available
- Patch Status: Released (v1.1.18)
Affected Systems
- @langchain/community
-
@langchain/community: < 1.1.18 (Fixed in:
1.1.18)
Code Analysis
Commit: 2812d2b
Fix: handle redirects manually to prevent SSRF bypass
fetch(currentUrl, { redirect: "manual" })
Exploit Details
- GitHub: Unit tests in the fix commit serve as a functional PoC for the redirect bypass.
Mitigation Strategies
- Upgrade
@langchain/communityto patched versions. - Network-level egress filtering to block metadata services.
- Run LLM workers in isolated containers/VPCs.
Remediation Steps:
- Identify projects using
@langchain/community< 1.1.18. - Run
npm install @langchain/community@latestoryarn upgrade @langchain/community. - Verify that
node_modules/@langchain/community/package.jsonshows version 1.1.18+. - Review firewall rules to ensure
169.254.169.254is blocked for application containers.
References
Read the full report for CVE-2026-27795 on our website for more details including interactive diagrams and full exploit analysis.
Top comments (0)