Summary
A server-side request forgery (SSRF) flaw in the Postiz /api/public/stream endpoint allows attackers to trick the server into following redirects to internal resources.
While the application validates the initially supplied URL and blocks direct access to private hosts, it fails to re-validate the final destination after HTTP redirects, enabling access to internal network services through a publicly reachable URL.
Affected context
This vulnerability arises in Postiz deployments where the /api/public/stream endpoint makes outbound HTTP(S) requests based on user-supplied URLs.
The application implements an allow/deny check only on the initial URL, focusing on blocking direct references to private or internal hosts.
However, if the initial URL responds with an HTTP redirect, the server automatically follows it without applying the same validation logic to the redirected target, which can reside on internal or private networks.
Exploit preconditions
- Attack surface: The public /api/public/stream endpoint that accepts user-provided URLs.
- Required access: Ability to send HTTP requests to the exposed API (typically unauthenticated or low-privilege access, depending on deployment).
- Trigger point: Submission of a crafted public HTTPS URL that responds with an HTTP redirect to an internal or private host.
- Why exploitation is possible: Validation is applied only to the original URL and not to the ultimate destination after following redirects, allowing the server to issue requests into internal networks on behalf of an attacker.
Why this happens
The core issue is incomplete server-side validation of outbound request targets when following redirects, mapping to CWE-918: Server-Side Request Forgery (SSRF).
The security checks confirm that the initially supplied URL is not a private or internal address, but they do not extend those checks to intermediate or final URLs reached via HTTP redirect chains.
This pattern treats the first URL as untrusted but implicitly trusts any redirect destinations, allowing attacker-controlled public endpoints to proxy the server into restricted network locations.
Potential impact
- Access to internal HTTP(S) services that are not intended to be exposed externally.
- Interaction with cloud metadata endpoints, configuration services, or admin panels reachable only from the internal network.
- Discovery or probing of internal network structure (basic port or service enumeration via response side channels).
- Potential data exfiltration from internal endpoints that return sensitive information over HTTP/S.
- Use of the application server as a pivot point for further attacks within the hosting environment.
General mitigation guidance
Effective mitigation focuses on limiting where server-side HTTP clients are allowed to connect and applying validation consistently across all redirect targets:
- Apply the same host and IP validation logic to every step in the redirect chain, including the final destination.
- Perform DNS resolution and IP classification (public vs. private, loopback, link-local, metadata endpoints) for each requested URL before sending the request.
- Consider disabling automatic redirect following in HTTP clients and implementing explicit, policy-aware redirect handling.
- Restrict outbound egress from application servers at the network level (firewalls, security groups) to only those domains that are strictly needed.
- Use allowlists of permitted external domains for server-side fetch endpoints instead of attempting to block disallowed internal ranges only.
- Minimize the functionality that accepts arbitrary user-controlled URLs; where necessary, treat them as untrusted and constrain how responses are used.
How teams detect issues like this
Detection can combine code-centric and infrastructure-centric approaches:
- Code review: Look for server-side HTTP client usage (e.g., fetch, axios, request libraries) that consumes user input and has redirect following enabled without post-redirect validation.
- Static analysis: Define rules to flag outbound HTTP calls made with user-controlled URLs and to detect missing checks against private IP ranges, loopback, or metadata endpoints after redirects.
- Logging and monitoring: Instrument outbound requests made by the /api/public/stream endpoint, logging destination hosts, IPs, and redirect chains; alert on access to internal ranges or unusual endpoints.
- Network-level monitoring: Use firewall or egress proxy logs to identify suspicious patterns where application servers reach internal-only or high-value service addresses following user activity.
- Automated security testing: Incorporate SSRF-focused tests into CI or security pipelines, including redirect-based scenarios targeting non-routable or internal IP ranges.

