GHSA-3x8r-x6xp-q4vm CVE-2022-23516
Uncontrolled Recursion in Loofah
- Severity
- 7.5 / 10
- High · CVSS 3.1
- Exploit chance (EPSS)
- 1.17%
- Chance of exploitation in the next 30 days. Higher than 67.36% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-674 Uncontrolled Recursion
- Fix
2.19.1- Upgrade loofah to this version or later
Description
Summary
Loofah >= 2.2.0, < 2.19.1 uses recursion for sanitizing CDATA sections, making it susceptible to stack exhaustion and raising a SystemStackError exception. This may lead to a denial of service through CPU resource consumption.
Mitigation
Upgrade to Loofah >= 2.19.1.
Users who are unable to upgrade may be able to mitigate this vulnerability by limiting the length of the strings that are sanitized.
Severity
The Loofah maintainers have evaluated this as High Severity 7.5 (CVSS3.1).
References
Affected versions
RubyGems
| Package | Vulnerable | Fixed in |
|---|---|---|
| loofah | >= 2.2.0, < 2.19.1 |
2.19.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.
loofah RubyGems → 2.19.1
- bundler
bundle update loofah # Gemfile: gem "loofah", ">= 2.19.1"
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-674: Uncontrolled Recursion
The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.
How to prevent it
- Implementation: Ensure that an end condition will be reached under all logic conditions. The end condition may include checking against the depth of recursion and exiting with an error if the recursion goes too deep. The complexity of the end condition contributes to the effectiveness of this action.
- Implementation: Increase the stack size.
References
Advisories
Packages
Other links
- github.com/flavorjones/loofah/security/advisories/GHSA-3x8r-x6xp-q4vm
- github.com/flavorjones/loofah/commit/86f7f6364491b0099d215db858ecdc0c89ded040
- github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/CVE-2022-23516.yml
- lists.debian.org/debian-lts-announce/2023/09/msg00011.html
- lists.debian.org/debian-lts-announce/2024/09/msg00044.html
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-5qhf-9phg-95m2 Loofah `allowed_uri?` does not detect `javascript:` URIs split by numeric character references without semicolons | Low | Also affects loofah |
| GHSA-9wjq-cp2p-hrgf Loofah: SVG `href` attribute bypasses local-reference restriction | Medium | Also affects loofah |
| GHSA-8whx-365g-h9vv Loofah `allowed_uri?` does not detect `javascript:` URIs split by named whitespace character references | Low | Also affects loofah |
| GHSA-2j22-pr5w-6gq8 Loofah has improper detection of disallowed URIs via `allowed_uri?` | Low | Also affects loofah |
| GHSA-46fp-8f5p-pf2m Improper detection of disallowed URIs by Loofah `allowed_uri?` | Low | Also affects loofah |
| GHSA-228g-948r-83gx Improper neutralization of data URIs may allow XSS in Loofah | Medium | Also affects loofah |
| GHSA-486f-hjj9-9vhh Inefficient Regular Expression Complexity in Loofah | High | Also affects loofah |
| GHSA-c3gv-9cxf-6f57 Loofah Allows Cross-site Scripting | Medium | Also affects loofah |
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