Summary
A server-side request forgery issue in text-generation-inference's OpenAI-compatible multimodal chat endpoint allows crafted image_url values to make the server perform arbitrary HTTP GET requests.
When exposed to untrusted clients, this becomes risky because unauthenticated attackers can abuse the model API to reach internal services, cloud metadata endpoints, and perform internal port scanning or credential theft.
Affected context
This vulnerability occurs in deployments of text-generation-inference that:
- Expose the OpenAI-compatible multimodal chat completions endpoint to untrusted or semi-trusted clients
- Allow user-controlled image_url parameters to be fetched by the backend
- Run within network environments that have access to internal services or cloud metadata endpoints
In such contexts, the model-serving node effectively acts as a proxy, and insufficient validation of target addresses allows attackers to pivot from the public API into more sensitive network zones.
Exploit preconditions
- Attack surface: The OpenAI-compatible multimodal chat completions HTTP endpoint exposed by text-generation-inference.
- Required access: Network access to the API; no authentication is required in vulnerable configurations.
- Trigger point: Submission of a chat request containing a crafted image_url field that the backend attempts to fetch.
- Why exploitation is possible:
- The fetch_image function does not restrict private, loopback, link-local, or metadata service addresses.
- The reqwest client follows HTTP redirects by default, enabling attackers to start with an allowed scheme/host and then redirect to internal targets.
- There is no robust allowlist or network boundary check before performing outbound requests on behalf of the user.
Why this happens
The underlying bug aligns with CWE-918: Server-Side Request Forgery (SSRF), where a server-side component makes outbound requests based on user-controlled input without sufficient validation.
In this case, the multimodal chat endpoint treats image_url values as trusted locations, and the fetch_image function directly passes them to an HTTP client that:
- Lacks restrictions on address ranges (e.g., RFC1918, loopback, link-local, and metadata IPs)
- Follows redirects, allowing indirect navigation from benign-looking URLs to internal resources
Abstractly, the insecure pattern is "backend-as-proxy" behavior: a network-privileged service accepts arbitrary destination URLs from users and forwards them, granting attackers visibility and reach that they would not have directly from their own network position.
Potential impact
- May allow internal port scanning of services reachable from the text-generation-inference host.
- Could enable access to cloud provider instance-metadata endpoints, potentially leaking credentials or configuration secrets.
- Can facilitate probing and enumeration of internal HTTP-based management or monitoring interfaces.
- May be leveraged as a stepping stone in lateral movement, helping attackers map internal network topology and identify additional targets.
General mitigation guidance
Effective mitigation focuses on constraining where the backend can connect on behalf of users and reducing the trust placed in user-supplied URLs.
Common defensive patterns include:
- Implement strict validation and allowlisting of outbound destinations, such as only permitting publicly routable HTTPS endpoints and disallowing private, loopback, link-local, and metadata address ranges.
- Enforce URL scheme and hostname checks server-side, independent of redirect behavior, and block redirects to disallowed networks or hosts.
- Decouple model-serving components from sensitive network zones so that even if SSRF occurs, reachable internal services are minimized.
- Apply least-privilege principles to cloud roles and instance metadata access, ensuring that any exposed credentials are narrowly scoped and cannot lead to broad compromise.
- Treat media-fetching utilities (like fetch_image) as untrusted entry points and design them to fail closed when encountering ambiguous or internal destinations.
How teams detect issues like this
Organizations can detect SSRF risks and potential abuse by combining code-level and operational controls:
- Static analysis rules or linters that flag patterns where user-controlled URLs are passed directly to HTTP clients without address-range validation or allowlisting.
- Code review practices that scrutinize "proxy-like" behavior, focusing on functions that fetch external resources (images, webhooks, callbacks) from user-supplied locations.
- Runtime monitoring of outbound HTTP traffic from model-serving nodes, looking for suspicious requests to internal IP ranges, loopback addresses, and cloud metadata endpoints.
- Policy enforcement in CI/CD pipelines to require explicit destination validation for any new network calls added to API handlers, complemented by automated scanning tools integrated into pull requests.

