MEDIUM

CVE-2026-57437

Nokogiri Nokogiri 2026-06-25 CVSS v3.1
CVSS
5.3

Description

Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, Nokogiri::XML::XPathContext did not keep its source document alive for garbage collection. If an XPathContext outlived its document and the document was collected, evaluating an XPath expression could read invalid memory and potentially segfault. This is only reachable when application code constructs an XPathContext directly and lets the document become unreachable while continuing to use the context. The normal Document#xpath, #css, and related search methods are not affected, and it is not triggerable by malicious document input. This vulnerability is fixed in 1.19.4.

Summary dbcve.org

Nokogiri::XML::XPathContext does not keep its source document alive for garbage collection. If an XPathContext outlives its document and the document gets collected, evaluating an XPath expression can read invalid memory and potentially segfault due to a use-after-free condition.

Mitigation

Upgrade Nokogiri to version 1.19.4 or later. Avoid directly constructing XPathContext objects that may outlive their source documents.

Weakness (CWE)

CWE-416 Use After Free

EPSS Score

0.4%
Probability of exploitation in next 30 days
34.3th percentile

References

View on dbcve.org
Base CVE data derived from NVD (public domain). Enrichment by dbcve.org (CC-BY-4.0). Fetched via API.
Back to CVE