# [CVE-2024-47888] Possible ReDoS vulnerability in plain_text_for_blockquote_node in Action Text

ReDoS in Action Text's plain_text_for_blockquote_node regex causes catastrophic backtracking on crafted blockquote text under Ruby ≤3.1, enabling DoS via to_plain_text.

- Payout: $505
- Severity: low
- Program: Internet Bug Bounty
- Found by: ooooooo_q
- Disclosed: 2024-11-28
- CVE: CVE-2024-47888
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/2792776
- Library page: https://bugbountylibrary.com/r/h1%3A2792776
- Tags: area:web domain:web impact:dos kind:bounty platform:hackerone sev:low tech:ruby technique:fuzzing technique:source-review vuln:dos

**Target:** Action Text plain_text_for_blockquote_node regex in Rails (actiontext)
**Root cause:** Regex /\A(\s*)(.+?)(\s*)\Z/m has nested quantifiers with overlapping \s* and .+? causing exponential backtracking on tab-padded input under Ruby ≤3.1's regex engine.
**Steps:**
1. Identify regex in actiontext/lib/action_text/plain_text_conversion.rb#plain_text_for_blockquote_node
2. Craft input `"\t"*N + "a" + "\t"*N + "a"` wrapped in `<blockquote>...</blockquote>`
3. Create Message with rich_text content containing the blockquote
4. Call `message.content.to_plain_text`
5. Observe runtime scaling ~O(N^2) on Ruby 3.1.4 (39s at N=100000) vs ms on Ruby 3.2+
**How found:** Used the recheck ReDoS analyzer (makenowjust-labs) to detect the vulnerable regex, then confirmed with a Benchmark script comparing Ruby 3.1.4 vs 3.2.3/3.3.0.
**Exploitation:** Attacker submits rich text content with a blockquote containing many leading/trailing tabs and a trailing 'a'; when the app calls to_plain_text (e.g. rendering previews/notifications), the regex backtracks catastrophically, tying up a worker thread for tens of seconds per request.
**Insight:** Ruby 3.2's regex engine memoization masks many ReDoS bugs — when auditing Rails/Ruby regexes, test on the oldest supported Ruby (3.1) since recheck and benchmarks on 3.2+ will show no issue.

