/

CVE-2026-53963

Severity:

HIGH RISK

(7.3)

Stored XSS (CWE-79) in Discourse 2FA Delete Dialog

CVE-2026-53963

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting leading to admin account compromise

Severity:

HIGH RISK

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

Discourse prior to specific patched versions failed to escape malicious second factor names in the delete confirmation dialog, enabling stored cross-site scripting.

When an administrator impersonates an attacker-controlled account, the crafted 2FA name can execute arbitrary JavaScript in the admin's browser, exposing sensitive actions and data.

Affected context

This vulnerability appears in Discourse instances where:

  • Two-factor authentication is enabled for user accounts
  • Administrators can impersonate user accounts for support or moderation
  • The 2FA delete confirmation dialog renders the second factor name in the browser

Under these conditions, an attacker who can register or control an account and set a crafted 2FA name can persist script code that executes when an admin interacts with that dialog during impersonation.

Exploit preconditions

  • Attack surface: Web administration interface of a Discourse instance.
  • Required access: Ability for an attacker to create or control a user account and configure a malicious second factor name.
  • Trigger point: An administrator impersonates the attacker-controlled account and opens the 2FA delete confirmation dialog.
  • Why exploitation is possible: The second factor name is rendered without proper HTML escaping or sanitization, allowing embedded JavaScript code to run in the admin's browser context.

Why this happens

The underlying issue is improper neutralization of user-controlled data before it is included in HTML content.

The second factor name, which is a user-supplied string, is inserted into the delete confirmation dialog without robust escaping or sanitization.

This aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where dynamic content is trusted and interpreted as executable script by the browser.

Potential impact

  • An attacker may execute arbitrary JavaScript in the context of an administrator session.
  • Attackers could hijack admin accounts by stealing session tokens or triggering privileged actions.
  • Malicious scripts can manipulate forum configuration, user permissions, or content.
  • The attacker could pivot to broader system compromise through social engineering or administrative actions performed via injected scripts.

General mitigation guidance

Effective mitigation centers on enforcing strict output encoding wherever user-controlled data is rendered in HTML pages, dialogs, or templates.

Recommended defensive patterns include:

  • Applying context-appropriate escaping (HTML, attribute, JavaScript) to all dynamic values in templates.
  • Treating 2FA labels, usernames, and other display fields as untrusted input by default.
  • Centralizing rendering helpers so user-supplied strings never bypass encoding.
  • Limiting powerful admin impersonation functionality to well-audited flows and ensuring all impersonation views adhere to the same sanitization rules.
  • Using a secure templating system that defaults to safe encoding rather than raw HTML injection.

How teams detect issues like this

Detection can leverage both automated and manual review techniques:

  • Static analysis rules searching for direct insertion of user-controlled variables into HTML templates without escaping.
  • Template linting that flags use of raw interpolation helpers for potentially hostile fields such as names, labels, and descriptions.
  • Code review checklists that require verification of output encoding for any new or modified admin-facing dialogs, especially those involving impersonation.
  • Security testing that exercises impersonation flows with specially crafted values containing script markers to observe whether they are rendered or neutralized.
  • Integrating automated security scanning tools that simulate XSS payloads in form fields, account attributes, and configuration names.

Sources

SourceLink
github.comgithub.com/discourse/discourse/commit/40de62cddadc65c328a1028ab999f3fa94adbfed
github.comgithub.com/discourse/discourse/commit/529e17d4d570a48972e7cf64720e5dd1fdf23ca8
github.comgithub.com/discourse/discourse/commit/d92973e51a46cf6dd20c71e6068e6769b67eea5b
github.comgithub.com/discourse/discourse/commit/daea5214d833eacbdd3b1a78d99eb14e9cabd915
github.comgithub.com/discourse/discourse/releases/tag/v2026.1.5
github.comgithub.com/discourse/discourse/releases/tag/v2026.4.2
github.comgithub.com/discourse/discourse/releases/tag/v2026.5.1
github.comgithub.com/discourse/discourse/releases/tag/v2026.6.0
github.comgithub.com/discourse/discourse/security/advisories/GHSA-wg5x-7f23-m3r5

Frequently asked

questions

Exploitation is targeted: an attacker must control an account on the affected Discourse instance and rely on an administrator impersonating that account. However, in communities where admin impersonation is common for support, this scenario can be realistic.

The attacker only needs regular user-level access to create or control an account and configure a crafted second factor name. Administrative privileges are not required to plant the payload, but an admin must later interact with the vulnerable dialog.

The strongest fix is to enforce consistent, context-aware escaping for all user-controlled fields before they are rendered, and to ensure templating helpers default to safe output encoding. Additionally, review impersonation-related views to confirm no raw HTML insertion occurs.

Adopt a secure-by-default templating approach, mandate output encoding in coding standards, and integrate static analysis or template linting into CI pipelines. Regular security reviews of administrative and impersonation flows, combined with automated XSS testing, help catch similar issues early.

Find out what's already
exploitable in your codebase.