CVE-2024-58378: Nokogiri before 1.16.2 Use-After-Free via xmlTextReader
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.
Security readout for executives and security teams
Plain-English summary
A crafted XML document can trigger unsafe memory reuse in vulnerable Nokogiri installations, potentially affecting confidentiality, integrity, and availability. Risk is limited to CRuby using Nokogiri’s packaged libxml2 and the XML Reader with both DTD validation and XInclude expansion enabled.
Executive priority
Prioritize rapid investigation wherever applications ingest externally supplied XML. Expedite upgrades when every exposure condition is present. Configuration-specific prerequisites reduce breadth, but the 9.8 rating and potential impact across confidentiality, integrity, and availability justify urgent validation.
Technical view
CVE-2024-58378 is a CWE-416 use-after-free in libxml2’s xmlTextReader path underlying Nokogiri::XML::Reader. During crafted XML processing, the required DTD-validation and XInclude configuration can cause an xmlValidatePopElement use-after-free. The supplied CVSS 3.1 score is 9.8.
Likely exposure
Exposure requires all documented conditions: CRuby, Nokogiri’s packaged libxml2, Nokogiri::XML::Reader, DTD validation, XInclude expansion, and attacker-influenced XML. JRuby and installations linked to system libxml2 are explicitly outside the affected scope.
Exploitation context
The source bundle does not identify active exploitation, and the CVE is not listed as KEV in the supplied data. Treat malicious XML processing as a credible attack surface, but do not represent exploitation in the wild as established.
Researcher notes
Nokogiri 1.15.6 and 1.16.2 incorporate packaged libxml2 2.11.7 and 2.12.5 respectively. The bundle’s structured affected-version entries are ambiguous, so the narrative scope and vendor advisory should govern assessment: versions before those fixed releases are affected within their respective branches.
Mitigation direction
Upgrade Nokogiri 1.15.x to 1.15.6 or later.
Upgrade Nokogiri 1.16.x to 1.16.2 or later.
Disable unnecessary DTD validation or XInclude expansion pending upgrade.
Restrict untrusted XML from vulnerable Reader processing paths.
Validation and detection
Inventory Nokogiri versions across production and build artifacts.
Confirm whether CRuby uses Nokogiri’s packaged or system libxml2.
Search application paths for Nokogiri::XML::Reader usage.
Verify whether DTD validation and XInclude expansion are simultaneously enabled.
Confirm deployed Nokogiri resolves to 1.15.6, 1.16.2, or newer.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-416: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
3Timeline events
1ADP providers
4Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: yesTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-416 · source CWE mapping
Use After Free
Use After Free represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.