/

CVE-2026-59167

Severity:

CRITICAL RISK

(10.0)

Stored XSS (CWE-79) in SunEditor Content Sanitizer

CVE-2026-59167

Awaiting Analysis

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting

Severity:

CRITICAL RISK

(10.0)

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

SunEditor versions before 2.47.11 may fail to remove event-handler attributes from crafted namespaced or custom HTML elements. When attacker-controlled content is stored and later rendered, user interaction with such an element may execute script in the application's browser origin, potentially exposing data or performing unauthorized actions.

Affected context

The issue can occur in applications that use SunEditor to accept, store, and render HTML content from users or other untrusted sources. It becomes risky when the sanitizer processes custom or namespaced elements inconsistently, allowing event-handler attributes to survive until the content is displayed and interacted with in a user's browser.

Exploit preconditions

  • Attack surface: SunEditor's HTML content sanitization and rendering path
  • Required access: Ability to submit or influence content that the application stores through the editor
  • Trigger point: A victim renders the stored content and interacts with the crafted element
  • Why exploitation is possible: The sanitizer may retain event-handler attributes on namespaced or custom elements, allowing browser script execution in the application's origin

Why this happens

The underlying flaw is incomplete sanitization of attacker-controlled HTML. The parser's filtering logic does not consistently apply the same safety rules to namespaced or custom elements, so event-handler attributes can remain attached to elements that are later rendered by the browser. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because untrusted markup is insufficiently neutralized before being placed into an executable browser context.

Potential impact

  • Stored script execution in a victim's browser session
  • Exposure of application data accessible to the browser origin
  • Unauthorized actions performed using the victim's authenticated context
  • Account or session compromise in applications with permissive browser-side access
  • Defacement or manipulation of rendered editor content

General mitigation guidance

Mitigation generally focuses on making HTML sanitization complete, consistent, and restrictive across all element namespaces and custom-element forms.

Common defensive patterns include:

  • Allowing only explicitly approved elements, attributes, and URL schemes
  • Removing all event-handler attributes and other executable content by default
  • Applying sanitization immediately before rendering, not only during content submission
  • Treating stored editor content as untrusted even after prior validation
  • Using context-appropriate output encoding and a restrictive Content Security Policy
  • Limiting browser-side privileges and preventing sensitive actions from relying solely on client-rendered content

How teams detect issues like this

Organizations can identify related risks through:

  • Static analysis rules for incomplete HTML sanitization and unsafe rendering APIs
  • Code review checks covering custom elements, namespace handling, and event attributes
  • Test suites containing adversarial markup variants and browser interaction cases
  • Dynamic scanning of stored-content workflows for script execution
  • Policy enforcement requiring approved sanitizers and blocking inline event handlers

Automated security review tools may help flag unsafe DOM sinks, incomplete allowlists, and sanitizer configurations that do not cover nonstandard element forms.

Sources

SourceLink
github.comgithub.com/JiHong88/suneditor/commit/a94ace269c7102bfb6de58a27a6547bc4eb09045
github.comgithub.com/JiHong88/suneditor/issues/1646
github.comgithub.com/JiHong88/suneditor/releases/tag/2.47.11
github.comgithub.com/JiHong88/suneditor/security/advisories/GHSA-6rf4-v2fh-m6p4

Frequently asked

questions

It can be exploitable through an application's content submission workflow when an attacker can store crafted editor content and a victim later views or interacts with it.

Authentication requirements depend on the application. An attacker generally needs whatever access is required to submit or modify stored editor content, while the victim must render the affected content.

Use a consistently restrictive HTML sanitizer that removes event-handler attributes and rejects unsafe custom or namespaced elements before content is stored or rendered.

Treat editor output as untrusted, enforce allowlists for elements and attributes, test unusual markup forms, use contextual output protections, and apply a restrictive Content Security Policy.

Find out what's already
exploitable in your codebase.