/

CVE-2026-31945

Severity:

HIGH RISK

(7.7)

SSRF in LibreChat Agent Actions and MCP

CVE-2026-31945

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized Access to Internal Network Resources

Severity:

HIGH RISK

(7.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

LibreChat versions 0.8.2-rc2 through 0.8.2 contain a server-side request forgery (SSRF) flaw in the handling of agent actions and Model Context Protocol (MCP) requests, allowing user-controlled URLs to be fetched by the server.

Because only hostname validation is performed and DNS results are not checked for private IPs, an attacker can coerce the server into accessing internal resources like internal RAG APIs or cloud instance metadata endpoints.

Affected context

This vulnerability arises in LibreChat deployments where:

  • Agent actions or MCP integrations allow users (or downstream tools) to specify or influence target URLs
  • The backend performs outbound HTTP(S) requests based on those inputs
  • Network connectivity from the LibreChat server to internal services, RAG backends, or cloud provider metadata endpoints is available

The issue is specifically tied to the URL validation logic, which checks hostnames but does not ensure that resolved IP addresses are non-private or non-link-local.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints exposed by LibreChat that trigger agent actions or MCP calls involving outbound requests.
  • Required access: Ability to supply or control a URL or endpoint parameter used by these features (typically through authenticated interaction with LibreChat or exposed API routes).
  • Trigger point: The server-side logic that resolves the hostname and issues a network request without verifying that the resulting IP is external and allowed.
  • Why exploitation is possible: The existing protection only validates hostnames syntactically or against basic rules; it does not account for DNS rebinding or hostnames that resolve to internal or loopback IP ranges, enabling requests into internal networks and metadata services.

Why this happens

The root cause is incomplete server-side validation of outbound request targets, mapping directly to CWE-918: Server-Side Request Forgery (SSRF).

The application attempts to restrict SSRF by validating hostnames but fails to:

  • Confirm that DNS resolution does not yield private, loopback, link-local, or otherwise sensitive address ranges
  • Enforce a robust allowlist of external destinations or IP ranges

This design trusts DNS resolution results and user-influenced URLs, allowing attackers to pivot the server's network position to reach internal services not directly exposed to the attacker.

Potential impact

  • Unauthorized access to internal RAG (Retrieval-Augmented Generation) APIs or vector databases
  • Exposure of sensitive configuration or secrets from cloud instance metadata endpoints
  • Discovery and probing of internal network services (port scanning via SSRF patterns)
  • Potential credential theft or token retrieval from metadata or internal identity services
  • Use of internal services as a stepping stone for further compromise or data exfiltration

General mitigation guidance

Mitigation generally focuses on hardening outbound request handling and shrinking trust in user-supplied URLs:

  • Enforce strict allowlists for outbound destinations (hostnames or IP ranges) used by agent actions and MCP, rather than allowing arbitrary URLs.
  • Validate resolved IP addresses against forbidden ranges (e.g., RFC1918, loopback, link-local, link-local multicast, and cloud metadata address ranges) and block requests that target them.
  • Use network-level egress controls such as firewall rules, security groups, or service meshes to prevent application servers from reaching sensitive internal or metadata endpoints where possible.
  • Separate components that must access internal resources from those that process untrusted URLs, and apply least-privilege networking between them.
  • Provide safe, preconfigured integrations for common internal services so that users do not need to specify raw URLs for critical backends.

How teams detect issues like this

Useful detection approaches include:

  • Static analysis and code review to identify sinks where user-controlled URLs are passed into HTTP client libraries without strict allowlist and IP range checks.
  • Review of URL validation utilities to ensure they resolve hostnames and inspect the final IP address, not just the textual hostname.
  • Runtime monitoring and logging of outbound requests, including destination host/IP and calling feature (agent action/MCP), with alerts for connections to internal or metadata address ranges.
  • Network-level intrusion detection or egress monitoring to flag unusual traffic patterns from the application to internal subnets or cloud metadata services.
  • Policy enforcement in CI/CD (e.g., linting rules or security checks) that prevent introduction of new generic URL fetchers without proper SSRF protections.

Sources

SourceLink
github.comgithub.com/danny-avila/LibreChat/security/advisories/GHSA-f92m-jpv7-55p2

Frequently asked

questions

Yes, if LibreChat's agent actions or MCP features are exposed to remote users who can control URLs, an attacker can exploit the SSRF remotely, subject to authentication and feature configuration.

In most realistic deployments, some level of interaction with LibreChat (often authenticated) is required to invoke agent actions or MCP with a crafted URL. The exact requirement depends on how these features are exposed and whether anonymous users can trigger them.

The most robust pattern is to restrict outbound requests to a tightly controlled allowlist of destinations or service identifiers, combined with IP-range checks that block private, loopback, and metadata addresses even if they appear via DNS resolution.

Treat all user-influenced URLs as untrusted, centralize outbound request logic behind a hardened utility or gateway that enforces allowlists and IP-range filtering, and complement this with network egress controls and security tests that specifically probe SSRF vectors during development and deployment.

Find out what's already
exploitable in your codebase.