Summary
Replicate Cog can make server-side HTTP requests to attacker-chosen destinations when prediction inputs contain URLs that are not adequately checked. If an attacker can submit inputs to an affected prediction endpoint, this behavior could expose internal services or credentials, including when redirects lead to destinations that were not initially validated.
Affected context
The issue occurs in Cog prediction handling for cog.File and cog.Path inputs that cause the server to fetch a URL. Risk depends on whether an attacker can submit or influence prediction inputs and whether the Cog process can reach sensitive internal network destinations. URL redirects can also matter if the destination is not revalidated at each step.
Exploit preconditions
- Attack surface: A Cog prediction interface that fetches URLs supplied through
cog.Fileorcog.Pathinputs - Required access: The ability to submit prediction inputs; whether authentication is required depends on the deployment
- Trigger point: Cog processes an input URL or follows an HTTP redirect while fetching it
- Why exploitation is possible: The requested destination is not reliably validated against its resolved host or IP before the request is made, potentially allowing access to internal destinations
Why this happens
The underlying issue is insufficient validation of URLs before server-side fetching. Checking a URL without verifying its resolved destination can allow a hostname to resolve to an internal address, while redirects may change the destination after an initial check. This is a server-side request forgery weakness under CWE-918, where an application makes requests to attacker-influenced locations without adequately restricting their targets.
Potential impact
- The Cog process may make requests to internal services that are not otherwise exposed
- Responses may reveal sensitive internal data or credentials
- Requests could reach administrative or metadata endpoints, depending on network access and controls
- Internal services may receive unexpected requests or experience unwanted changes if they expose state-changing operations
General mitigation guidance
Defensive patterns focus on limiting destinations and controlling server-side network access:
- Prefer fixed or explicitly allowlisted destinations over arbitrary user-supplied URLs
- Validate the resolved IP address as well as the URL hostname, and reject loopback, private, link-local, and otherwise disallowed ranges
- Reapply destination checks after every redirect, or disable redirects when they are not needed
- Use network egress controls to limit which services the Cog process can contact
- Avoid placing credentials in request contexts where untrusted URLs could expose them, and run the process with least privilege
- Treat prediction inputs as untrusted and apply consistent validation before any network fetch
How teams detect issues like this
- Review code paths that fetch URLs from prediction inputs, especially handlers for
cog.Fileandcog.Path - Use static analysis or code review checks to identify user-controlled URLs passed to HTTP clients without destination validation
- Check whether redirect handling revalidates each destination and whether resolved IP ranges are restricted
- Monitor outbound requests for unexpected access to internal, loopback, link-local, or metadata addresses
- Apply policy checks for workloads that require outbound network access, and use automated review tools to flag risky URL-fetching patterns

