Summary
LibreChat allows authenticated users to configure custom OpenAI-compatible API endpoints via a baseURL setting without any SSRF validation.
When misused, this can cause the server to make arbitrary HTTP requests to internal or external addresses, exposing internal services and sensitive metadata.
Affected context
The vulnerability occurs in LibreChat deployments where users can define custom OpenAI-compatible endpoints by setting a baseURL for API requests.
The application constructs outbound HTTP calls directly from this user-controlled baseURL with no restrictions on IP ranges, schemes, or DNS behavior.
Risk is higher in environments where the LibreChat server has network reachability to internal services, cloud metadata endpoints, or management interfaces.
Exploit preconditions
- Attack surface: Application API or UI where users configure custom OpenAI-compatible baseURL values
- Required access: Authenticated account with permissions to set or modify provider configuration options
- Trigger point: Submission of a crafted baseURL followed by any operation that causes the server to send a request (e.g., initiating a chat or test call)
- Why exploitation is possible: The server trusts the user-supplied baseURL and performs HTTP requests without checks for internal IP ranges, URL schemes, or DNS pinning, allowing redirection of server-side traffic to arbitrary hosts
Why this happens
This issue stems from treating a user-controlled network endpoint configuration as inherently trustworthy and using it directly to construct outbound HTTP requests.
Without SSRF defenses such as private IP filtering, scheme restrictions, or DNS validation, the application can be coerced into acting as a proxy to internal services that are not intended to be exposed externally.
Conceptually this maps to CWE-918: Server-Side Request Forgery (SSRF), where an attacker influences how a server makes network calls, leveraging its privileged network position to access protected resources.
Potential impact
- May allow access to internal HTTP services reachable only from the LibreChat server
- Could expose cloud provider metadata endpoints and sensitive configuration data
- Can facilitate port scanning or service discovery within internal networks
- May enable interaction with admin panels, debugging interfaces, or APIs not intended for end users
- Could support chaining with other vulnerabilities (e.g., misconfigured internal services) leading to broader compromise
General mitigation guidance
Effective mitigation focuses on constraining server-initiated network requests and reducing trust in user-supplied endpoint configuration.
Common patterns include:
- Validating baseURL values against an allow-list of trusted domains or service identifiers rather than arbitrary URLs
- Enforcing strict IP range controls that block private, link-local, and metadata-related addresses for outbound requests
- Restricting supported URL schemes to HTTPS and disallowing protocols such as file://, gopher://, or custom handlers
- Implementing DNS pinning or resolution checks to ensure hostnames cannot be redirected to internal IPs at runtime
- Isolating the component that performs outbound AI provider calls into a network segment with limited internal reach and least-privilege access
How teams detect issues like this
Detection commonly relies on a combination of configuration review and behavioral monitoring:
- Static analysis or configuration linting to flag code paths where user-controlled URLs are used directly in HTTP client calls
- Security-focused code reviews that look for customizable endpoints, missing allow-lists, and absence of IP or scheme validation logic
- Application-level logging and monitoring of outbound requests, including destination IPs and domains, to identify suspicious internal targets
- Network-level controls such as egress filtering and firewall rules, with alerts on attempts to reach sensitive internal ranges or metadata services
- Optional use of automated security testing tools that specialize in SSRF to probe configurable baseURL parameters and similar network settings

