/

CVE-2026-72730

Severity:

HIGH RISK

(8.7)

Stored XSS (CWE-79) in Discourse Rich Text Editor UI

CVE-2026-72730

Received

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Client-Side Code Execution and Account Compromise

Severity:

HIGH RISK

(8.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

A stored cross-site scripting vulnerability in Discourse causes a chat-transcript username to be rendered as HTML by the Rich Text Editor. If an attacker can place crafted content in a username or transcript that is later viewed, script may execute in another user's browser.

Affected context

The issue occurs in Discourse deployments where the Rich Text Editor processes chat transcripts and renders usernames without consistently treating them as plain text. It becomes risky when attacker-controlled username data is stored, included in a transcript, and subsequently displayed to other users with browser-executable markup.

Exploit preconditions

  • Attack surface: Discourse chat-transcript rendering in the Rich Text Editor
  • Required access: The ability to create or control a username or other data incorporated into a stored transcript
  • Trigger point: A victim views the affected transcript through the editor or rendered interface
  • Why exploitation is possible: Username content is interpreted as HTML instead of being safely encoded before insertion into the document

Why this happens

The underlying bug is insufficient output encoding for attacker-controlled username data during HTML rendering. By treating stored text as markup, the application permits browser interpretation of content that should remain data. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), specifically a stored XSS condition.

Potential impact

  • Malicious script may execute in the security context of a victim's Discourse session
  • An attacker could perform unauthorized actions through the victim's browser
  • Sensitive page content or user information could be exposed
  • Account settings or forum content could be altered
  • The vulnerability could support phishing or further compromise of users

General mitigation guidance

Mitigation generally focuses on treating usernames and transcript fields as untrusted text throughout their lifecycle.

Common defensive patterns include:

  • Applying context-appropriate HTML output encoding whenever usernames are rendered
  • Using a well-maintained HTML sanitization policy when markup is genuinely required
  • Avoiding direct insertion of untrusted strings into HTML or browser DOM APIs
  • Enforcing strict content security controls as defense in depth
  • Limiting privileges available to authenticated sessions and administrative interfaces
  • Preserving untrusted-data classification across storage, transformation, and rendering boundaries

How teams detect issues like this

Detection approaches commonly include:

  • Static analysis for direct insertion of user-controlled values into HTML-rendering paths
  • Code review checks for missing output encoding around usernames and transcript fields
  • Security tests that verify special characters remain text in every supported rendering context
  • Dynamic scanning of stored-content workflows with benign markup markers
  • Policy enforcement requiring approved templating and sanitization APIs
  • Browser security telemetry and content security policy reports for unexpected script execution

Automated code review and application security testing tools may help identify unsafe rendering patterns, but findings should be validated against the actual browser context.

Sources

SourceLink
github.comgithub.com/discourse/discourse/commit/32920affe4ad97b461ca2ae2f664c5fefc374baf
github.comgithub.com/discourse/discourse/commit/3fb1e8ead0d4f48d2cf55c8110825c7e8a6a45f5
github.comgithub.com/discourse/discourse/commit/7eb35d076ab9b6a612e86182336ce9787ce402ea
github.comgithub.com/discourse/discourse/commit/9633b8ecaf5a99f0407f5261b9bd1a05f7dac529
github.comgithub.com/discourse/discourse/security/advisories/GHSA-wg48-qxjc-f459

Frequently asked

questions

It can be exploitable through normal Discourse functionality when attacker-controlled username data is stored and later viewed by another user, although the exact reach depends on permissions and deployment configuration.

Usually, the attacker must be able to create or modify a username or otherwise place data into a chat transcript. Whether that requires authentication depends on the site's account and chat policies.

Render usernames and other untrusted fields as encoded text by default. Use narrowly scoped sanitization only when trusted markup is an explicit requirement.

Apply context-aware output encoding, test stored-content workflows, review DOM and template sinks, and enforce a restrictive content security policy as an additional safeguard.

Find out what's already
exploitable in your codebase.