/

CVE-2026-55674

Severity:

CRITICAL RISK

(9.3)

Reflected XSS (CWE-79) in Discourse Color Scheme

CVE-2026-55674

Deferred

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

Arbitrary JavaScript Execution

Severity:

CRITICAL RISK

(9.3)

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 cross-site scripting vulnerability in Discourse allows an unauthenticated attacker to inject arbitrary HTML through a crafted color-scheme cookie. When the value is rendered without escaping, injected script content may execute in visitors' browsers, including in cases where the site's nonce-based Content Security Policy would otherwise provide protection.

Affected context

The issue may occur in Discourse deployments that render color scheme identifiers from client-controlled cookies into a page without applying context-appropriate output encoding. It is particularly risky when an attacker can cause visitors to access a page that processes the crafted cookie and when the resulting markup can bypass or operate outside the intended Content Security Policy protections.

Exploit preconditions

  • Attack surface: Discourse web pages that process color scheme cookies
  • Required access: No authentication is required; the attacker needs to send or induce a request containing a crafted cookie
  • Trigger point: Server-side rendering of the color scheme value into the response
  • Why exploitation is possible: The cookie value is inserted into an HTML attribute or tag context without adequate escaping, allowing markup boundaries to be altered and script-capable content to be introduced

Why this happens

The underlying bug is improper neutralization of user-controlled input in an HTML context, mapping to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). A client-controlled cookie was treated as a trusted color scheme identifier and rendered into page markup without context-aware output encoding. This allowed the value to escape its intended attribute context and create additional HTML, weakening the protection expected from nonce-based Content Security Policy controls.

Potential impact

  • Arbitrary JavaScript may execute in visitors' browsers
  • User sessions or page actions could be exposed to attacker-controlled script
  • Account data or privileged interface content could be accessed subject to browser and application controls
  • Attackers could perform actions as affected users
  • Site reputation and visitor trust could be harmed

General mitigation guidance

Mitigation generally focuses on enforcing a strict trust boundary for cookie-derived values and ensuring context-appropriate output encoding.

Common defensive patterns include:

  • Treating all client-controlled cookies as untrusted input
  • Allowing only validated, server-recognized color scheme identifiers
  • Applying HTML attribute encoding at the final rendering context
  • Avoiding direct interpolation of cookie values into markup
  • Preserving CSP as defense in depth rather than relying on nonces to compensate for unsafe HTML generation
  • Limiting the privileges available to application sessions and administrative interfaces
  • Centralizing output encoding and input validation policies across templates and rendering helpers

How teams detect issues like this

Organizations commonly detect this class of issue through:

  • Static analysis for direct interpolation of request, cookie, or header values into HTML templates
  • Code review checks for missing context-sensitive output encoding
  • Tests that verify special characters in cookie values remain encoded in rendered responses
  • Dynamic application testing for reflected script-capable markup in response bodies
  • Policy enforcement requiring approved template escaping mechanisms and rejecting unsafe HTML construction
  • Monitoring for anomalous cookie values and unexpected script-like content in requests

Sources

SourceLink
github.comgithub.com/discourse/discourse/security/advisories/GHSA-qx4v-rg4v-pm2g

Frequently asked

questions

Yes. An unauthenticated attacker may be able to exploit it remotely by causing a request with a crafted color scheme cookie to be processed and viewed by a visitor.

No authenticated account is generally required. The relevant prerequisite is the ability to deliver or induce a request containing the attacker-controlled cookie and have the resulting page rendered by a victim.

Treat cookie values as untrusted, restrict them to recognized values, and apply context-aware HTML attribute encoding before rendering them.

Use secure-by-default templating, centralized output encoding, strict input validation, automated security tests for reflected input, and code-review policies covering all request-derived data placed into HTML.

Find out what's already
exploitable in your codebase.