GHSA-j6gc-792m-qgm2 CVE-2023-22796
ReDoS based DoS vulnerability in Active Support's underscore
- Severity
- Low
- The publisher's own rating, not a CVSS score
- Exploit chance (EPSS)
- 1.71%
- Chance of exploitation in the next 30 days. Higher than 77.38% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-1333 Inefficient Regular Expression Complexity
- Fix
6.1.7.1- Upgrade activesupport to this version or later
Description
There is a possible regular expression based DoS vulnerability in Active Support. This vulnerability has been assigned the CVE identifier CVE-2023-22796.
Versions Affected: All Not affected: None Fixed Versions: 5.2.8.15 (Rails LTS, which is a paid service and not part of the rubygem), 6.1.7.1, 7.0.4.1 Impact
A specially crafted string passed to the underscore method can cause the regular expression engine to enter a state of catastrophic backtracking. This can cause the process to use large amounts of CPU and memory, leading to a possible DoS vulnerability.
This affects String#underscore, ActiveSupport::Inflector.underscore, String#titleize, and any other methods using these.
All users running an affected release should either upgrade or use one of the workarounds immediately. Releases
The FIXED releases are available at the normal locations. Workarounds
There are no feasible workarounds for this issue.
Users on Ruby 3.2.0 or greater may be able to reduce the impact by configuring Regexp.timeout. Patches
To aid users who aren’t able to upgrade immediately we have provided patches for the two supported release series. They are in git-am format and consist of a single changeset.
6-1-Avoid-regex-backtracking-in-Inflector.underscore.patch - Patch for 6.1 series
7-0-Avoid-regex-backtracking-in-Inflector.underscore.patch - Patch for 7.0 series
Please note that only the 7.0.Z and 6.1.Z series are supported at present, and 6.0.Z for severe vulnerabilities. Users of earlier unsupported releases are advised to upgrade as soon as possible as we cannot guarantee the continued availability of security fixes for unsupported releases.
Affected versions
RubyGems
| Package | Vulnerable | Fixed in |
|---|---|---|
| activesupport | < 6.1.7.1 |
6.1.7.1 |
| activesupport | >= 7.0.0, < 7.0.4.1 |
7.0.4.1 |
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.
activesupport RubyGems → 6.1.7.1
- bundler
bundle update activesupport # Gemfile: gem "activesupport", ">= 6.1.7.1"
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/commit/2164d4f6a1bde74b911fe9ba3c8df1b5bf345bf8
- github.com/rails/rails/commit/a7cda7e6aa5334ab41b1f4b0f671be931be946ef
- discuss.rubyonrails.org/t/cve-2023-22796-possible-redos-based-dos-vulnerability-in-active-su…
- github.com/rails/rails/releases/tag/v6.1.7.1
- github.com/rails/rails/releases/tag/v7.0.4.1
- github.com/rubysec/ruby-advisory-db/blob/master/gems/activesupport/CVE-2023-227…
- rubyonrails.org/2023/1/17/Rails-Versions-6-0-6-1-6-1-7-1-7-0-4-1-have-been-released
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-2j26-frm8-cmj9 Rails Active Support has a possible DoS vulnerability in its number helpers | High | Also affects activesupport |
| GHSA-89vf-4333-qx8v Rails Active Support has a possible XSS vulnerability in SafeBuffer#% | Medium | Also affects activesupport |
| GHSA-cg4j-q9v8-6v38 Rails Active Support has a possible ReDoS vulnerability in number_to_delimited | Medium | Also affects activesupport |
| GHSA-cr5q-6q9f-rq6q Active Support Possibly Discloses Locally Encrypted Files | Medium | Also affects activesupport |
| GHSA-pj73-v5mw-pm9j Possible XSS Security Vulnerability in SafeBuffer#bytesplice | Medium | Also affects activesupport |
| GHSA-2p68-f74v-9wc6 ActiveSupport potentially unintended unmarshalling of user-provided objects in MemCacheStore and RedisCacheStore | Critical | Also affects activesupport |
| GHSA-qv8p-v9qw-wc7g activesupport Cross-site Scripting vulnerability | Medium | Also affects activesupport |
| GHSA-9fh3-vh3h-q4g3 activesupport Cross-site Scripting vulnerability | Medium | Also affects activesupport |
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