Vulnerability · Published Jun 25, 2026 · Assigned by GitHub_M
CVE-2026-57437Nokogiri: Possible Use-After-Free when directly using `NokogirI::XML::XPathContext` beyond document lifetime
Low 1.7
In plain English
A low-severity use-after-free in nokogiri from sparklemotion. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.4% (higher than 35% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | ruby-nokogiri | no fix listed | DEBIAN-CVE-2026-57437 |
| Debian:13 | ruby-nokogiri | no fix listed | DEBIAN-CVE-2026-57437 |
| Debian:14 | ruby-nokogiri | 1.19.4+dfsg-1 | DEBIAN-CVE-2026-57437 |
| RubyGems | nokogiri | 1.19.4 | GHSA-p67v-3w7g-wjg7 |
| Ubuntu:24.04:LTS | ruby-nokogiri | no fix listed | UBUNTU-CVE-2026-57437 |
| Ubuntu:25.10 | ruby-nokogiri | no fix listed | UBUNTU-CVE-2026-57437 |
| Ubuntu:26.04:LTS | ruby-nokogiri | no fix listed | UBUNTU-CVE-2026-57437 |
| Ubuntu:26.10 | ruby-nokogiri | no fix listed | UBUNTU-CVE-2026-57437 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| sparklemotion | nokogiri | < 1.19.4 |
Weakness: CWE-416 · Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U/U:Clear