/

CVE-2025-68662

Severity:

HIGH RISK

(7.6)

SSRF in Discourse FinalDestination

CVE-2025-68662

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Bypass of SSRF Protections and Unauthorized Network Access

Severity:

HIGH RISK

(7.6)

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 hostname validation flaw in Discourse's FinalDestination URL resolution component can allow bypassing existing Server-Side Request Forgery (SSRF) protections under certain conditions.

When exploited, this issue may let an attacker coerce the Discourse server into making unintended outbound HTTP requests to internal or otherwise restricted endpoints.

Affected context

The vulnerability occurs in Discourse deployments where FinalDestination is used to resolve and validate URLs before the application makes outbound HTTP requests.

It is relevant in flows that follow redirects, dereference user-supplied URLs (e.g., link previews, embedding, or webhooks), or otherwise depend on hostname validation to enforce network access controls.

The risk materializes when attacker-controllable URLs are processed and the hostname validation logic is relied upon to prevent access to internal or sensitive network locations.

Exploit preconditions

  • Attack surface: Application features that accept user-supplied URLs which are subsequently fetched server-side (e.g., link expansion, URL previews, webhook callbacks, or import tools).
  • Required access: Ability to submit or influence URLs processed by Discourse; typically any authenticated user, and in some configurations possibly anonymous users.
  • Trigger point: The moment Discourse resolves and validates the supplied URL via FinalDestination, before making the outbound HTTP request.
  • Why exploitation is possible: The hostname validation logic in FinalDestination contains edge cases that can be abused (e.g., crafted hostnames, redirects, or parsing ambiguities), allowing URLs that should be blocked by SSRF protections to be treated as safe.

Why this happens

This issue stems from incomplete or incorrect hostname validation in the FinalDestination component, which is responsible for resolving URLs and determining whether they are safe to request.

The underlying bug class aligns with CWE-918: Server-Side Request Forgery, where the server makes network requests based on user-controllable input without reliably enforcing network access policies.

Instead of enforcing a strict, canonicalized, and well-scoped allowlist of destinations, the validation logic can be fooled by specially crafted URLs or resolution patterns, allowing internal or otherwise restricted hosts to pass as valid.

Conceptually, this reflects a mismatch between the intended trust boundary (Discourse should only talk to vetted external hosts) and the actual enforcement implemented in the hostname checks.

Potential impact

  • Access to internal services that are not directly exposed to the internet (e.g., metadata endpoints, admin consoles, internal APIs).
  • Use of the Discourse server as a pivot point for network scanning or service enumeration within the hosting environment.
  • Interaction with internal HTTP-based configuration or metadata services that could leak sensitive information (tokens, instance metadata, configuration secrets).
  • Abuse of SSRF to reach external endpoints that should be blocked by policy, potentially bypassing IP or hostname-based egress controls.
  • Contribution to chained attacks, where SSRF is combined with other weaknesses (e.g., misconfigured internal services) for further compromise.

General mitigation guidance

Long-term mitigation focuses on hardening both URL validation and network trust boundaries, rather than relying on a single hostname check:

  • Apply strict allowlisting for outbound HTTP destinations, using canonicalized hostnames and resolved IPs, and avoid complex pattern-based checks where possible.
  • Normalize and re-parse URLs after resolution and redirection, validating against both hostname and final IP address, including checks against private, loopback, and link-local ranges where appropriate.
  • Reduce reliance on user-supplied URLs for server-side fetches; where feasible, perform operations client-side or via intermediaries that enforce strong egress controls.
  • Apply least-privilege network permissions at the infrastructure level (e.g., firewall rules, security groups, service mesh policies) so the application server cannot reach sensitive internal services even if URL validation fails.
  • Centralize URL fetching and validation logic into a small, well-reviewed component to avoid duplicated, inconsistent SSRF defenses across the codebase.

How teams detect issues like this

Detection efforts can combine code-centric and environment-centric approaches:

  • Static analysis: Flag code paths where user-controlled URLs are passed into HTTP client libraries, especially where hostname or redirect handling is implemented manually or in utility classes like FinalDestination.
  • Code review: Look for custom hostname validation, IP range checks, or redirect-following logic that does not normalize and re-validate the final destination, and ensure all outbound requests flow through a vetted URL-fetching abstraction.
  • Logging and monitoring: Instrument outbound HTTP requests with structured logs capturing target host/IP, request source, and feature context; alert on requests to internal address ranges or unexpected domains.
  • Network-level monitoring: Use egress firewalls or proxies with logging to detect unusual traffic patterns originating from the application server (e.g., access to metadata endpoints or internal RFC1918 ranges).
  • Automated security tools, including SAST and DAST scanners with SSRF test cases, can be integrated into CI/CD pipelines to surface new or regressed SSRF patterns early.

Sources

SourceLink
github.comgithub.com/discourse/discourse/security/advisories/GHSA-gcfp-rjfc-925c

Frequently asked

questions

Yes, in typical deployments it can be triggered remotely by supplying crafted URLs to features that the server resolves and fetches. However, exploitability depends on how Discourse is configured and which endpoints are exposed to untrusted users.

An attacker generally needs the ability to submit or influence URLs that Discourse will process server-side—commonly via standard user capabilities such as posting content or configuring certain URL-based features. In some setups, even low-privileged or anonymous users may have this capability.

The safest pattern is to centralize all outbound URL fetching in a single, hardened component that performs strict URL normalization, enforces a conservative allowlist of destinations, validates both hostname and final IP, and refuses redirects to disallowed ranges. This should be complemented by infrastructure-level egress restrictions so that even if URL validation fails, sensitive internal services remain unreachable.

To prevent similar SSRF bypasses, design the application so that user-supplied URLs are rarely, if ever, fetched directly by the server. Where server-side fetching is necessary, encapsulate it behind well-reviewed libraries, enforce strict destination policies, normalize and re-validate after redirection, and backstop application logic with network-layer controls and continuous security testing.

Find out what's already
exploitable in your codebase.