Summary
Tandoor Recipes contains a blind Server-Side Request Forgery (SSRF) issue in its Cookmate recipe import integration, where redirect handling is not properly constrained.
Any authenticated user can cause the server to make arbitrary HTTP requests to internal or external URLs after following redirects, enabling internal network probing and access to sensitive metadata services.
Affected context
The vulnerability occurs in deployments of Tandoor Recipes that:
- Enable and use the Cookmate recipe import feature
- Allow authenticated users (including non-admins) to submit URLs for import
- Run the application in an environment where the server has network access to internal services or cloud metadata endpoints
The issue resides in the Cookmate integration class (cookbook/integration/cookmate.py), where redirect targets are not validated against a trusted allowlist or network boundary.
Exploit preconditions
- Attack surface: HTTP interface used for Cookmate recipe import.
- Required access: Any authenticated Tandoor Recipes account; administrative privileges are not required.
- Trigger point: Submitting a crafted recipe import URL that either directly or via HTTP redirects resolves to an attacker-chosen internal or external endpoint.
- Why exploitation is possible:
- The application follows HTTP redirects when fetching Cookmate resources.
- The final destination URL, IP, or host is not validated against security policies (e.g., blocklists/allowlists, local-address filters).
- Outbound requests are made from the server's network context, which may reach internal resources not normally exposed to users.
Why this happens
The root cause is an SSRF-prone network access pattern in the Cookmate integration logic that trusts user-supplied URLs and follows redirects without enforcing strict destination validation.
This maps to CWE-918: Server-Side Request Forgery (SSRF), where a server-side component can be instructed to initiate network connections to arbitrary targets.
Conceptually, the integration treats untrusted URLs as safe fetch targets and relies on generic HTTP client behavior (including redirect following) without:
- Restricting which hosts, IP ranges, or schemes can be contacted
- Enforcing network boundary checks after redirects
- Normalizing and validating the effective destination before performing the final request
Potential impact
- The server may be used to scan internal network ports and discover reachable internal services.
- Attackers could access cloud instance metadata endpoints (e.g., AWS/GCP metadata services), potentially exposing credentials or configuration.
- The real IP address of the server or underlying infrastructure can be disclosed, aiding further targeting.
- Internal HTTP APIs, admin panels, or management interfaces reachable only from the server network could be probed or queried.
- Application-level data exposed via internal-only services may be accessed if the server can reach those endpoints.
General mitigation guidance
Effective mitigation focuses on treating all user-provided URLs as untrusted and tightly constraining server-initiated requests:
- Introduce strict URL validation before any outbound request:
- Allow only necessary schemes (e.g., https, http) and known-safe domains/hosts for the Cookmate integration.
- Reject private, loopback, link-local, and multicast IP ranges after DNS resolution and redirect handling.
- Disable or tightly control automatic redirect following in HTTP clients, or re-validate the redirect destination on each hop.
- Normalize and re-check the final resolved URL (including hostname and IP) against an allowlist before performing the final request.
- Apply network-level egress controls (firewall rules, security groups) to limit which destinations the application server can reach.
- Separate integration functionality into a more restricted network segment or worker role with minimal outbound access where feasible.
These patterns help ensure that even if a user can supply a URL, the server only contacts explicitly trusted endpoints.
How teams detect issues like this
Detection commonly involves a combination of code-centric and operational techniques:
- Static analysis and code review:
- Search for HTTP client usage that consumes user-supplied URLs (e.g., in integration classes) without host/IP validation or allowlisting.
- Flag patterns where
follow_redirectsor automatic redirect behavior is enabled without re-validating the redirected target. - Review URL parsing logic to ensure DNS resolution and IP range checks are applied after redirects and not just on initial input.
- Security testing:
- Use dynamic testing tools or scripts to submit URLs pointing to known internal ranges (e.g.,
127.0.0.1, RFC1918 addresses) or metadata endpoints and observe indirect effects (timeouts, response differences). - Operational monitoring:
- Monitor outbound HTTP requests from the application server for unusual destinations, especially internal IP addresses or metadata services.
- Configure alerts on egress firewall logs indicating attempts to access restricted internal networks or well-known metadata IPs.
Automated SAST/DAST tools and CI-based security checks can help detect unsafe URL fetch patterns early in the development lifecycle.

