CVE-2026-57437

Nokogiri: Possible Use-After-Free when directly using `NokogirI::XML::XPathContext` beyond document lifetime

MEDIUM
5.3
CVSS Score
Published: June 25, 2026 at 02:34 PM UTC
Updated: October 25, 2026 at 11:10 PM UTC
2 products affected across 2 vendorsNokogiriNokogiri

Using nokogiri by sparklemotion?

Get instant alerts when new vulnerabilities affect nokogiri - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
MEDIUM5.3
Exploit prediction
EPSS 0.4%
SSVC
No known exploit

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

v < 1.19.4
Affected range stops below 1.19.4, so it looks safe — our inference, not a vendor statement
v < 1.19.4
Affected range stops below 1.19.4, so it looks safe — our inference, not a vendor statement

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

References (1)

x_refsource_CONFIRMMitigationVendor Advisory
Source: cverecord
https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-p67v-3w7g-wjg7

SSVC — Action Prioritization

SSVCNo known exploitNot automatablePartial impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

Attack Vector
NETWORK
Complexity
LOW
Privileges
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
NONE
Integrity
NONE
Availability
LOW
Vector?

Quick Info

StatusANALYZED
CWE
CWE-416

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card