Skip to content

GHSA-3x8r-x6xp-q4vm CVE-2022-23516

Uncontrolled Recursion in Loofah

High RubyGems
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

PackageVulnerableFixed 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

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy 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
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