/

CVE-2026-22664

Severity:

HIGH RISK

(7.7)

SSRF in prompts.chat Fal.ai Media Status Polling

CVE-2026-22664

Modified

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Credential Theft and Unauthorized External/Internal Requests

Severity:

HIGH RISK

(7.7)

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

prompts.chat contained a server-side request forgery (SSRF) weakness in the Fal.ai media status polling logic that allowed authenticated users to control outbound HTTP requests via a token parameter.

By supplying attacker-controlled URLs, a user could force the backend to send requests with its own Authorization header, potentially leaking the FAL_API_KEY, probing internal services, and abusing the victim's Fal.ai account.

Affected context

This vulnerability appears in prompts.chat's backend integration with Fal.ai, specifically in the media status polling endpoint that makes HTTP requests on behalf of users.

The affected context is any deployment where:

  • The backend fetches Fal.ai media status by calling a URL derived from user-controlled input (the token parameter).
  • The backend attaches a Fal.ai Authorization header containing a FAL_API_KEY.
  • There is no strict validation, allow‑listing, or normalization of the destination URL.

Under these conditions, attacker-supplied URLs can redirect the backend's HTTP client to arbitrary internal or external endpoints.

Exploit preconditions

  • Attack surface: Backend HTTP client used for Fal.ai media status polling.
  • Required access: Authenticated access to prompts.chat features that accept a token parameter used in Fal.ai polling.
  • Trigger point: Submission of a crafted request where the token parameter, directly or indirectly, controls the full or partial polling URL.
  • Why exploitation is possible:
  • The application trusts user-controlled data to construct outbound URLs.
  • There is no sufficient URL validation, scheme restriction, or host allow‑list.
  • The backend automatically includes sensitive headers (e.g., Authorization: Bearer FAL_API_KEY) in these requests, even when directed to attacker-controlled endpoints.

Why this happens

The core issue is a classic server-side request forgery pattern: the server uses untrusted user input to construct outbound HTTP requests without constraining the destination.

This maps to CWE-918: Server-Side Request Forgery (SSRF), where the server becomes a proxy that attackers can coerce into contacting arbitrary URLs.

In this case, the Fal.ai media status polling logic likely:

  • Accepted a token value that influenced the status endpoint's URL.
  • Passed that URL directly into an HTTP client.
  • Automatically attached the Fal.ai Authorization header containing the backend's FAL_API_KEY.

Because the server failed to enforce strict controls on the URL (host, scheme, path), attackers could point it at endpoints they control or internal services, and capture the outgoing Authorization header or observe the responses.

Potential impact

  • Theft of the backend's Fal.ai FAL_API_KEY via responses from attacker-controlled endpoints.
  • Unauthorized use of the victim's Fal.ai account, including running jobs, consuming credits, or accessing associated resources.
  • Internal network scanning and probing using the application server as a pivot.
  • Access to internal-only HTTP services that are otherwise not directly exposed to users.
  • Potential chaining with other vulnerabilities (e.g., internal admin panels or metadata endpoints) for further compromise.

General mitigation guidance

Effective mitigation focuses on restricting where and how the backend can make outbound HTTP requests and reducing the exposure of sensitive headers:

  • Constrain destination hosts:
  • Use a strict allow‑list of known Fal.ai API hostnames and enforce exact matches.
  • Reject or normalize user-supplied input so it can only influence safe URL components (e.g., path segments or IDs), not the scheme, host, or port.
  • Validate and sanitize URLs:
  • Enforce HTTPS.
  • Block non-HTTP schemes and private or loopback IP ranges after DNS resolution.
  • Normalize and re-parse URLs server-side before use.
  • Decouple sensitive headers from user-controlled destinations:
  • Only attach Authorization headers when the resolved host is explicitly trusted and expected.
  • Use separate HTTP client configurations for internal/partner APIs vs. user-specified resources.
  • Apply least privilege and compartmentalization:
  • Use scoped Fal.ai API keys with the minimal permissions required.
  • Store API keys in secure secrets management systems and limit their reuse across components.
  • Design for safe-by-default integrations:
  • Treat integration tokens as opaque identifiers, not as raw URLs.
  • Have the server construct URLs from fixed templates and validated IDs, rather than accepting full URLs from the client.

How teams detect issues like this

Detection can combine code-centric analysis with behavioral and operational monitoring:

  • Static analysis and code review:
  • Search for outbound HTTP calls where the URL is derived from request parameters (e.g., token, callback, url).
  • Flag patterns where user-controlled input influences the scheme, host, or port of HTTP requests.
  • Identify HTTP client configurations that always attach sensitive headers (Authorization, API keys) regardless of destination.
  • Configuration and policy checks:
  • Enforce security policies that forbid arbitrary outbound requests in sensitive services.
  • Use linters or custom CI checks to ensure URL construction follows an allow‑list or template-based pattern.
  • Runtime and logging analysis:
  • Log outbound HTTP destinations, including resolved IPs, and alert on unexpected hosts or private/loopback ranges.
  • Monitor for anomalous patterns like many distinct external hosts being contacted through the Fal.ai polling path.
  • Automated tooling:
  • Apply API security testing tools or DAST scanners that probe endpoints for SSRF by sending controlled URLs and observing backend behavior.

Sources

SourceLink
gist.github.comgist.github.com/mdisec/27c0cac0ec6a8f3c8f85a18987ddb942
github.comgithub.com/f/prompts.chat/commit/30a8f0470e0ba45e6be9c9f55220f4a9a6b91c99
vulncheck.comvulncheck.com/advisories/prompts-chat-ssrf-via-fal-ai-media-status-polling

Frequently asked

questions

Exploitation requires authenticated access to the affected prompts.chat functionality, but once that is available, an attacker can reliably coerce the backend into making outbound requests to attacker-chosen URLs, potentially leaking the Fal.ai API key and accessing internal resources.

Not necessarily. The issue description indicates that any authenticated user with access to the media status polling feature and control over the token parameter could exploit the vulnerability; no special administrative role is implied.

The safest pattern is to ensure URLs used for Fal.ai polling are fully constructed on the server from fixed, trusted templates and validated identifiers, while enforcing a strict allow‑list of permitted hosts and only attaching Authorization headers to those known endpoints.

Treat all user-influenced URLs as untrusted, constrain outbound requests with host allow‑lists and network-level egress controls, separate HTTP clients that use sensitive headers from those that touch user-controlled destinations, and embed automated checks into code review and CI pipelines to flag unsafe URL construction patterns.

Find out what's already
exploitable in your codebase.