Stored XSS on Trix Editor version latest (2.1.16) - Sanitizer Bypass
Trix's sanitizer allows any attribute starting with data-trix-, and its serializer blindly applies attributes from a JSON string in data-trix-serialized-attributes. An attacker can smuggle an event handler past sanitisation and have it executed when the serialized HTML is rendered.
Originally disclosed on HackerOne
- Triaged in 4 days
- Fixed in 9 days
- Paid in 9 days
- Disclosed after 4 months
Trix version 2.1.16 is vulnerable to a Stored Cross-Site Scripting (XSS) flaw. The vulnerability arises from an unsafe interaction between Trix's custom DOMPurify configuration and its document serialization logic.
Trix utilizes a DOMPurify hook (src/trix/models/html_sanitizer.js) that explicitly forces the sanitizer to retain any HTML attribute beginning with data-trix-. This creates an initial bypass of DOMPurify's strict attribute filtering.
Concurrently, Trix's HTML serializer (src/trix/core/serialization.js) is responsible for converting the internal editor state back into HTML. To preserve standard attributes that are stripped during editing, Trix uses a custom attribute called data-trix-serialized-attributes, which contains a JSON string of property-value pairs. During serialization (e.g., when the form is submitted or editor.value is accessed), this JSON is parsed and the attributes are blindly set onto the element via el.setAttribute(name, value) without any further sanitization.
By embedding data-trix-serialized-attributes within the content property of a data-trix-attachment payload, an attacker can smuggle malicious JavaScript event handlers (such as onerror="alert(1)") past the initial DOMPurify pass. When the content is exported by Trix, the event handlers are injected into the final HTML output, leading to XSS when rendered by the victim application.
Steps To Reproduce
The vulnerability can be reproduced in any application using Trix and can also be demonstrated directly on the official testing environment https://trix-editor.org/.
- Run this HTML code on browser.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Trix Editor v2.1.16 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 v2.1.16 XSS Demo</h1>
<!--
The following script simulates rendering user-supplied content that contains the malicious data-trix-attachment with our serialization bypass payload.
-->
<script>
document.write(`copy<figure data-trix-attachment="{"contentType":"text/html","content":"<img src=\\"x\\" data-trix-serialized-attributes=\\"{&quot;onerror&quot;:&quot;alert('XSS IN v2.1.16')&quot;}\\">"}"></figure>me`);
</script>
<h2>Simulate Backend Save & Render</h2>
<button onclick="triggerXSS()">Trigger XSS</button>
<div id="output"></div>
<script>
function triggerXSS() {
// 1. Get the serialized HTML output that Trix generated
var output = document.querySelector("trix-editor").value;
console.log("Serialized HTML:", output);
// 2. Simulate the application rendering this saved output on another page
var div = document.getElementById("output");
div.innerHTML = output;
}
</script>
</body>
</html>
- Copy the
copy metext and paste it in trix editor. - You will immediately see an alert pop up indicating successful arbitrary JavaScript execution.
This vulnerability represents a direct bypass of the fixes applied for previously reported vulnerabilities in Trix :
- https://hackerone.com/reports/2521419 - Stored XSS on trix editor version 2.1.1
- https://hackerone.com/reports/2819573 - Mutation Based Stored XSS on trix editor version 2.1.8
Suggested Mitigation
- Remove or constrain the wildcard
data-trix-DOMPurify hook: Ensure that only explicitly defined, harmless attributes (likedata-trix-id) are retained. The regex/^data-trix-/insrc/trix/models/html_sanitizer.jsshould be replaced with an explicit allowlist. - Re-Sanitize Deserialized Attributes: In
src/trix/core/serialization.js, when elements are restored fromdata-trix-serialized-attributes,el.setAttributeshould only map to safe attributes (class,src,href) and explicitly deny JavaScript event handlers (on*). Attempting to filter this via DOMPurify before rebuilding the DOM is highly recommended.
Impact
Any application that utilizes Trix to accept untrusted rich text input and renders the serialized output to other users is vulnerable to Stored Cross-Site Scripting (XSS). An attacker can successfully leverage this to steal session cookies, hijack user accounts, redirect victims to malicious sites, or perform actions on behalf of the user without their consent.
Attachments
Context
Trix is a rich text editor that Basecamp ships as a standalone library and uses in its own products. It keeps an internal document model and converts between that model and HTML in both directions: incoming HTML is sanitised with DOMPurify before it enters the editor, and the editor state is serialised back to HTML when the form is submitted or when editor.value is read.
The report targets Trix version 2.1.16. and the affected asset is app.basecamp.com. The bug is a stored cross-site scripting flaw that arises from the interaction between two pieces of Trix code: a custom DOMPurify hook in src/trix/models/html_sanitizer.js and the serialiser in src/trix/core/serialization.js. The researcher also demonstrated it on the official testing environment at https://trix-editor.org/.
Setup
No account, role or special tooling is needed. The reproduction is a single HTML page that loads the Trix distribution from a CDN:
https://cdn.jsdelivr.net/npm/[redacted]/dist/trix.umd.min.jshttps://cdn.jsdelivr.net/npm/[redacted]/dist/trix.min.css
The precondition is an application that accepts untrusted rich text through Trix and later renders the serialised output to other users. The report notes the flaw can be reproduced in any application using Trix.
Finding it
Two design decisions in Trix combine badly.
First, the DOMPurify hook in src/trix/models/html_sanitizer.js explicitly forces the sanitiser to retain any HTML attribute whose name begins with data-trix-. That is a deliberate widening of DOMPurify's strict attribute filtering, and on its own it lets data-trix- attributes survive the sanitiser pass.
Second, the serialiser in src/trix/core/serialization.js converts the internal editor state back into HTML. To preserve standard attributes that would otherwise be stripped during editing, Trix uses a custom attribute called data-trix-serialized-attributes, which holds a JSON string of property-value pairs. During serialisation, for example when the form is submitted or editor.value is accessed, that JSON is parsed and the attributes are set onto the element with el.setAttribute(name, value) without any further sanitisation.
The second mechanism can be reached through the first. By embedding data-trix-serialized-attributes inside the content property of a data-trix-attachment payload, malicious JavaScript event handlers such as onerror="alert(1)" can be smuggled past the initial DOMPurify pass. When Trix exports the content, the event handlers are injected into the final HTML output, and the XSS fires when the victim application renders it.
Exploitation
Step 1: Serve the demo page
The researcher ran the following HTML in a browser. It loads Trix 2.1.16 and writes a figure element containing a data-trix-attachment payload into the document, simulating user-supplied content that has been stored and is being rendered.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Trix Editor v2.1.16 XSS Demo</title>
<script src="https://cdn.jsdelivr.net/npm/[redacted]/dist/trix.umd.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[redacted]/dist/trix.min.css" rel="stylesheet">
</head>
<body>
<h1>Trix Editor v2.1.16 XSS Demo</h1>
<!--
The following script simulates rendering user-supplied content that contains the malicious data-trix-attachment with our serialization bypass payload.
-->
<script>
document.write(`copy<figure data-trix-attachment="{"contentType":"text/html","content":"<img src=\\"x\\" data-trix-serialized-attributes=\\"{&quot;onerror&quot;:&quot;alert('XSS IN v2.1.16')&quot;}\\">"}"></figure>me`);
</script>
<h2>Simulate Backend Save & Render</h2>
<button onclick="triggerXSS()">Trigger XSS</button>
<div id="output"></div>
<script>
function triggerXSS() {
// 1. Get the serialized HTML output that Trix generated
var output = document.querySelector("trix-editor").value;
console.log("Serialized HTML:", output);
// 2. Simulate the application rendering this saved output on another page
var div = document.getElementById("output");
div.innerHTML = output;
}
</script>
</body>
</html>
The important part is the data-trix-attachment attribute. Its JSON has contentType set to text/html and a content string containing an img element whose src is x and which carries a data-trix-serialized-attributes attribute. That inner attribute holds JSON mapping onerror to alert('XSS IN v2.1.16'). The surrounding text copy and me is what the user is meant to select in the next step. The page also defines triggerXSS(), which reads document.querySelector("trix-editor").value, logs the serialised HTML, and assigns it to a div's innerHTML to simulate the application rendering the saved output on another page.
Step 2: Paste the text into the editor
The researcher copied the copy me text from the rendered page and pasted it into the Trix editor.
Step 3: Observe execution
An alert popped up immediately, indicating successful arbitrary JavaScript execution.
The report includes an attachment named Basecamp_trix_xss.mp4.
Relationship to earlier fixes
The report describes this as a direct bypass of the fixes applied for two previously reported Trix vulnerabilities:
https://hackerone.com/reports/2521419, stored XSS on Trix editor version 2.1.1https://hackerone.com/reports/2819573, mutation-based stored XSS on Trix editor version 2.1.8
Root cause
The mistake is the combination of an over-broad sanitiser allowlist and an unsanitised deserialisation step.
The DOMPurify hook keeps every attribute starting with data-trix-, so data-trix-serialized-attributes survives sanitisation even though it is a control attribute that Trix later interprets as instructions. The serialiser then parses the JSON in that attribute and applies each key with el.setAttribute(name, value) without checking what the name is. Nothing in that path restricts the names to safe attributes, so an on* event handler is written straight onto the element. DOMPurify does not get a second look at the result, because the attributes are added after the sanitiser has run, during serialisation.
In other words, the sanitiser treats the serialisation attribute as inert data, while the serialiser treats it as trusted instructions. The gap between those two views is the vulnerability.
Impact
Any application that uses Trix to accept untrusted rich text input and renders the serialised output to other users is vulnerable to stored cross-site scripting. The report lists what an attacker can do with it: steal session cookies, hijack user accounts, redirect victims to malicious sites, or perform actions on behalf of the user without their consent.
Fix
The report proposes two mitigations.
- Remove or constrain the wildcard
data-trix-DOMPurify hook. Only explicitly defined, harmless attributes such asdata-trix-idshould be retained. The regex/^data-trix-/insrc/trix/models/html_sanitizer.jsshould be replaced with an explicit allowlist. - Re-sanitise deserialised attributes. In
src/trix/core/serialization.js, when elements are restored fromdata-trix-serialized-attributes,el.setAttributeshould only map to safe attributes (class,src,href) and explicitly deny JavaScript event handlers (on*). The report also recommends attempting to filter this via DOMPurify before rebuilding the DOM.
Variants to test
- Other
data-trix-control attributes. The hook keeps every attribute with that prefix, so any other attribute Trix reads as instructions is worth checking for the same trust gap. A positive result is a payload that survives sanitisation and changes behaviour when the editor serialises. - Other serialisation sinks. Look for any place where Trix parses stored JSON and applies it to the DOM, not only
data-trix-serialized-attributes. A positive result is an attribute or property that reaches the DOM without a second sanitiser pass. - Attribute names outside
on*. The suggested fix namesclass,srcandhrefas safe, but other attributes can also carry script or navigation, such assrcon elements that execute it. A positive result is a non-on*attribute that produces execution or navigation when the serialised output is rendered. - Attachment content types. The payload uses
contentTypeoftext/html. Trying other content types with embedded markup is a reasonable next step. A positive result is markup that is preserved through the attachment path and rendered by the host application. - Host applications that render
editor.valuedirectly. The demo simulates this withinnerHTML. Any application that stores the serialised output and later inserts it into the page without its own sanitiser is a candidate. A positive result is execution on the page that displays the stored content, not only in the editor.
Hunting notes
This class of bug hides in the seam between two components that each look safe on their own: a sanitiser with a widened allowlist, and a serialiser that trusts data the sanitiser let through. During recon, rich text editors and their sanitiser configurations are worth reading closely, especially custom DOMPurify hooks, allowlist regexes and any code that calls setAttribute with names taken from parsed data.
The report shows impact by taking the serialised output that Trix produces and rendering it the way a host application would, which is what turns an editor quirk into stored XSS against other users. The report ties it explicitly to two earlier Trix XSS fixes, which is a useful signal: when a library has patched XSS before, the patched areas and the mechanisms around them are where the next bypass tends to be.
What happened, in plain words
Trix is a rich text editor: the box you type formatted text into, with bold, links, images and so on. Basecamp publishes it as a standalone library that any website can drop in, and Basecamp's own products use it too. The researcher found that in Trix version 2.1.16, a specially crafted piece of content could slip a small piece of JavaScript past the editor's defences and end up running in another user's browser. That is called stored cross-site scripting, or stored XSS: the bad content is saved once and then executed for whoever views it later.
The affected asset named in the report is app.basecamp.com, and the researcher also showed the problem on Trix's official testing page at https://trix-editor.org/.
The bug lives in the gap between two parts of Trix that each look reasonable on their own: the part that cleans incoming HTML (the sanitiser) and the part that turns the editor's contents back into HTML (the serialiser). The sanitiser lets a particular kind of attribute through because it trusts it as harmless data. The serialiser later reads that same attribute as instructions and follows them. Neither part is wrong in isolation; together they let an attacker write JavaScript onto the page.
Background you need first
A few ideas come up again and again, so here they are from zero.
HTML and attributes. A web page is written in HTML. Elements look like <img src="x">: the element is img, and src="x" is an attribute, a named setting on that element. Some attributes are instructions to the browser rather than descriptions. Attributes whose names start with on, such as onerror or onclick, hold JavaScript that the browser runs when the matching event happens. onerror on an image runs if the image fails to load.
JavaScript. The programming language browsers run. If an attacker can get their own JavaScript into a page other people view, it runs with the same rights as the site's own code.
Cross-site scripting (XSS). The vulnerability class where an attacker gets their JavaScript into a page that other users load. "Stored" means the malicious content is saved on the server (in a comment, a document, a profile) and served to victims later, rather than being reflected back in a single response.
Sanitiser. A filter that takes untrusted HTML and removes anything dangerous before it is used. Trix uses a well-known library called DOMPurify for this. Think of it as a security guard at the door checking every item coming in.
DOMPurify hook. DOMPurify lets the application register a hook, a small piece of custom code that adjusts the guard's decisions. Trix uses a hook to say "keep every attribute whose name starts with data-trix-", because Trix needs those attributes for its own bookkeeping.
Serialisation. Turning a program's internal data back into text, here HTML. When you submit a form containing a Trix editor, or read editor.value, Trix serialises its internal document into an HTML string that the server can store.
JSON. A simple text format for structured data, like {"name": "value"}. It is just text until something parses it, that is, reads it and acts on it.
CDN. A content delivery network, a service that hosts files such as JavaScript libraries so any page can load them with a URL. The demo loads Trix from jsDelivr.
DOM and innerHTML. The DOM is the browser's live model of the page. Setting an element's innerHTML replaces its contents with a string of HTML, and the browser builds and runs whatever that HTML contains. That is exactly what a web application does when it displays saved content.
Cookie and session. A cookie is a small piece of data the browser stores for a site and sends back with every request. Sites commonly keep a session cookie there to recognise you as logged in. If someone steals it, they can act as you.
Setup
No account, role or special tool is needed. The whole reproduction is one HTML file that loads the Trix library and stylesheet from a CDN:
https://cdn.jsdelivr.net/npm/[redacted]/dist/trix.umd.min.jshttps://cdn.jsdelivr.net/npm/[redacted]/dist/trix.min.css
The only precondition is a real application that accepts untrusted rich text through Trix and later shows the serialised output to other users. The report notes the flaw can be reproduced in any application using Trix.
Finding it
Two design decisions in Trix combine badly.
First, the DOMPurify hook in src/trix/models/html_sanitizer.js explicitly forces the sanitiser to keep any HTML attribute whose name begins with data-trix-. That is a deliberate widening of DOMPurify's normally strict attribute filtering. On its own it just means data-trix- attributes survive the guard.
Second, the serialiser in src/trix/core/serialization.js converts the editor's internal state back into HTML. To preserve standard attributes that would otherwise be lost during editing, Trix uses a custom attribute called data-trix-serialized-attributes, which holds a JSON string of property-value pairs. During serialisation, for example when the form is submitted or editor.value is read, that JSON is parsed and the attributes are set onto the element with el.setAttribute(name, value), with no further sanitisation.
The second mechanism can be reached through the first. By embedding data-trix-serialized-attributes inside the content property of a data-trix-attachment payload, malicious JavaScript event handlers such as onerror="alert(1)" can be smuggled past the initial DOMPurify pass. When Trix exports the content, the event handlers are injected into the final HTML output, and the XSS fires when the victim application renders it.
Exploitation
Step 1: Serve the demo page
The researcher ran the following HTML in a browser. It loads Trix 2.1.16 and writes a figure element containing a data-trix-attachment payload into the document, simulating user-supplied content that has been stored and is now being rendered.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Trix Editor v2.1.16 XSS Demo</title>
<script src="https://cdn.jsdelivr.net/npm/[redacted]/dist/trix.umd.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[redacted]/dist/trix.min.css" rel="stylesheet">
</head>
<body>
<h1>Trix Editor v2.1.16 XSS Demo</h1>
<!--
The following script simulates rendering user-supplied content that contains the malicious data-trix-attachment with our serialization bypass payload.
-->
<script>
document.write(`copy<figure data-trix-attachment="{"contentType":"text/html","content":"<img src=\\"x\\" data-trix-serialized-attributes=\\"{&quot;onerror&quot;:&quot;alert('XSS IN v2.1.16')&quot;}\\">"}"></figure>me`);
</script>
<h2>Simulate Backend Save & Render</h2>
<button onclick="triggerXSS()">Trigger XSS</button>
<div id="output"></div>
<script>
function triggerXSS() {
// 1. Get the serialized HTML output that Trix generated
var output = document.querySelector("trix-editor").value;
console.log("Serialized HTML:", output);
// 2. Simulate the application rendering this saved output on another page
var div = document.getElementById("output");
div.innerHTML = output;
}
</script>
</body>
</html>
Line by line, in plain words:
<!DOCTYPE html>and the<html>,<head>,<body>tags are the standard skeleton of any web page.<meta charset="UTF-8">tells the browser the page uses the UTF-8 character encoding, so text displays correctly.<title>sets the text shown in the browser tab.- The first
<script src="...trix.umd.min.js">loads the Trix library itself from the CDN. Without it there is no editor and no bug. - The
<link href="...trix.min.css">loads Trix's stylesheet so the editor looks right. <h1>is a large heading, just a label for the demo page.- The HTML comment between
<!--and-->is a note for humans; the browser ignores it. It explains that the next script pretends to display content a user supplied earlier. document.write(...)inserts the string inside the backticks directly into the page as it loads. That string is the payload.- Inside the string,
copyandmeare ordinary text with a<figure>element between them. The figure carries one attribute,data-trix-attachment, whose value is JSON. Because the JSON sits inside an HTML attribute, its quotes are written as"(the HTML code for a double quote) so they do not end the attribute early. - The JSON has two fields.
contentTypeistext/html, telling Trix the attachment contains HTML.contentis a string holding an<img>element whosesrcisxand which carries adata-trix-serialized-attributesattribute. That inner attribute holds more JSON, this time mappingonerrortoalert('XSS IN v2.1.16'). The extra backslashes and&quot;are layers of escaping needed to nest JSON inside JSON inside HTML. - The
<h2>and the<button onclick="triggerXSS()">give you a button that calls the function defined further down when clicked. <div id="output"></div>is an empty box with the nameoutput, where the simulated page will display the saved content.function triggerXSS() { ... }defines that function. Its first line,var output = document.querySelector("trix-editor").value;, finds the Trix editor on the page and reads itsvalue, which is the serialised HTML Trix produces. This is the moment the serialiser runs.console.log("Serialized HTML:", output);prints that HTML to the browser's developer console so you can inspect it.var div = document.getElementById("output");finds the empty box.div.innerHTML = output;puts the serialised HTML into the box. The browser builds whatever elements that HTML describes, which is how a real application would show the saved content to another user.
The important part is the data-trix-attachment attribute. Its JSON has contentType set to text/html and a content string containing an img element whose src is x and which carries a data-trix-serialized-attributes attribute. That inner attribute holds JSON mapping onerror to alert('XSS IN v2.1.16'). The surrounding text copy and me is what the user is meant to select in the next step. The page also defines triggerXSS(), which reads document.querySelector("trix-editor").value, logs the serialised HTML, and assigns it to a div's innerHTML to simulate the application rendering the saved output on another page.
Step 2: Paste the text into the editor
The researcher copied the copy me text from the rendered page and pasted it into the Trix editor.
Step 3: Observe execution
An alert popped up immediately, indicating successful arbitrary JavaScript execution. In other words, the guard at the door let the attribute through as harmless data, and the serialiser later turned it into a live instruction.
The report includes an attachment named Basecamp_trix_xss.mp4.
Relationship to earlier fixes
The report describes this as a direct bypass of the fixes applied for two previously reported Trix vulnerabilities:
https://hackerone.com/reports/2521419, stored XSS on Trix editor version 2.1.1https://hackerone.com/reports/2819573, mutation-based stored XSS on Trix editor version 2.1.8
A bypass here means the earlier patches closed the specific holes that were reported, but the underlying mechanisms around them could still be combined in a new way.
Root cause
The mistake is the combination of an over-broad sanitiser allowlist and an unsanitised deserialisation step.
The DOMPurify hook keeps every attribute starting with data-trix-, so data-trix-serialized-attributes survives sanitisation even though it is a control attribute that Trix later interprets as instructions. The serialiser then parses the JSON in that attribute and applies each key with el.setAttribute(name, value) without checking what the name is. Nothing in that path restricts the names to safe attributes, so an on* event handler is written straight onto the element. DOMPurify does not get a second look at the result, because the attributes are added after the sanitiser has run, during serialisation.
In other words, the sanitiser treats the serialisation attribute as inert data, while the serialiser treats it as trusted instructions. The gap between those two views is the vulnerability. A useful comparison: a mailroom clerk stamps a parcel "harmless paperwork" and passes it on, and the next department reads the paperwork as an order to do something. Each department followed its own rules; the problem is that they disagreed about what the parcel meant.
Impact
Any application that uses Trix to accept untrusted rich text input and renders the serialised output to other users is vulnerable to stored cross-site scripting. The report lists what an attacker can do with it: steal session cookies, hijack user accounts, redirect victims to malicious sites, or perform actions on behalf of the user without their consent.
Fix
The report proposes two mitigations.
- Remove or constrain the wildcard
data-trix-DOMPurify hook. Only explicitly defined, harmless attributes such asdata-trix-idshould be retained. The regex/^data-trix-/insrc/trix/models/html_sanitizer.jsshould be replaced with an explicit allowlist. In plain terms: instead of saying "keep anything starting withdata-trix-", list the exact names that are safe and keep only those. - Re-sanitise deserialised attributes. In
src/trix/core/serialization.js, when elements are restored fromdata-trix-serialized-attributes,el.setAttributeshould only map to safe attributes (class,src,href) and explicitly deny JavaScript event handlers (on*). The report also recommends attempting to filter this via DOMPurify before rebuilding the DOM.
Variants to test
These are directions for further testing, each with what a positive result would look like.
- Other
data-trix-control attributes. The hook keeps every attribute with that prefix, so any other attribute Trix reads as instructions is worth checking for the same trust gap. A positive result is a payload that survives sanitisation and changes behaviour when the editor serialises. - Other serialisation sinks. Look for any place where Trix parses stored JSON and applies it to the DOM, not only
data-trix-serialized-attributes. A positive result is an attribute or property that reaches the DOM without a second sanitiser pass. - Attribute names outside
on*. The suggested fix namesclass,srcandhrefas safe, but other attributes can also carry script or navigation, such assrcon elements that execute it. A positive result is a non-on*attribute that produces execution or navigation when the serialised output is rendered. - Attachment content types. The payload uses
contentTypeoftext/html. Trying other content types with embedded markup is a reasonable next step. A positive result is markup that is preserved through the attachment path and rendered by the host application. - Host applications that render
editor.valuedirectly. The demo simulates this withinnerHTML. Any application that stores the serialised output and later inserts it into the page without its own sanitiser is a candidate. A positive result is execution on the page that displays the stored content, not only in the editor.
Hunting notes
This class of bug hides in the seam between two components that each look safe on their own: a sanitiser with a widened allowlist, and a serialiser that trusts data the sanitiser let through. During recon, rich text editors and their sanitiser configurations are worth reading closely, especially custom DOMPurify hooks, allowlist regexes and any code that calls setAttribute with names taken from parsed data.
The report shows impact by taking the serialised output that Trix produces and rendering it the way a host application would, which is what turns an editor quirk into stored XSS against other users. The program accepted it as a low-severity stored XSS with a bounty, and the report ties it explicitly to two earlier Trix XSS fixes, which is a useful signal: when a library has patched XSS before, the patched areas and the mechanisms around them are where the next bypass tends to be.
Glossary
- Allowlist: a list of things that are explicitly permitted, with everything else refused.
- Attribute: a named setting on an HTML element, such as
srcon an image. - Bounty: money a bug bounty program pays for a valid report.
- Bypass: getting past a protection that was meant to stop you.
- CDN (content delivery network): a service that hosts files such as JavaScript libraries so pages can load them by URL.
- Cookie: a small piece of data a site stores in your browser and receives back with each request, often used to keep you logged in.
- Cross-site scripting (XSS): a vulnerability where an attacker gets their JavaScript to run in another user's browser on a site they trust.
- CVSS: a standard scoring system for rating the severity of a vulnerability.
- Deserialisation: reading stored text (such as JSON) back into live data or objects that the program then acts on.
- DOM: the browser's live model of the page, which scripts can read and change.
- DOMPurify: a widely used JavaScript library that removes dangerous content from untrusted HTML.
- Event handler: an attribute such as
onerrororonclickwhose value is JavaScript the browser runs when that event happens. - Hook: custom code registered with a library so it changes that library's default behaviour.
- HTML: the language web pages are written in, made of elements and attributes.
innerHTML: a property that replaces an element's contents with a string of HTML, which the browser then builds and runs.- JavaScript: the programming language browsers execute.
- JSON: a text format for structured data made of names and values.
- Regex (regular expression): a pattern used to match text, such as
/^data-trix-/matching any string that starts withdata-trix-. - Sanitiser: a filter that strips dangerous parts out of untrusted HTML before it is used.
- Session: the state that lets a site remember you are logged in across requests, usually tied to a cookie.
- Sink: a place in code where data ends up being executed or rendered, such as
innerHTMLorsetAttribute. - Stored XSS: XSS where the malicious content is saved on the server and served to victims later.
- Trix: a rich text editor published by Basecamp as a standalone library.
- Wildcard: a pattern that matches many things rather than one specific thing, such as a prefix match.