Skip to main content

CVE-2022-24839: CWE-400: Uncontrolled Resource Consumption in sparklemotion nekohtml

Medium
Published: Mon Apr 11 2022 (04/11/2022, 21:25:12 UTC)
Source: CVE
Vendor/Project: sparklemotion
Product: nekohtml

Description

org.cyberneko.html is an html parser written in Java. The fork of `org.cyberneko.html` used by Nokogiri (Rubygem) raises a `java.lang.OutOfMemoryError` exception when parsing ill-formed HTML markup. Users are advised to upgrade to `>= 1.9.22.noko2`. Note: The upstream library `org.cyberneko.html` is no longer maintained. Nokogiri uses its own fork of this library located at https://github.com/sparklemotion/nekohtml and this CVE applies only to that fork. Other forks of nekohtml may have a similar vulnerability.

AI-Powered Analysis

AILast updated: 06/23/2025, 10:51:45 UTC

Technical Analysis

CVE-2022-24839 is a vulnerability classified under CWE-400, indicating uncontrolled resource consumption, found in the sparklemotion fork of the org.cyberneko.html HTML parser, which is written in Java. This parser is notably used within Nokogiri, a widely used Ruby gem for parsing HTML and XML. The vulnerability manifests when the parser processes ill-formed or maliciously crafted HTML markup, causing it to raise a java.lang.OutOfMemoryError exception. This error occurs due to excessive memory allocation triggered by the malformed input, leading to potential denial of service (DoS) conditions. The root cause lies in the parser's inability to properly handle resource allocation limits when parsing malformed HTML, resulting in uncontrolled consumption of memory resources. It is important to note that the original org.cyberneko.html library is no longer maintained, and this CVE specifically affects the sparklemotion fork used by Nokogiri, with other forks potentially sharing similar vulnerabilities. Users of affected versions prior to 1.9.22.noko2 are advised to upgrade to at least version 1.9.22.noko2, where the issue has been addressed. There are currently no known exploits in the wild targeting this vulnerability, but the risk remains due to the widespread use of Nokogiri in web applications and services that process HTML content.

Potential Impact

For European organizations, this vulnerability poses a risk primarily in environments where Nokogiri is used to parse HTML content, such as web applications, content management systems, and data processing pipelines. An attacker could exploit this vulnerability by submitting specially crafted HTML inputs designed to exhaust server memory, leading to application crashes or degraded service availability. This could result in denial of service conditions, impacting business continuity and user experience. Confidentiality and integrity impacts are limited since the vulnerability does not directly allow code execution or data manipulation; however, service disruption could indirectly affect operational integrity. Organizations handling high volumes of user-generated or external HTML content are particularly at risk. Additionally, sectors with critical uptime requirements, such as financial services, healthcare, and public administration, could face significant operational impacts if affected systems become unavailable. The lack of known exploits reduces immediate risk, but the ease of triggering an OutOfMemoryError through malformed input means that opportunistic attackers could leverage this vulnerability in denial of service attacks.

Mitigation Recommendations

To mitigate this vulnerability, European organizations should prioritize upgrading Nokogiri to version 1.9.22.noko2 or later, which contains the patched version of the sparklemotion nekohtml parser. Beyond upgrading, organizations should implement input validation and sanitization controls to detect and reject malformed or suspicious HTML content before parsing. Rate limiting and request throttling can help reduce the risk of resource exhaustion from repeated malicious inputs. Monitoring application logs for frequent OutOfMemoryError exceptions or abnormal memory usage patterns can provide early detection of exploitation attempts. Additionally, deploying application-level resource constraints, such as Java Virtual Machine (JVM) memory limits and garbage collection tuning, can help contain the impact of resource consumption attacks. For critical systems, consider isolating HTML parsing components in sandboxed environments or containers to limit the blast radius of potential crashes. Finally, organizations should maintain an inventory of applications and services using Nokogiri to ensure comprehensive coverage of the upgrade and mitigation efforts.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-02-10T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9843c4522896dcbf2c64

Added to database: 5/21/2025, 9:09:23 AM

Last enriched: 6/23/2025, 10:51:45 AM

Last updated: 7/28/2025, 1:16:01 PM

Views: 15

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats