Skip to content
DoS Disclosed report Intermediate CVE-2022-23514

ReDoS (Rails::Html::PermitScrubber.scrub_attribute)

Certain configurations of the rails-html-sanitizer library used an inefficient regular expression that could backtrack excessively while sanitising particular SVG attributes. An attacker could trigger this to cause a denial of service by consuming CPU resources.

ooooooo_q Follow

Originally disclosed on HackerOne

Bounty$4,000 High View original
  • Fixed in 4 hours
  • Paid in 4 hours
  • Disclosed after 13 hours

Summary by the program

###Summary

Certain configurations of rails-html-sanitizer < 1.4.4 use an inefficient regular expression that is susceptible to excessive backtracking when attempting to sanitize certain SVG attributes. This may lead to a denial of service through CPU resource consumption.

###Mitigation

Upgrade to rails-html-sanitizer >= 1.4.4.

###Severity

The maintainers have evaluated this as High Severity 7.5 (CVSS 3.1).

###References

The report

I reported at https://hackerone.com/reports/1684163

https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-5x79-w82f-gw8w

Certain configurations of rails-html-sanitizer < 1.4.4 use an inefficient regular expression that is susceptible to excessive backtracking when attempting to sanitize certain SVG attributes. This may lead to a denial of service through CPU resource consumption.

It seems that the same problem existed on the Loofah side, so it was fixed as well. That has been fixed as CVE-2022-23514(https://github.com/flavorjones/loofah/security/advisories/GHSA-486f-hjj9-9vhh)

Impact

ReDoS may occur if scrub is executed in Rails::Html::PermitScrubber.

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.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the regular expression used by the permit scrubber to match SVG attributes had ambiguous repetition, allowing catastrophic backtracking on crafted input.

Impact

ReDoS may occur if scrub is executed in Rails::Html::PermitScrubber, potentially causing a denial of service through CPU consumption.

What the attacker needed

Sanitiser configured to permit SVG attributes; attacker can submit input to the scrubber

The fix

The mitigation is to upgrade rails-html-sanitizer to 1.4.4 or later; the same issue was also fixed in Loofah.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A regular expression is a pattern used to match text, and some patterns can take a very long time when given carefully crafted input. Here, the sanitiser that cleans HTML used such a slow pattern on certain SVG attributes, so a malicious input could keep the server busy and stop it serving other users. This kind of attack is called a denial of service.

What is DoS?

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

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.