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