CVE-2022-23516
JSON

7.5high

Uncontrolled Recursion in Loofah

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
1.17% (higher than 68% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-3x8r-x6xp-q4vm

Description

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. 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. This issue is patched in version 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.

Affected

Product or packageVersionsReported by
flavorjones loofah>= 2.2.0, < 2.19.1CVE List
loofah (RubyGems)from 2.2.0 before 2.19.1GitHub Advisory Database
loofah_project loofahfrom 2.2.0 before 2.19.1NVD

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-674

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. 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. This issue is patched in version 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.

GitHub Advisory Database

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

NVD (es)

Loofah es una librería general para manipular y transformar documentos y fragmentos HTML/XML, construida sobre Nokogiri. Loofah versiones &gt;= 2.2.0 y &lt; 2.19.1 usa recursividad para sanitizar secciones CDATA, lo que la hace susceptible al agotamiento de la pila de memoria y genera una excepción SystemStackError. Esto puede provocar una denegación de servicio debido al consumo de recursos de la CPU. Este problema se solucionó en la versión 2.19.1. Los usuarios que no puedan actualizar pueden mitigar esta vulnerabilidad limitando la longitud de las cadenas que se sanitizan.

References

Sources

SourceRecordLicence
CVE ListCVE-2022-23516 changed 2025-11-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-3x8r-x6xp-q4vm changed 2025-11-04CC-BY-4.0
NVDCVE-2022-23516 changed 2026-06-17Public domain