/

CVE-2026-40168

Severity:

HIGH RISK

(8.2)

Server-Side Request Forgery (SSRF) in Postiz stream Endpoint

CVE-2026-40168

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized Access to Internal Resources

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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.

Sources

SourceLink
github.comgithub.com/gitroomhq/postiz-app/commit/30e8b777098157362769226d1b46d83ad616cb06
github.comgithub.com/gitroomhq/postiz-app/releases/tag/v2.21.5
github.comgithub.com/gitroomhq/postiz-app/security/advisories/GHSA-34w8-5j2v-h6ww

Frequently asked

questions

Yes. An attacker who can access the /api/public/stream endpoint over the network can potentially exploit the SSRF by supplying a crafted public URL that redirects to internal services.

It depends on how the endpoint is exposed in a given deployment. If /api/public/stream is publicly accessible or available to low-privilege users, then no special authentication is needed beyond that baseline access.

The strongest pattern is to avoid accepting arbitrary user-controlled URLs for server-side fetching. Where this is necessary, apply strict allowlists and validate every redirect target (host, IP, and scheme) before issuing or following requests, and consider disabling automatic redirects.

Adopt a defense-in-depth approach that includes: designing APIs to minimize server-side URL fetching; applying consistent validation to all outbound request targets including redirects; restricting egress at the network layer; and incorporating SSRF checks into code review, static analysis, and security testing practices.

Find out what's already
exploitable in your codebase.