# [CVE-2024-32464] ActionText ContentAttachment’s can Contain Unsanitized HTML

Stored XSS in Rails ActionText: crafted action-text-attachment with text/html content renders unsanitized HTML in the Trix editor edit page.

- Payout: $2,600
- Severity: medium
- Program: Internet Bug Bounty
- Found by: ooooooo_q
- Disclosed: 2024-06-30
- CVE: CVE-2024-32464
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/2542806
- Library page: https://bugbountylibrary.com/r/h1%3A2542806
- Tags: area:web domain:web impact:integrity kind:bounty platform:hackerone sev:medium tech:ruby technique:regression technique:source-review vuln:xss

**Target:** Rails ActionText / Trix rich_text_area editor
**Root cause:** ActionText::Attachable::ContentAttachment accepts content-type text/html and injects its content into the Trix editor without sanitization, affecting Rails >= 7.1.0 (fixed in 7.1.3.4).
**Steps:**
1. `rails new -C -G -T text` (Rails 7.1.3.2)
2. `bin/rails g scaffold Blog title:string body:rich_text`; `bin/rails action_text:install`; `bundle install`; `bin/rails db:migrate`; `bin/rails s`
3. Open /blogs/new, grab csrf-token meta
4. POST body with `blog[body]=<action-text-attachment content-type="text/html" content="<img src=. onerror='alert(location)' />"></action-text-attachment>` (HTML-escaped content)
5. Visit /blogs/xxx/edit — XSS fires in Trix editor; show page does not fire
**How found:** Researcher suspected the ActionText attachment rendering path after PR #45739 changed attachment handling; tested content-type text/html attachments and compared show vs edit rendering, finding only the Trix edit UI executes the payload.
**Exploitation:** Attacker stores a crafted rich-text body containing an action-text-attachment with text/html content; when any user (or another editor) opens the edit page, the unsanitized HTML executes in their session, enabling cross-user XSS.
**Insight:** When a framework adds support for embedding arbitrary content-type attachments in rich text, test each content-type against every render surface (show vs edit/editor) — sanitizers often cover the display path but not the editor's JS-side rendering.

