Summary
A Server-Side Request Forgery (SSRF) issue in Backstage's @backstage/plugin-auth-backend can occur when the experimental auth.experimentalClientIdMetadataDocuments.enabled flag is turned on.
The plugin validates the initial client_id hostname but fails to re-validate after HTTP redirects, which may allow an attacker to induce limited internal HTTP requests under specific configuration conditions.
Affected context
This vulnerability appears in Backstage deployments using the @backstage/plugin-auth-backend plugin with the experimental auth.experimentalClientIdMetadataDocuments.enabled feature explicitly enabled.
It affects the Client ID Metadata Documents (CIMD) metadata fetch logic, which:
- Accepts a
client_idwhose hostname is validated against private IP ranges for the initial request - Follows HTTP redirects without performing the same private IP range validation on the redirect target
Environments that configure allowedClientIdPatterns to restrict client_id values to specific trusted domains are effectively protected against this issue.
Exploit preconditions
- Attack surface: The Backstage auth backend endpoint that processes
client_idmetadata documents (CIMD). - Required access: Ability to supply or influence a
client_idvalue that triggers the metadata fetch (e.g., through an OAuth/OIDC or auth-related integration flow). - Configuration requirements:
auth.experimentalClientIdMetadataDocuments.enabledmust be set totrue.- The deployment must not restrict
allowedClientIdPatternsstrictly to trusted domains. - Trigger point: The backend performs an HTTP request to fetch metadata for the supplied
client_id, follows redirects, and fails to re-validate the redirect URL against private IP ranges. - Why exploitation is possible: Validation of the destination host is only performed on the initial URL. Redirect responses can point to internal IP addresses or internal hostnames, and the backend follows these redirects without repeating the private network checks, enabling limited SSRF.
Why this happens
The underlying flaw is an incomplete validation of server-side HTTP requests in the presence of redirects.
The CIMD metadata fetch correctly checks the initial client_id host against private IP ranges but does not repeat the same validation once an HTTP redirect is encountered.
This aligns with CWE-918: Server-Side Request Forgery (SSRF), where an application makes outbound requests based on user-controlled input without fully constraining all eventual destinations.
The insecure pattern is: input-derived URLs are partially validated only at the first hop, and subsequent redirect targets are implicitly trusted, creating a gap between intended network access policy and actual request behavior.
Potential impact
- The backend may send HTTP requests to internal services or metadata endpoints that are not normally exposed to external users.
- Internal network reachability can be probed indirectly (e.g., via timing, error messages, or success/failure behavior), enabling limited network scanning.
- Certain internal endpoints that perform side effects on simple HTTP requests could be triggered, subject to the fixed method and headers.
- In multi-tenant or complex environments, this could assist an attacker in mapping portions of the internal network topology.
General mitigation guidance
Effective mitigation focuses on tightening outbound request validation and reducing trust in client-controlled identifiers:
- Apply consistent host and IP range validation on every outbound request, including after HTTP redirects, not just on the initial URL.
- Enforce strict
allowedClientIdPatternsso thatclient_idvalues are constrained to a small set of trusted domains that are under organizational control. - Consider disabling experimental features such as
auth.experimentalClientIdMetadataDocuments.enabledunless there is a clear operational need and they are reviewed for security implications. - Introduce allowlist-based egress control at the application or network layer so that backend components can only reach known, explicitly approved hosts.
- Use conservative redirect-following policies (e.g., limit the number of redirects or disallow redirects to different hostnames or schemes) for security-sensitive metadata fetches.
How teams detect issues like this
Detection can be approached through both code-centric and operational techniques:
- Static analysis and code review:
- Look for HTTP client usage that follows redirects automatically when the target URL is derived from user or configuration input.
- Flag patterns where initial URL validation (e.g., private IP checks) is performed without equivalent checks on redirect destinations.
- Review auth and metadata-related code paths for network calls that do not enforce strict domain allowlists.
- Automated tooling:
- Configure SAST tools to detect potential SSRF sinks (HTTP clients, URL fetchers) where input validation is incomplete or absent.
- Use dependency-aware scanners to highlight plugins or modules that initiate outbound requests based on client identifiers.
- Runtime monitoring:
- Monitor egress traffic from the auth backend component for unexpected destinations, especially internal IP ranges or non-standard services.
- Implement logging for metadata fetches, including request targets, redirect chains, and response status codes, and alert on access to internal-only ranges.

