Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-72728

CVE-2026-72728: Discourse Auth Bypass Vulnerability

CVE-2026-72728 is an authentication bypass flaw in Discourse that allows authenticated users to embed malicious content by bypassing the Onebox allowlist. This article covers technical details, affected versions, and patches.

Published:

CVE-2026-72728 Overview

CVE-2026-72728 is an input validation vulnerability in Discourse, an open-source discussion platform. Authenticated users can submit specially crafted URLs that bypass the Onebox allowlist enforcement. The bypass allows attackers to embed malicious content within a site by exploiting a weakness in how the iframe origin allowlist matches URL authorities. The flaw is tracked as [CWE-20: Improper Input Validation] and affects Discourse versions prior to 2026.1.7. Fixed releases include 2026.1.7, 2026.6.2, 2026.7.1, and 2026.8.0-latest.1.

Critical Impact

Authenticated attackers can bypass the Onebox iframe allowlist and embed unauthorized third-party content, enabling phishing, content spoofing, and secondary attacks against forum users.

Affected Products

  • Discourse versions prior to 2026.1.7
  • Discourse 2026.6.x prior to 2026.6.2
  • Discourse 2026.7.x prior to 2026.7.1

Discovery Timeline

  • 2026-08-10 - CVE CVE-2026-72728 published to NVD
  • 2026-08-10 - Last updated in NVD database

Technical Details for CVE-2026-72728

Vulnerability Analysis

Discourse's Onebox feature renders rich previews of external URLs, including embedded iframes from allowlisted origins. The allowlist check compiles each allowed origin into a regular expression anchored with \A, but did not anchor the trailing authority boundary. An attacker can craft a URL whose authority extends the allowlisted host, causing the regex to match a domain the operator never intended to trust. Wildcard patterns such as https://*.example.com used the greedy \S* token, which further extended the match across path and query characters. The result is embedded content sourced from an attacker-controlled origin masquerading as an approved provider.

Root Cause

The root cause is missing authority-boundary enforcement in lib/onebox/engine.rb. The regex generated from each allowlisted origin only anchored the start of the string. Wildcard substitutions used \S*, which matched non-whitespace characters beyond the hostname component. The fix constrains wildcards to [^/?#]* and appends an explicit boundary that requires a /, ?, #, port, or end-of-string after the authority.

Attack Vector

Exploitation requires an authenticated account on the target Discourse instance. The attacker posts content containing a URL that the Onebox engine will preview. The URL is constructed so its authority prefix matches an allowlisted origin but continues into an attacker-controlled domain. When rendered, the resulting iframe loads content from the attacker's server within the trusted site context.

ruby
# Security patch in lib/onebox/engine.rb
# SECURITY: Onebox iframe origin allowlist enforces URL authority boundary
       origins.map do |origin|
         escaped_origin = Regexp.escape(origin)
         if origin.start_with?("*.", "https://*.", "http://*.")
-          escaped_origin = escaped_origin.sub("\\*", '\S*')
+          escaped_origin = escaped_origin.sub("\\*", "[^/?#]*")
         end

-        Regexp.new("\\A#{escaped_origin}", "i")
+        origin_boundary =
+          if origin.match?(%r{\Ahttps?://[^/?#]+\z}i)
+            if origin.match?(/:\d+\z/)
+              "(?:[/?#]|\\z)"
+            else
+              "(?::\\d+(?:[/?#]|\\z)|[/?#]|\\z)"
+            end
+          else
+            ""
+          end
+
+        Regexp.new("\\A#{escaped_origin}#{origin_boundary}", "i")
       end
     end

Source: GitHub Commit 92eec47

Detection Methods for CVE-2026-72728

Indicators of Compromise

  • Onebox previews rendering iframes with origins that structurally resemble allowlisted providers but resolve to unfamiliar hosts.
  • Post content containing URLs where an allowlisted hostname is followed by additional hostname characters before a path separator.
  • Outbound network requests from user browsers to unexpected domains sourced from embedded Onebox iframes.

Detection Strategies

  • Review Discourse post history for URLs that concatenate an approved provider host with attacker-controlled subdomains or userinfo segments.
  • Audit the compiled Onebox::Engine.iframe_origins list at runtime and compare rendered iframe src attributes against expected authority boundaries.
  • Correlate authenticated user activity with unusual outbound iframe origins in web server or CDN logs.

Monitoring Recommendations

  • Alert on Discourse posts by low-reputation accounts that trigger Onebox iframe rendering for uncommon domains.
  • Monitor Content Security Policy (CSP) violation reports for frame-src deviations from the approved provider list.
  • Track patch state for the Discourse instance and validate the installed version against 2026.1.7 or later.

How to Mitigate CVE-2026-72728

Immediate Actions Required

  • Upgrade Discourse to 2026.1.7, 2026.6.2, 2026.7.1, or 2026.8.0-latest.1 depending on the deployed release branch.
  • Restrict account creation and elevate moderation review for new posts containing external URLs until the patch is applied.
  • Audit recent Onebox embeds for content that may have been injected via crafted URLs.

Patch Information

The fix is committed in Discourse commit 92eec47 and detailed in GitHub Security Advisory GHSA-qp9j-3v7r-wrvr. The patch modifies lib/onebox/engine.rb to constrain wildcard matches to [^/?#]* and appends an explicit authority boundary to each allowlist regex.

Workarounds

  • Tighten the Onebox allowed_iframes site setting to remove wildcard entries until the patch is deployed.
  • Enforce a strict Content Security Policy frame-src directive that duplicates the intended allowlist at the browser layer.
  • Disable Onebox previews for untrusted user groups by adjusting trust level requirements for posting external links.
bash
# Discourse upgrade example for standard Docker deployments
cd /var/discourse
git pull
./launcher rebuild app
# Verify version is 2026.1.7 or later
./launcher enter app -c "cat /var/www/discourse/lib/version.rb | grep STRING"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.