GHSA-5x79-w82f-gw8w CVE-2022-23517
Inefficient Regular Expression Complexity in rails-html-sanitizer
- 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
- CWE - CWE-1333: Inefficient Regular Expression Complexity (4.9)
- https://hackerone.com/reports/1684163
Credit
This vulnerability was responsibly reported by @ooooooo-q (https://github.com/ooooooo-q).
Affected versions
RubyGems
| Package | Vulnerable | Fixed 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
Advisories
Packages
Other links
- github.com/rails/rails-html-sanitizer/security/advisories/GHSA-5x79-w82f-gw8w
- github.com/rails/rails-html-sanitizer/commit/56c61c0cebd1e493e8ad7bca2a0191609a…
- hackerone.com/reports/1684163
- github.com/rubysec/ruby-advisory-db/blob/master/gems/rails-html-sanitizer/CVE-2…
- lists.debian.org/debian-lts-announce/2023/09/msg00012.html
- lists.debian.org/debian-lts-announce/2024/09/msg00045.html
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why 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 |
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