CVE-2025-25299
Executive Summary
CVE-2025-25299 is a Cross-Site Scripting (XSS) vulnerability discovered in the CKEditor 5 real-time collaboration package. The flaw resides in the handling of user markers, which visually represent users' positions within a collaborative document. An attacker could inject malicious JavaScript code through these markers, leading to unauthorized code execution in the context of the editor. The vulnerability only affects installations with Real-time collaborative editing enabled and requires a very specific editor and token endpoint configuration. The issue has been patched in version 44.2.1 and above. No known workarounds exist, making upgrading the only viable mitigation.
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
CKEditor 5 is distributed as an npm package (@ckeditor/ckeditor5-real-time-collaboration). Organizations using this package in their supply chain should immediately audit their dependencies to ensure they are not using a vulnerable version (< 44.2.1). The package is widely used in web applications requiring rich-text editing capabilities, increasing the potential blast radius. A compromised editor instance could lead to data exfiltration, session hijacking, or further lateral movement within the application.
CVSS Breakdown & Threat Level
The CVSS score is listed as 0.0 in the NVD data, which is likely a placeholder. Based on the vulnerability description, a reasonable assessment would be:
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): High (H) – Requires a very specific editor and token endpoint configuration.
- Privileges Required (PR): None (N) – No authentication required to trigger the XSS.
- User Interaction (UI): Required (R) – The victim must be using the collaborative editor.
- Scope (S): Changed (C) – The XSS can impact resources beyond the editor's security context.
- Confidentiality (C): High (H) – Potential for data theft.
- Integrity (I): High (H) – Potential for data manipulation.
- Availability (A): Low (L) – Primarily affects data integrity and confidentiality.
Estimated CVSS Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:L
Estimated Score: 7.6 (High)
Deep Dive & Mechanics
The vulnerability stems from improper sanitization of user marker data within the CKEditor 5 real-time collaboration module. User markers are visual indicators (e.g., colored cursors or selection highlights) that show where other users are editing. When a user connects to a collaborative session, their marker data (including display name, color, and position) is transmitted via the token endpoint.
The flaw occurs when the editor processes marker data without adequate output encoding. An attacker can craft a malicious payload (e.g., <img src=x onerror=alert(1)>) within the marker's display name or other metadata. When the victim's editor renders this marker, the payload executes in the context of the editor's DOM, leading to XSS.
The specific configuration required includes:
- Real-time collaborative editing enabled.
- A token endpoint that does not properly validate or sanitize user-provided data.
- The editor must be configured to render markers from untrusted sources.
Vulnerable vs. Patched Code
The vulnerable code likely resides in the marker rendering logic. Below is a conceptual comparison:
Vulnerable Code (Pre-44.2.1):
// Vulnerable: Directly inserts user-provided data into DOM
function renderMarker(userData) {
const marker = document.createElement('span');
marker.innerHTML = userData.displayName; // XSS vector
marker.style.backgroundColor = userData.color;
document.body.appendChild(marker);
}
Patched Code (44.2.1+):
// Patched: Uses textContent to prevent HTML injection
function renderMarker(userData) {
const marker = document.createElement('span');
marker.textContent = userData.displayName; // Safe
marker.style.backgroundColor = sanitizeColor(userData.color); // Additional sanitization
document.body.appendChild(marker);
}
The patch replaces innerHTML with textContent and adds input validation for color values.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A CKEditor 5 instance with real-time collaboration enabled (version < 44.2.1).
- Access to the token endpoint that accepts user metadata.
- Ability to join a collaborative session.
Exploitation Steps:
- Set up a local CKEditor 5 instance with real-time collaboration (e.g., using the
@ckeditor/ckeditor5-real-time-collaborationpackage). - Configure the token endpoint to accept arbitrary user data.
- Craft a malicious payload for the display name:
<img src=x onerror=alert(document.cookie)>. - Connect to the collaborative session using the crafted payload.
- When other users view the document, the payload executes, stealing cookies or performing other actions.
Proof-of-Concept (PoC) Script:
import requests
# Target editor's token endpoint
url = "https://target.com/token"
payload = {
"displayName": "<img src=x onerror=alert('XSS')>",
"color": "#ff0000"
}
response = requests.post(url, json=payload)
print("Token obtained:", response.text)
Blue Team
Detection Steps:
- Monitor for unusual user display names containing HTML tags or JavaScript event handlers.
- Inspect network traffic for token endpoint requests with suspicious payloads.
- Review server logs for repeated XSS attempts (e.g.,
<script>,onerror,onload). - Use Content Security Policy (CSP) headers to mitigate XSS impact.
Hunting Query (Splunk):
index=web_logs sourcetype=access_combined
| search uri="/token" AND "displayName" AND ("<script" OR "onerror" OR "onload")
| table _time, clientip, uri, form_data
Indicators of Compromise (IOCs)
- Network IOCs:
- POST requests to
/tokenendpoint withdisplayNamecontaining HTML tags. - Outbound connections to attacker-controlled domains from the editor context.
- POST requests to
- File IOCs:
- CKEditor 5 package version < 44.2.1 in
package.json.
- CKEditor 5 package version < 44.2.1 in
- Behavioral IOCs:
- Unexpected JavaScript execution in the editor's DOM.
- Unauthorized cookie access or session hijacking.
Detection Engineering
YARA Rule
rule CVE_2025_25299_CKEditor_XSS {
meta:
description = "Detects CKEditor 5 real-time collaboration XSS payloads"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-25299"
strings:
$payload1 = /displayName["']?\s*[:=]\s*["'][^"']*<[^>]*onerror/
$payload2 = /displayName["']?\s*[:=]\s*["'][^"']*<script/
$payload3 = /displayName["']?\s*[:=]\s*["'][^"']*onload/
condition:
any of them
}
Sigma Rule
title: CKEditor 5 Real-Time Collaboration XSS Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to exploit CVE-2025-25299 via malicious displayName
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: '/token'
cs-uri-query|re: 'displayName.*<.*onerror|displayName.*<script|displayName.*onload'
condition: selection
falsepositives:
- Legitimate use of HTML in display names (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-25299 CKEditor XSS Attempt"; flow:to_server; content:"POST"; http_method; content:"/token"; http_uri; content:"displayName"; http_client_body; pcre:"/displayName[\x22\x27]\s*[:=]\s*[\x22\x27][^\x22\x27]*<[^>]*onerror/i"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Upgrade CKEditor 5 real-time collaboration package to version 44.2.1 or above.
- Configuration Hardening: Ensure the token endpoint validates and sanitizes all user-provided data, especially display names and colors.
- CSP Implementation: Add a Content Security Policy header to restrict script execution:
Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'; - Input Validation: Implement server-side validation to reject HTML tags in user metadata.
- Monitoring: Deploy the provided YARA, Sigma, and Suricata rules to detect exploitation attempts.
Valters IT
DevSecOps & Cyber Threat Intelligence