CVE-2024-29881 Overview
A cross-site scripting (XSS) vulnerability has been discovered in TinyMCE, a widely used open source rich text editor. The vulnerability exists in TinyMCE's content loading and content inserting code, where SVG images loaded through object or embed elements can potentially contain malicious XSS payloads. This flaw allows attackers to execute arbitrary JavaScript code in the context of a victim's browser session when they interact with content containing specially crafted SVG images.
Critical Impact
Successful exploitation enables attackers to execute arbitrary JavaScript in user browsers, potentially leading to session hijacking, credential theft, or unauthorized actions on behalf of authenticated users in applications utilizing TinyMCE.
Affected Products
- TinyMCE versions prior to 6.8.1
- TinyMCE versions prior to 7.0.0
- Applications integrating vulnerable TinyMCE versions
Discovery Timeline
- 2024-03-26 - CVE CVE-2024-29881 published to NVD
- 2025-09-02 - Last updated in NVD database
Technical Details for CVE-2024-29881
Vulnerability Analysis
The vulnerability stems from insufficient sanitization of SVG content when loaded via object or embed HTML elements within the TinyMCE editor. SVG files are XML-based vector graphics that can contain embedded JavaScript through various mechanisms including <script> tags, event handlers (such as onload, onclick), and other scripting constructs. When TinyMCE processes content containing these elements, it fails to properly validate or sanitize the SVG payload, allowing malicious scripts to execute in the user's browser context.
This vulnerability can be exploited through user-initiated interactions where an attacker crafts malicious content containing an object or embed element pointing to a specially crafted SVG file. The attack requires user interaction—specifically, a user must be presented with or interact with the malicious content within a TinyMCE instance.
Root Cause
The root cause of this vulnerability is the lack of conversion or sanitization of potentially unsafe object and embed elements to safer alternatives. TinyMCE did not have adequate controls to prevent the loading of arbitrary content through these elements, which can execute scripts when pointing to SVG resources containing JavaScript payloads.
Attack Vector
The attack is network-based and requires user interaction. An attacker can craft malicious content containing an object or embed element that references an SVG file with embedded XSS payloads. When this content is loaded or inserted into a TinyMCE editor instance, and subsequently viewed by a victim, the malicious JavaScript executes in the victim's browser context. This can lead to:
- Session token theft and session hijacking
- Credential harvesting through fake login forms
- Defacement of web content
- Propagation of malicious content to other users
// Security patch adding convert_unsafe_embeds option
// Source: https://github.com/tinymce/tinymce/commit/bcdea2ad14e3c2cea40743fb48c63bba067ae6d1
contextmenu?: string | string[] | false;
contextmenu_never_use_native?: boolean;
convert_fonts_to_spans?: boolean;
+ convert_unsafe_embeds?: boolean;
convert_urls?: boolean;
custom_colors?: boolean;
custom_elements?: string;
// Security patch implementing sandbox_iframes and convert_unsafe_embeds options
// Source: https://github.com/tinymce/tinymce/commit/bcdea2ad14e3c2cea40743fb48c63bba067ae6d1
default: 'off',
});
+ registerOption('sandbox_iframes', {
+ processor: 'boolean',
+ default: false
+ });
+
+ registerOption('convert_unsafe_embeds', {
+ processor: 'boolean',
+ default: false
+ });
+
// These options must be registered later in the init sequence due to their default values
editor.on('ScriptsLoaded', () => {
registerOption('directionality', {
Detection Methods for CVE-2024-29881
Indicators of Compromise
- Presence of object or embed elements with SVG MIME types in user-submitted content
- SVG files containing <script> tags, event handlers, or javascript: URIs in content
- Unexpected JavaScript execution originating from embedded SVG resources
- Web application logs showing suspicious content submissions with embedded object/embed elements
Detection Strategies
- Implement content security policy (CSP) monitoring to detect inline script execution attempts
- Deploy web application firewall (WAF) rules to identify object and embed elements containing SVG references in user input
- Review TinyMCE configuration to verify convert_unsafe_embeds option status
- Scan stored content for potentially malicious object or embed elements referencing SVG files
Monitoring Recommendations
- Enable detailed logging for TinyMCE content submissions and modifications
- Monitor for CSP violations that may indicate XSS exploitation attempts
- Track client-side errors and anomalous JavaScript execution patterns
- Implement alerting for detection of SVG files with embedded scripting content in user uploads
How to Mitigate CVE-2024-29881
Immediate Actions Required
- Upgrade TinyMCE to version 6.8.1 or later (for 6.x branch) or version 7.0.0 or later
- Enable the convert_unsafe_embeds option in TinyMCE configuration if running version 6.8.1
- Review and sanitize existing content for potentially malicious object or embed elements
- Implement Content Security Policy (CSP) headers to mitigate XSS impact
Patch Information
The vulnerability is fixed in TinyMCE versions 6.8.1 and 7.0.0. The patch introduces a new convert_unsafe_embeds editor option that controls whether object and embed elements will be converted to more restrictive alternatives. In version 6.8.1, this option defaults to false for backward compatibility, while in version 7.0.0 and later, it defaults to true for enhanced security.
For detailed patch information, refer to the GitHub Security Advisory GHSA-5359 and the security commit.
Workarounds
- Enable convert_unsafe_embeds: true in TinyMCE initialization configuration to convert unsafe embed elements to safer alternatives
- Configure Content Security Policy headers to restrict inline script execution and object/embed sources
- Implement server-side content filtering to strip object and embed elements from user-submitted content
- Use the sandbox_iframes option in conjunction with convert_unsafe_embeds for additional protection
// TinyMCE secure configuration example
tinymce.init({
selector: '#editor',
// Enable conversion of unsafe embeds (default true in 7.0+)
convert_unsafe_embeds: true,
// Enable iframe sandboxing for additional protection
sandbox_iframes: true,
// Additional security options
extended_valid_elements: '',
invalid_elements: 'script,object,embed'
});
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


