GHSA-53g2-mvcc-q9x3
MEDIUMTrix: Stored XSS via HTMLParser attribute injection on paste
Blast Radius
trix💎action_text-trixReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm, RubyGems packages — download data is not available via public APIs for these ecosystems.
Description
Impact
The Trix editor, in versions prior to 2.1.18, is vulnerable to XSS when crafted HTML is pasted into the editor. The HTMLParser processed a mock attachment, a <span> carrying an empty data-trix-attachment="{}". The empty attachment object caused the element to bypass attachment handling, so its data-trix-attributes were applied to a plain string piece. The pre-2.1.18 StringPiece.fromJSON accepted the href without validation, so an attacker-supplied javascript: URI was carried into the document model and emitted verbatim into the serialized HTML, executing when the content was rendered and clicked.
This is a stored XSS in any application that accepts untrusted rich text through Trix and renders the serialized output to other users. Applications that apply server-side HTML sanitization, such as the Rails built-in sanitizer, are additionally protected because the payload is neutralized on save.
This vulnerability shares its fix with GHSA-53p3-c7vp-4mcc. Both are resolved by the StringPiece.fromJSON sanitization added in 2.1.18. This advisory covers the paste and HTMLParser entry vector, while GHSA-53p3-c7vp-4mcc covers the drag-and-drop path through the fallback Level0InputController.
Patches
Users should upgrade to Trix editor version 2.1.18 or later.
References
The vulnerability was responsibly reported by HackerOne researcher newbiefromcoma.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | trix | all versions | 2.1.18 |
| 💎RubyGems | action_text-trix | all versions | 2.1.18 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for trix. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update trix to 2.1.18 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-53g2-mvcc-q9x3 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-53g2-mvcc-q9x3 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-53g2-mvcc-q9x3. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-53g2-mvcc-q9x3 in your dependencies?
O3 detects GHSA-53g2-mvcc-q9x3 across npm, RubyGems dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.