Summary
The Trix editor, versions prior to 2.1.1, is vulnerable to arbitrary code execution when copying and pasting content from the web or other documents with markup into the editor. The vulnerability stems from improper sanitization of pasted content, allowing an attacker to embed malicious scripts which are executed within the context of the application.
Vulnerable Versions:
- 1.x series up to and including 1.3.1
- 2.x series up to and including 2.1.0
Fixed Versions:
- v1.3.2
- v2.1.1
Vector:
- Bug 1: When copying content manipulated by a script, such as:
document.addEventListener('copy', function(e){
e.clipboardData.setData('text/html', '<div><noscript><div class="123</noscript>456<img src=1 onerror=alert(1)//"></div></noscript></div>');
e.preventDefault();
});
and pasting into the Trix editor, the script within the content is executed.
- Bug 2: Similar execution occurs with content structured as:
document.write(`copy<div data-trix-attachment="{"contentType":"text/html","content":"<img src=1 onerror=alert(101)>HELLO123"}"></div>me`);
References:
Credit: These issues were reported by security researchers loknop and pinpie.
Impact
An attacker could exploit these vulnerabilities to execute arbitrary JavaScript code within the context of the user's session, potentially leading to unauthorized actions being performed or sensitive information being disclosed.
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
CVE-2024-34341 has a CVSS score of 5.4 (Medium). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.1.1, 1.3.2, 7.0.8.3, 7.1.3.3); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Update Recommendation: Users should upgrade to Trix editor version 2.1.1 or later, which incorporates proper sanitization of input from copied content.
CSP Enhancement: Additionally, enhancing the Content Security Policy (CSP) to disallow inline scripts can significantly mitigate the risk of such vulnerabilities. Set CSP policies such as script-src 'self' to ensure that only scripts hosted on the same origin are executed, and explicitly prohibit inline scripts using script-src-elem.
Frequently Asked Questions
- What is CVE-2024-34341? CVE-2024-34341 is a medium-severity cross-site scripting (XSS) vulnerability in trix (npm), affecting versions >= 2.0.0, < 2.1.1. It is fixed in 2.1.1, 1.3.2, 7.0.8.3, 7.1.3.3. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- How severe is CVE-2024-34341? CVE-2024-34341 has a CVSS score of 5.4 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2024-34341?
trix(npm) (versions >= 2.0.0, < 2.1.1)actiontext(rubygems) (versions >= 7.0.0.alpha1, < 7.0.8.3)
- Is there a fix for CVE-2024-34341? Yes. CVE-2024-34341 is fixed in 2.1.1, 1.3.2, 7.0.8.3, 7.1.3.3. Upgrade to this version or later.
- Is CVE-2024-34341 exploitable, and should I be worried? Whether CVE-2024-34341 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-34341 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-34341?
- Upgrade
trixto 2.1.1 or later - Upgrade
trixto 1.3.2 or later - Upgrade
actiontextto 7.0.8.3 or later - Upgrade
actiontextto 7.1.3.3 or later
- Upgrade