/

CVE-2026-54682

Severity:

HIGH RISK

(8.2)

Stored XSS (CWE-79) in DiscordChatExporter Exporting

CVE-2026-54682

Deferred

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

Client-Side Script Execution and Export Data Exposure

Severity:

HIGH RISK

(8.2)

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

DiscordChatExporter versions before 2.47.2 can generate HTML exports that render attacker-controlled Discord content without HTML entity encoding when markdown formatting is disabled. A malicious webhook or bot could place script content in messages or embed fields, which may execute when someone opens the exported HTML file.

Affected context

The issue occurs in HTML exports created with markdown formatting disabled. Affected content can originate from message bodies, forwarded or referenced messages, and embed titles, descriptions, field names, or field values. Risk depends on an attacker being able to publish content through a Discord webhook, bot, or another account with access to the exported channel, followed by a user opening the resulting HTML file in a script-capable browser.

Exploit preconditions

  • Attack surface: DiscordChatExporter HTML export generation and subsequent file viewing
  • Required access: Ability to store attacker-controlled text in a Discord message or embed field
  • Trigger point: Rendering an HTML export with markdown formatting disabled, then opening the generated file
  • Why exploitation is possible: Selected content is inserted into HTML without entity encoding, allowing markup and script-bearing content to be interpreted by the browser

Why this happens

The vulnerability results from treating untrusted Discord content as trusted HTML during export. Formatting functions such as FormatMarkdownAsync and FormatEmbedMarkdownAsync pass attacker-controlled values into an HTML template without applying context-appropriate entity encoding. This is a stored cross-site scripting issue mapped to CWE-79, because content persisted in a communication channel is later interpreted as executable browser markup.

Potential impact

  • A script could execute in the context of the exported document
  • Exported chat content could be read or processed by the script
  • The displayed export could be altered to mislead the viewer
  • Additional local browser actions could be attempted within applicable file-origin security boundaries
  • Users could be exposed to phishing or deceptive content embedded in an otherwise trusted export

General mitigation guidance

Mitigation generally focuses on treating all message and embed fields as untrusted data throughout the export pipeline.

Common defensive patterns include:

  • Applying context-appropriate HTML entity encoding at the final rendering boundary
  • Using templating mechanisms that escape values by default
  • Separating trusted formatting transformations from untrusted content
  • Allowing only narrowly defined, sanitized markup when HTML is intentionally supported
  • Preserving safe-by-default behavior regardless of markdown formatting settings
  • Limiting the privileges and sensitive data available to applications used to open exported files
  • Avoiding reliance on content origin, such as a webhook or bot, as a trust signal

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis rules for unencoded values inserted into HTML templates
  • Code review checks covering every message, embed, and forwarded-content rendering path
  • Tests containing harmless markup markers to verify that generated HTML encodes them
  • Policy enforcement requiring auto-escaping template engines or explicit output encoding
  • Review of configuration branches that disable markdown or alter rendering behavior
  • Automated security review tools that flag user-controlled data reaching HTML sinks without encoding

Sources

SourceLink
github.comgithub.com/Tyrrrz/DiscordChatExporter/commit/5632d6c3867d2f79cba9578056c98caee4377c1b
github.comgithub.com/Tyrrrz/DiscordChatExporter/pull/1545
github.comgithub.com/Tyrrrz/DiscordChatExporter/releases/tag/2.47.2
github.comgithub.com/Tyrrrz/DiscordChatExporter/security/advisories/GHSA-8qrv-mmch-fr9c

Frequently asked

questions

No. The described condition involves HTML exports with markdown formatting disabled and content that an attacker can control. The generated file must also be opened in a context where the browser interprets the content as HTML.

An attacker generally needs the ability to publish content to a channel that will later be exported, such as through a webhook, bot, or permitted Discord account. Direct access to the exporter's host is not necessarily required.

Treat Discord messages and embed fields as untrusted data and apply HTML entity encoding or automatic template escaping before insertion into generated HTML.

Use safe-by-default output encoding, test every rendering path and configuration branch, restrict intentionally supported markup, and include static analysis and code review checks for untrusted data flowing into HTML sinks.

Find out what's already
exploitable in your codebase.