Skip to content

GHSA-5x79-w82f-gw8w CVE-2022-23517

Inefficient Regular Expression Complexity in rails-html-sanitizer

High RubyGems
Severity
7.5 / 10
High · CVSS 3.1
Exploit chance (EPSS)
1.58%
Chance of exploitation in the next 30 days. Higher than 75.48% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-1333 Inefficient Regular Expression Complexity
Fix
1.4.4
Upgrade rails-html-sanitizer to this version or later

Description

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 (CVSS3.1).

References

Credit

This vulnerability was responsibly reported by @ooooooo-q (https://github.com/ooooooo-q).

Affected versions

RubyGems

PackageVulnerableFixed in
rails-html-sanitizer
< 1.4.4
1.4.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

rails-html-sanitizer RubyGems → 1.4.4

bundler
bundle update rails-html-sanitizer # Gemfile: gem "rails-html-sanitizer", ">= 1.4.4"

Severity breakdown

CVSS 3.1 7.5

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Weakness

CWE-1333: Inefficient Regular Expression Complexity

The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.

How to prevent it
  • Architecture and Design: Use regular expressions that do not support backtracking, e.g. by removing nested quantifiers.
  • System Configuration: Set backtracking limits in the configuration of the regular expression implementation, such as PHP's pcre.backtrack_limit. Also consider limits on execution time for the process.
  • Implementation: Do not use regular expressions with untrusted input. If regular expressions must be used, avoid using backtracking in the expression.
  • Implementation: Limit the length of the input that the regular expression will process.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-cj75-f6xr-r4g7
Rails HTML Sanitizers: Possible XSS vulnerability with certain configurations
Medium Also affects rails-html-sanitizer
GHSA-2x5m-9ch4-qgrr
rails-html-sanitizer has XSS vulnerability with certain configurations
Medium Also affects rails-html-sanitizer
GHSA-cfjx-w229-hgx5
rails-html-sanitizer has XSS vulnerability with certain configurations
Medium Also affects rails-html-sanitizer
GHSA-638j-pmjw-jq48
rails-html-sanitizer has XSS vulnerability with certain configurations
Medium Also affects rails-html-sanitizer
GHSA-w8gc-x259-rc7x
rails-html-sanitize has XSS vulnerability with certain configurations
Medium Also affects rails-html-sanitizer
GHSA-rxv5-gxqc-xx8g
rails-html-sanitizer has XSS vulnerability with certain configurations
Medium Also affects rails-html-sanitizer
GHSA-rrfc-7g8p-99q8
Possible XSS vulnerability with certain configurations of rails-html-sanitizer
Medium Also affects rails-html-sanitizer
GHSA-9h9g-93gc-623h
Possible XSS vulnerability with certain configurations of rails-html-sanitizer
Medium Also affects rails-html-sanitizer
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor