Description
Nokogiri before 1.15.6 and 1.16.x before 1.16.2 (CRuby, when using the packaged libxml2) is affected by a use-after-free vulnerability in libxml2 (CVE-2024-25062) in the xmlTextReader module, which underlies Nokogiri::XML::Reader. When using the XML Reader interface with DTD validation and XInclude expansion enabled, processing a crafted XML document can lead to an xmlValidatePopElement use-after-free. Nokogiri 1.15.6 and 1.16.2 resolve this by upgrading the packaged libxml2 to 2.11.7 and 2.12.5 respectively. JRuby and installations using system libxml2 are not affected.
Published: 2026-08-25
Score: 9.3 Critical
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

A use‑after‑free flaw was discovered in libxml2, the XML parsing library bundled with Nokogiri. The bug is triggered through the xmlTextReader module when DTD validation and XInclude expansion are enabled. A crafted XML document can cause the xmlValidatePopElement function to free memory that is still in use, leading to a memory corruption condition that can be exploited by an attacker to execute arbitrary code. This vulnerability is identified as CWE‑416.

Affected Systems

The issue affects the Nokogiri Ruby gem provided by Sparklemotion. Versions prior to 1.15.6 and prior to 1.16.2 contain the vulnerable libxml2 package. Applications built with CRuby that use Nokogiri’s XML Reader interface and enable DTD validation and XInclude expansion are susceptible. JRuby and installations that link against a system-installed libxml2 are not affected by this specific flaw.

Risk and Exploitability

The flaw is rated CVSS 9.3, indicating a high severity. No EPSS score is available and the vulnerability is not listed in the CISA KEV catalog, suggesting that exploitation has not been observed in the wild yet. An attacker must supply a malicious XML file to a vulnerable application; thus the attack vector is likely to be local or remote depending on how the XML input is provided. Because the flaw leads to memory corruption, a successful exploit can result in arbitrary code execution on the host as which the application runs. Given the high CVSS score and the potential for complete control, the risk remains significant and patching is strongly advised.

Generated by OpenCVE AI on August 25, 2026 at 16:21 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Nokogiri to version 1.15.6 or 1.16.2, which incorporate the updated libxml2 packages that fix the use‑after‑free.
  • If upgrading immediately is not possible, disable DTD validation and XInclude expansion in all uses of Nokogiri::XML::Reader to mitigate the trigger for the memory corruption.
  • Ensure the deployment environment uses the packaged libxml2 supplied with Nokogiri and that it is at least 2.11.7 for 1.15.x or 2.12.5 for 1.16.x, or switch to a system libxml2 that is not affected by the underlying CVE‑2024‑25062 flaw.

Generated by OpenCVE AI on August 25, 2026 at 16:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 25 Aug 2026 15:30:00 +0000

Type Values Removed Values Added
Description Nokogiri before 1.15.6 and 1.16.x before 1.16.2 (CRuby, when using the packaged libxml2) is affected by a use-after-free vulnerability in libxml2 (CVE-2024-25062) in the xmlTextReader module, which underlies Nokogiri::XML::Reader. When using the XML Reader interface with DTD validation and XInclude expansion enabled, processing a crafted XML document can lead to an xmlValidatePopElement use-after-free. Nokogiri 1.15.6 and 1.16.2 resolve this by upgrading the packaged libxml2 to 2.11.7 and 2.12.5 respectively. JRuby and installations using system libxml2 are not affected.
Title Nokogiri before 1.16.2 Use-After-Free via xmlTextReader
First Time appeared Nokogiri
Nokogiri nokogiri
Weaknesses CWE-416
CPEs cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:*:*:*
Vendors & Products Nokogiri
Nokogiri nokogiri
References
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Subscriptions

Nokogiri Nokogiri
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-25T15:15:57.242Z

Reserved: 2026-08-16T13:02:14.690Z

Link: CVE-2024-58378

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-08-25T16:16:45.153

Modified: 2026-08-25T16:16:45.153

Link: CVE-2024-58378

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-25T16:30:06Z

Weaknesses