Skip to main content
Vulnerability Database/CVE-2024-47888

CVE-2024-47888: Rails Action Text ReDoS DoS Vulnerability

CVE-2024-47888 is a ReDoS denial of service vulnerability in Rails Action Text affecting the plain_text_for_blockquote_node helper. This post covers technical details, affected versions, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-47888 Overview

CVE-2024-47888 is a Regular Expression Denial of Service (ReDoS) vulnerability in Rails Action Text. The flaw resides in the plain_text_for_blockquote_node helper, where a crafted input string causes catastrophic backtracking in the regular expression /\A(\s*)(.+?)(\s*)\Z/m. An unauthenticated attacker can submit specially shaped rich text content to force excessive CPU consumption, degrading application availability. The issue affects Action Text starting at version 6.0.0 and is fixed in 6.1.7.9, 7.0.8.5, 7.1.4.1, and 7.2.1.1. Applications running on Ruby 3.2 or newer are unaffected because Ruby 3.2 includes ReDoS mitigations. The weakness is classified under CWE-1333.

Critical Impact

Remote, unauthenticated attackers can trigger high CPU consumption through crafted blockquote text, causing availability loss in affected Rails applications.

Affected Products

  • Ruby on Rails Action Text 6.0.0 through 6.1.7.8
  • Ruby on Rails Action Text 7.0.x prior to 7.0.8.5 and 7.1.x prior to 7.1.4.1
  • Ruby on Rails Action Text 7.2.x prior to 7.2.1.1

Discovery Timeline

  • 2024-10-16 - CVE-2024-47888 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-47888

Vulnerability Analysis

Action Text provides rich text content handling for Rails applications. The plain_text_for_blockquote_node helper converts a blockquote HTML node into plain text wrapped in typographic quotation marks. The original implementation applied a single regular expression substitution to trim leading and lazy-match the body text. On adversarial inputs this pattern exhibits catastrophic backtracking, blocking the Ruby thread executing the request.

Because Action Text is commonly exposed through user-generated content such as comments, posts, or messages, an attacker only needs the ability to submit rich text content to reach the vulnerable helper. Each request consumes a worker thread for an unbounded time, enabling a single attacker to exhaust Puma or Unicorn worker pools.

Root Cause

The root cause is the regular expression /\A(\s*)(.+?)(\s*)\Z/m used with multiline mode against arbitrary input. The combination of greedy \s* groups surrounding a lazy .+? across multiline input creates ambiguous backtracking paths. Rails addressed this by replacing the regex substitution with linear string operations that locate the first and last non-whitespace characters using String#index and String#rindex.

Attack Vector

Exploitation requires only the ability to submit Action Text content that reaches plain_text_for_blockquote_node. No authentication is required when the vulnerable surface is public, and no user interaction is needed. Submitting large or specially padded blockquote content amplifies CPU time per request.

ruby
# Patched implementation from Rails commit 4f4312b
def plain_text_for_blockquote_node(node, index)
  text = plain_text_for_block(node)
  return "“”" if text.blank?

  text = text.dup
  text.insert(text.rindex(/\S/) + 1, "”")
  text.insert(text.index(/\S/), "“")
  text
end

Source: GitHub Rails Commit 4f4312b. The fix removes the backtracking-prone regex substitution and uses deterministic string insertions.

Detection Methods for CVE-2024-47888

Indicators of Compromise

  • Sustained spikes in Rails worker CPU usage correlated with POST or PUT requests carrying Action Text payloads.
  • Elongated request durations on controllers that render or process ActionText::RichText content.
  • Puma or Unicorn worker timeouts and request queueing alerts coinciding with blockquote-heavy submissions.

Detection Strategies

  • Review application logs for repeated requests with large or whitespace-padded blockquote content from a single source.
  • Inventory Rails applications and identify Action Text versions below 6.1.7.9, 7.0.8.5, 7.1.4.1, or 7.2.1.1 running on Ruby prior to 3.2.
  • Instrument plain_text_for_blockquote_node call sites with timing metrics to surface outlier executions.

Monitoring Recommendations

  • Alert on sustained Ruby process CPU saturation and request-timeout error rates against endpoints that accept rich text.
  • Rate-limit anonymous submissions of Action Text content and track per-IP request duration percentiles.
  • Ingest web and application telemetry into a centralized data lake to correlate availability degradation with request payloads.

How to Mitigate CVE-2024-47888

Immediate Actions Required

  • Upgrade Action Text to 6.1.7.9, 7.0.8.5, 7.1.4.1, or 7.2.1.1 depending on your Rails branch.
  • Upgrade the Ruby runtime to 3.2 or later, which includes native ReDoS mitigations that neutralize this issue.
  • If upgrading is not immediately feasible, apply the upstream patch from the Rails security advisory GHSA-wwhv-wxv9-rpgw.

Patch Information

The fix replaces the regex substitution in actiontext/lib/action_text/plain_text_conversion.rb with linear string operations. The relevant commits are 4f4312b, 727b094, ba286c0, and de0df7c. Rails 8.0.0.beta1 is unaffected because it requires Ruby 3.2 or greater.

Workarounds

  • Avoid calling plain_text_for_blockquote_node directly in custom views or helpers until patches are applied.
  • Enforce size limits on submitted Action Text content at the controller or middleware layer.
  • Deploy a web application firewall rule to reject blockquote payloads exceeding reasonable length thresholds.
bash
# Update the Rails gem to a patched release in your Gemfile
bundle update rails --conservative

# Verify the installed Action Text version satisfies a patched line
bundle info actiontext | grep -i version

# Optional: upgrade Ruby to 3.2+ which mitigates the ReDoS at the runtime level
ruby -v

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.