|
| 1 | +--- |
| 2 | +layout: advisory |
| 3 | +title: 'CVE-2024-34341 (actiontext): Arbitrary Code Execution Vulnerability in Trix |
| 4 | + Editor included in ActionText' |
| 5 | +comments: false |
| 6 | +categories: |
| 7 | +- actiontext |
| 8 | +advisory: |
| 9 | + gem: actiontext |
| 10 | + cve: 2024-34341 |
| 11 | + ghsa: qjqp-xr96-cj99 |
| 12 | + url: https://github.com/advisories/GHSA-qjqp-xr96-cj99 |
| 13 | + title: Arbitrary Code Execution Vulnerability in Trix Editor included in ActionText |
| 14 | + date: 2024-05-07 |
| 15 | + description: | |
| 16 | + The ActionText gem includes a copy of the Trix rich text editor. |
| 17 | + Prior to versions 7.0.8.3 and 7.1.3.3, ActionText included a version of Trix that |
| 18 | + is vulnerable to arbitrary code execution when |
| 19 | + copying and pasting content from the web or other documents with markup into the editor. |
| 20 | + The vulnerability stems from improper sanitization of pasted content, allowing an attacker |
| 21 | + to embed malicious scripts which are executed within the context of the application. |
| 22 | +
|
| 23 | + # Vulnerable Versions: |
| 24 | + * 7.1 series older than 7.1.3.3 |
| 25 | + * 7.0 series older than 7.0.8.3 |
| 26 | + * All versions of ActionText older than 7.0 |
| 27 | +
|
| 28 | + # Fixed Versions: |
| 29 | + * 7.1.3.3 |
| 30 | + * 7.0.8.3 |
| 31 | +
|
| 32 | + # Vector: |
| 33 | +
|
| 34 | + Bug 1: When copying content manipulated by a script, such as: |
| 35 | + ```javascript |
| 36 | + document.addEventListener('copy', function(e){ |
| 37 | + e.clipboardData.setData('text/html', '<div><noscript><div class="123</noscript>456<img src=1 onerror=alert(1)//"></div></noscript></div>'); |
| 38 | + e.preventDefault(); |
| 39 | + }); |
| 40 | + ``` |
| 41 | + and pasting into the Trix editor, the script within the content is executed. |
| 42 | +
|
| 43 | + Bug 2: Similar execution occurs with content structured as: |
| 44 | +
|
| 45 | + ```javascript |
| 46 | + document.write(`copy<div data-trix-attachment="{"contentType":"text/html","content":"<img src=1 onerror=alert(101)>HELLO123"}"></div>me`); |
| 47 | + ``` |
| 48 | +
|
| 49 | + # Impact: |
| 50 | +
|
| 51 | + An attacker could exploit these vulnerabilities to execute arbitrary JavaScript code |
| 52 | + within the context of the user's session, potentially leading to unauthorized actions |
| 53 | + being performed or sensitive information being disclosed. |
| 54 | +
|
| 55 | + # Remediation: |
| 56 | +
|
| 57 | + Update Recommendation: Users of ActionText 7.0 should upgrade to ActionText version 7.0.8.3 or later. |
| 58 | + Users of ActionText 7.1 should upgrade to version 7.1.3.3 or later. |
| 59 | + These updated versions incorporate proper sanitization of input from copied content. |
| 60 | +
|
| 61 | + CSP Enhancement: Additionally, enhancing the Content Security Policy (CSP) to disallow inline scripts |
| 62 | + can significantly mitigate the risk of such vulnerabilities. |
| 63 | + Set CSP policies such as script-src 'self' to ensure that only scripts hosted on the same origin |
| 64 | + are executed, and explicitly prohibit inline scripts using script-src-elem. |
| 65 | + patched_versions: |
| 66 | + - "~> 7.0.8.3" |
| 67 | + - ">= 7.1.3.3" |
| 68 | + cvss_v3: 5.4 |
| 69 | + related: |
| 70 | + url: |
| 71 | + - https://discuss.rubyonrails.org/t/xss-vulnerabilities-in-trix-editor/85803 |
| 72 | + - https://github.com/basecamp/trix/releases/tag/v2.1.1 |
| 73 | + - https://github.com/basecamp/trix/pull/1147 |
| 74 | + - https://github.com/basecamp/trix#1149 |
| 75 | + - https://github.com/basecamp/trix#1153 |
| 76 | + - https://github.com/basecamp/trix/security/advisories/GHSA-qjqp-xr96-cj99 |
| 77 | + - https://github.com/basecamp/trix/commit/1a5c68a14d48421fc368e30026f4a7918028b7ad |
| 78 | + - https://github.com/basecamp/trix/commit/841ff19b53f349915100bca8fcb488214ff93554 |
| 79 | + - https://nvd.nist.gov/vuln/detail/CVE-2024-34341 |
| 80 | +--- |
0 commit comments