Skip to main content

CVE-2022-31175: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in ckeditor ckeditor5

Medium
Published: Wed Aug 03 2022 (08/03/2022, 19:05:13 UTC)
Source: CVE
Vendor/Project: ckeditor
Product: ckeditor5

Description

CKEditor 5 is a JavaScript rich text editor. A cross-site scripting vulnerability has been discovered affecting three optional CKEditor 5's packages in versions prior to 35.0.1. The vulnerability allowed to trigger a JavaScript code after fulfilling special conditions. The affected packages are `@ckeditor/ckeditor5-markdown-gfm`, `@ckeditor/ckeditor5-html-support`, and `@ckeditor/ckeditor5-html-embed`. The specific conditions are 1) Using one of the affected packages. In case of `ckeditor5-html-support` and `ckeditor5-html-embed`, additionally, it was required to use a configuration that allows unsafe markup inside the editor. 2) Destroying the editor instance and 3) Initializing the editor on an element and using an element other than `<textarea>` as a base. The root cause of the issue was a mechanism responsible for updating the source element with the markup coming from the CKEditor 5 data pipeline after destroying the editor. This vulnerability might affect a small percent of integrators that depend on dynamic editor initialization/destroy and use Markdown, General HTML Support or HTML embed features. The problem has been recognized and patched. The fix is available in version 35.0.1. There are no known workarounds for this issue.

AI-Powered Analysis

AILast updated: 06/23/2025, 01:20:54 UTC

Technical Analysis

CVE-2022-31175 is a cross-site scripting (XSS) vulnerability identified in CKEditor 5, a widely used JavaScript rich text editor. This vulnerability specifically affects three optional CKEditor 5 packages: @ckeditor/ckeditor5-markdown-gfm, @ckeditor/ckeditor5-html-support, and @ckeditor/ckeditor5-html-embed, in versions prior to 35.0.1. The root cause lies in improper neutralization of input during web page generation, classified under CWE-79. The vulnerability can be triggered under a specific set of conditions: first, the application must use one of the affected packages; for the html-support and html-embed packages, the editor must be configured to allow unsafe markup; second, the editor instance must be destroyed; and third, the editor must be initialized on an element other than a <textarea>. The issue arises from the mechanism that updates the source element with markup from the CKEditor 5 data pipeline after the editor is destroyed, which can lead to execution of arbitrary JavaScript code. This flaw is particularly relevant for integrators who rely on dynamic editor initialization and destruction and use Markdown, General HTML Support, or HTML embed features. The vulnerability has been patched in version 35.0.1, and no known workarounds exist. There are no known exploits in the wild as of the published date, and the vulnerability is rated medium severity by the vendor. The attack requires specific configuration and usage patterns, limiting its scope but still posing a risk to affected deployments.

Potential Impact

For European organizations, the impact of this vulnerability can vary depending on the extent to which CKEditor 5 with the affected packages is integrated into their web applications, especially those that allow dynamic editor lifecycle management and unsafe markup configurations. Successful exploitation could allow attackers to execute arbitrary JavaScript in the context of the affected web application, potentially leading to session hijacking, credential theft, or unauthorized actions performed on behalf of legitimate users. This can compromise confidentiality and integrity of user data and may also affect availability if exploited to inject disruptive scripts. Organizations in sectors with high reliance on web-based content management systems, such as media, education, government portals, and e-commerce, could face reputational damage and regulatory consequences under GDPR if personal data is compromised. However, the requirement for specific configurations and the absence of known exploits reduce the immediate widespread risk. Still, targeted attacks against organizations using vulnerable CKEditor 5 versions with the affected packages and configurations remain a concern.

Mitigation Recommendations

To mitigate this vulnerability, European organizations should prioritize upgrading all CKEditor 5 instances to version 35.0.1 or later, which contains the official patch. Since no workarounds exist, patching is the primary defense. Additionally, organizations should audit their use of CKEditor 5 to identify whether any of the affected packages (@ckeditor/ckeditor5-markdown-gfm, @ckeditor/ckeditor5-html-support, @ckeditor/ckeditor5-html-embed) are in use, and verify if configurations allow unsafe markup, which increases risk. Where possible, avoid using unsafe markup configurations or restrict them to trusted users only. Review and limit dynamic initialization and destruction of editor instances, especially on elements other than <textarea>, to reduce exposure. Implement Content Security Policy (CSP) headers to restrict the execution of unauthorized scripts and reduce the impact of potential XSS attacks. Conduct regular security testing, including code reviews and penetration testing focused on rich text editor components. Finally, monitor web application logs for suspicious activity related to editor usage and script execution anomalies.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-05-18T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9844c4522896dcbf3919

Added to database: 5/21/2025, 9:09:24 AM

Last enriched: 6/23/2025, 1:20:54 AM

Last updated: 7/31/2025, 9:42:49 PM

Views: 10

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats