Skip to content
DoS Disclosed report Intermediate CVE-2024-47888

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

A helper in Action Text that converts blockquote nodes to plain text used a regular expression that could be made to run for an unexpectedly long time. An attacker who can supply crafted text could therefore cause a denial of service by tying up server resources.

ooooooo_q Follow

Originally disclosed on HackerOne

Bounty$505 Low View original
  • Triaged in 2 days
  • Fixed in 4 days
  • Paid in 4 days
  • Disclosed after 40 days

Summary by the program

Possible ReDoS vulnerability in plain_text_for_blockquote_node in Action Text

There is a possible ReDoS vulnerability in the plain_text_for_blockquote_node helper in Action Text. This vulnerability has been assigned the CVE identifier CVE-2024-47888.

Impact Carefully crafted text can cause the plain_text_for_blockquote_node helper to take an unexpected amount of time, possibly resulting in a DoS vulnerability. All users running an affected release should either upgrade or apply the relevant patch immediately.

Ruby 3.2 has mitigations for this problem, so Rails applications using Ruby 3.2 or newer are unaffected. Rails 8.0.0.beta1 depends on Ruby 3.2 or greater so is unaffected.

Full GHSA: https://github.com/rails/rails/security/advisories/GHSA-wwhv-wxv9-rpgw

The report

I made a report at https://hackerone.com/reports/2389431

https://discuss.rubyonrails.org/t/cve-2024-47888-possible-redos-vulnerability-in-plain-text-for-blockquote-node-in-action-text/87696

There is a possible ReDoS vulnerability in the plain_text_for_blockquote_node helper in Action Text. This vulnerability has been assigned the CVE identifier CVE-2024-47888.

Impact

Carefully crafted text can cause the plain_text_for_blockquote_node helper to take an unexpected amount of time, possibly resulting in a DoS vulnerability.

The original report as published on HackerOne, by ooooooo_q. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

Action Text is the rich text editing component of Ruby on Rails. Among its internals is a helper called plain_text_for_blockquote_node, which converts a blockquote node into plain text. The helper is the subject of CVE-2024-47888, a possible regular expression denial of service (ReDoS) issue classified as Uncontrolled Resource Consumption.

The report was filed under the Internet Bug Bounty program against the Rails repository at https://github.com/rails, with a severity of low and a bounty of 505.00 USD. It was disclosed on 2024-11-28. The full advisory is GHSA-wwhv-wxv9-rpgw.

Setup

The report does not describe a test environment, accounts, roles or tooling. What it does establish is the affected surface and the version conditions:

  • The vulnerable code is the plain_text_for_blockquote_node helper in Action Text.
  • Ruby 3.2 has mitigations for this problem, so Rails applications using Ruby 3.2 or newer are unaffected.
  • Rails 8.0.0.beta1 depends on Ruby 3.2 or greater, so it is unaffected.
  • All users running an affected release should either upgrade or apply the relevant patch immediately.

Finding it

The advisory states that the plain_text_for_blockquote_node helper could take an unexpected amount of time when processing carefully crafted text. That behaviour is the classic signature of a ReDoS: a regular expression whose matching time grows disproportionately with certain inputs, so that a small amount of attacker-controlled text consumes a large amount of processing time.

The program's summary states the issue plainly: there is a possible ReDoS vulnerability in the plain_text_for_blockquote_node helper in Action Text, and it has been assigned CVE-2024-47888.

Exploitation

The report does not include a request, payload, script or reproduction command. It describes the exploitation condition rather than a worked example: carefully crafted text passed through the plain_text_for_blockquote_node helper causes it to take an unexpected amount of time. The crafted text is the input, and the helper's processing of it is the expensive operation.

The report gives no sample string, no timing measurements and no endpoint. What it does make clear is the precondition: the application must be running an affected release on a Ruby version older than 3.2, since Ruby 3.2's mitigations neutralise the problem.

Root cause

The report does not describe the root cause beyond naming the helper and the crafted-text condition. The report does not reproduce the expression itself, so the exact pattern is not shown here.

Ruby 3.2 has mitigations for this problem, so applications using Ruby 3.2 or newer are unaffected. Applications on older Ruby versions had no such protection, which is why the advisory directs users of affected releases to upgrade or apply the relevant patch immediately. Rails 8.0.0.beta1 is unaffected because it requires Ruby 3.2 or greater.

Impact

Carefully crafted text can cause the plain_text_for_blockquote_node helper to take an unexpected amount of time, possibly resulting in a DoS vulnerability. The program frames this as a possible ReDoS, and the impact is availability: processing time rather than data exposure or code execution.

The conditions matter. Applications using Ruby 3.2 or newer are unaffected, as is Rails 8.0.0.beta1. The exposure is limited to users running an affected release on a Ruby version without the mitigation.

Fix

The advisory's guidance is to upgrade or apply the relevant patch immediately. It does identify the structural mitigation: Ruby 3.2's regexp protections remove the exposure, and Rails 8.0.0.beta1, which depends on Ruby 3.2 or greater, is unaffected.

Variants to test

  • Other Action Text helpers that convert nodes to plain text. A positive result is a helper whose processing time grows sharply as the input length increases with a repeated, ambiguous pattern.
  • Any Rails application on a Ruby version older than 3.2 that passes user-supplied rich text through Action Text. A positive result is a measurable slowdown or hang when crafted blockquote content is processed.
  • Other regular expressions applied to user-controlled markup in Rails components. A positive result is superlinear matching time on inputs that repeat a delimiter or prefix.

Hunting notes

This class of bug tends to hide in text-processing helpers: serialisers, sanitisers, plain-text converters and anything that runs a regexp over markup a user can influence. During recon, the signals are framework components that transform rich text server-side and a runtime version below the one that ships regexp mitigations.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

A security researcher found a way to make a piece of software called Ruby on Rails slow down badly by feeding it a particular kind of text. Rails is a toolkit that many websites are built with. One of its parts, Action Text, handles rich text, the kind of formatted text you type into an editor with bold, italics and quotes. Inside Action Text there is a small helper, a piece of code that does one job, called plain_text_for_blockquote_node. Its job is to take a quoted block of text (a blockquote) and turn it into plain text with no formatting.

The advisory says that carefully crafted text can cause this helper to take an unexpected amount of time. If a website lets strangers send in text that ends up going through this helper, carefully crafted text could keep the server busy, possibly resulting in a DoS. That kind of attack is called a denial of service, or DoS: you are not stealing data or breaking in, you are just making the service unavailable.

The specific weakness is called ReDoS, short for regular expression denial of service. A regular expression (often shortened to regex) is a pattern used to find or match text, a bit like a very precise search rule. Some patterns can be written so that, on certain inputs, the computer has to try a huge number of combinations before it gives up. A short piece of text can then cost a huge amount of computing time. The issue was given the identifier CVE-2024-47888. A CVE is a public catalogue number for a known security flaw, so people can refer to it unambiguously.

The report was filed through the Internet Bug Bounty program, which pays researchers for finding bugs in widely used open source software. It was rated low severity and paid a bounty of 505.00 USD. It was disclosed on 2024-11-28. The full advisory is GHSA-wwhv-wxv9-rpgw.

Context

Action Text is the rich text editing component of Ruby on Rails. Think of Rails as a large box of building blocks for making web applications, and Action Text as the block that deals with formatted text: the editor, the storage of that formatted content, and the conversion of it back into other forms.

Among its internals is a helper called plain_text_for_blockquote_node, which converts a blockquote node into plain text. A node here means one piece of a structured document: the document is stored as a tree of nodes, and a blockquote node is the branch that represents a quotation. The helper walks over that branch and produces a plain string with the formatting stripped out.

The helper is the subject of CVE-2024-47888, a possible regular expression denial of service (ReDoS) issue classified as Uncontrolled Resource Consumption. Uncontrolled Resource Consumption is the general category: the software uses up a resource (here, processing time) without a limit, because the input controls how much it consumes.

The report was filed under the Internet Bug Bounty program against the Rails repository at https://github.com/rails, with a severity of low and a bounty of 505.00 USD. It was disclosed on 2024-11-28.

Setup

The report does not describe a test environment, accounts, roles or tooling. What it does establish is the affected surface and the version conditions:

  • The vulnerable code is the plain_text_for_blockquote_node helper in Action Text.
  • Ruby 3.2 has mitigations for this problem, so Rails applications using Ruby 3.2 or newer are unaffected.
  • Rails 8.0.0.beta1 depends on Ruby 3.2 or greater, so it is unaffected.
  • All users running an affected release should either upgrade or apply the relevant patch immediately.

Ruby is the programming language Rails is written in, and each Rails application runs on some version of Ruby. A mitigation is a built-in protection that reduces or removes the danger. Here the protection lives in Ruby itself, not in Rails, which is why the version of Ruby matters as much as the version of Rails. A patch is a small update that fixes a specific problem.

Finding it

The advisory states that the plain_text_for_blockquote_node helper could take an unexpected amount of time when processing carefully crafted text. That behaviour is the classic signature of a ReDoS: a regular expression whose matching time grows disproportionately with certain inputs, so that a small amount of attacker-controlled text consumes a large amount of processing time.

To picture it, imagine being asked to find a word in a sentence, but the rule you are given forces you to try every possible way of splitting the sentence before you can answer. For a short sentence that is fine. Make the sentence a little longer and the number of ways explodes, so the work grows far faster than the length of the text. That is what disproportionate means here: doubling the input does not double the work, it multiplies it.

The program's summary states the issue plainly: there is a possible ReDoS vulnerability in the plain_text_for_blockquote_node helper in Action Text, and it has been assigned CVE-2024-47888.

Exploitation

The report does not include a request, payload, script or reproduction command. It describes the exploitation condition rather than a worked example: carefully crafted text passed through the plain_text_for_blockquote_node helper causes it to take an unexpected amount of time. The crafted text is the input, and the helper's processing of it is the expensive operation.

A payload is the actual malicious input an attacker sends. Here the payload would be a specially built string of text, but the report does not show one. The report gives no sample string, no timing measurements and no endpoint. An endpoint is a specific address on a website that accepts a particular kind of request, for example the address that receives a submitted comment.

What it does make clear is the precondition: the application must be running an affected release on a Ruby version older than 3.2, since Ruby 3.2's mitigations neutralise the problem. A precondition is something that must already be true for the attack to work at all. If the site runs a newer Ruby, the crafted text is harmless.

Root cause

Backtracking is what a regex engine does when a match attempt fails partway: it goes back and tries a different route through the pattern. With certain patterns and certain inputs, the engine tries an enormous number of routes, and that is where the time goes.

The report does not reproduce the expression itself, so the exact pattern is not shown here.

Ruby 3.2 has mitigations for this problem, so applications using Ruby 3.2 or newer are unaffected. Applications on older Ruby versions had no such protection, which is why the advisory directs users of affected releases to upgrade or apply the relevant patch immediately. Rails 8.0.0.beta1 is unaffected because it requires Ruby 3.2 or greater.

Impact

Carefully crafted text can cause the plain_text_for_blockquote_node helper to take an unexpected amount of time, possibly resulting in a DoS vulnerability. The program frames this as a possible ReDoS, and the impact is availability: processing time rather than data exposure or code execution.

Availability means the service is there and responsive when people need it. Data exposure would mean private information leaking out, and code execution would mean an attacker getting their own code to run on the server. Neither of those is claimed here. The harm is that the site can be made slow or unresponsive.

The conditions matter. Applications using Ruby 3.2 or newer are unaffected, as is Rails 8.0.0.beta1. The exposure is limited to users running an affected release on a Ruby version without the mitigation. Untrusted input means any text that comes from someone you would not automatically trust, such as a public comment form.

Fix

The advisory's guidance is to upgrade or apply the relevant patch immediately. It does identify the structural mitigation: Ruby 3.2's regexp protections remove the exposure, and Rails 8.0.0.beta1, which depends on Ruby 3.2 or greater, is unaffected.

Upgrading means moving to a newer version of the software. Applying a patch means installing the specific fix without necessarily changing everything else. Either way, the point is to get the protection that newer Ruby versions provide.

Variants to test

A variant is a nearby version of the same idea, worth checking because the same mistake often appears more than once.

  • Other Action Text helpers that convert nodes to plain text. A positive result is a helper whose processing time grows sharply as the input length increases with a repeated, ambiguous pattern.
  • Any Rails application on a Ruby version older than 3.2 that passes user-supplied rich text through Action Text. A positive result is a measurable slowdown or hang when crafted blockquote content is processed.
  • Other regular expressions applied to user-controlled markup in Rails components. A positive result is superlinear matching time on inputs that repeat a delimiter or prefix.

Superlinear means the time grows faster than the input size: twice the text takes much more than twice the time. A delimiter is a character that separates parts of text, such as a quote mark or a bracket.

Hunting notes

This class of bug tends to hide in text-processing helpers: serialisers, sanitisers, plain-text converters and anything that runs a regexp over markup a user can influence. A serialiser turns data into a particular text format, a sanitiser cleans text so it is safe to display, and markup is the text with formatting instructions in it.

During recon, the signals are framework components that transform rich text server-side and a runtime version below the one that ships regexp mitigations. Recon means the early research phase where you look around and gather facts before testing anything.

Glossary

  • Action Text: the part of Ruby on Rails that handles rich text editing and conversion.
  • Availability: whether a service is up and responsive for its users.
  • Backtracking: a regex engine going back to try a different route through a pattern after a failed match attempt.
  • Blockquote: a quoted block of text in a document.
  • Bounty: a payment made to a researcher for reporting a valid security issue.
  • CVE: a public catalogue identifier for a known security vulnerability.
  • Delimiter: a character that separates parts of text, such as a quote mark or bracket.
  • Denial of service (DoS): making a service slow or unavailable rather than stealing data or taking control.
  • Endpoint: a specific address on a website that accepts a particular kind of request.
  • GHSA: a security advisory identifier used by GitHub for open source projects.
  • Helper: a small piece of code that performs one specific job.
  • Markup: text that carries formatting instructions, such as HTML tags.
  • Mitigation: a built-in protection that reduces or removes a danger.
  • Node: one piece of a structured document, arranged in a tree.
  • Patch: a small update that fixes a specific problem.
  • Payload: the actual malicious input an attacker sends.
  • Precondition: something that must already be true for an attack to work.
  • Recon: the early research phase of gathering facts before testing.
  • ReDoS (regular expression denial of service): a DoS caused by a regex whose matching time explodes on certain inputs.
  • Regex (regular expression): a pattern used to find or match text.
  • Ruby: the programming language Ruby on Rails is written in.
  • Ruby on Rails: a toolkit for building web applications.
  • Sanitiser: code that cleans text so it is safe to display.
  • Serialiser: code that turns data into a particular text format.
  • Severity: a rating of how serious a vulnerability is, here low.
  • Superlinear: growing faster than the input size, so twice the input costs much more than twice the time.
  • Uncontrolled Resource Consumption: a weakness where input controls how much of a resource, such as processing time, the software uses.
  • Untrusted input: text that comes from someone you would not automatically trust, such as a public form.
  • Upgrade: moving to a newer version of software.
  • Variant: a nearby version of the same idea, worth checking separately.

More by ooooooo_q

View all

53 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.