---
id: CVE-2024-58378
title: >-
  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
summary: >-
  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 u…
severity: critical
cvss: 9.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'
cwe:
  - CWE-416
published: '2026-08-25'
updated: '2026-08-28'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2024-58378'
references:
  - url: 'https://github.com/GNOME/libxml2/commit/92721970'
    label: disclosure@vulncheck.com
  - url: >-
      https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xc9x-jj77-9p9j
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/nokogiri-before-use-after-free-via-xmltextreader
    label: disclosure@vulncheck.com
tags:
  - nvd
epss: 0.00342
epssPercentile: 0.2695
ingestedAt: '2026-08-29T21:42:33.476Z'
---

## Overview

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.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
