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

- Severity: Low 1.7 (CVSS:4.0, scored by GitHub_M) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.32%, higher than 27% of CVEs (2026-12-01)
- Published: 2026-06-19T16:37:13.000Z
- Modified: 2026-10-25T23:10:00.167Z
- Also known as: GHSA-p67v-3w7g-wjg7
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- sparklemotion nokogiri: < 1.19.4
- nokogiri (RubyGems): before 1.19.4
- nokogiri nokogiri: before 1.19.4

## Every score

- GitHub_M: CVSS:4.0 1.7 Low `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`
- GitHub: CVSS:4.0 Low `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`
- NVD: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`

## References

- <https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-p67v-3w7g-wjg7> (mitigation, vendor-advisory, web)
- <https://github.com/sparklemotion/nokogiri> (package)

## Sources

- CVE List: [CVE-2026-57437](https://www.cve.org/CVERecord?id=CVE-2026-57437), CVE Terms of Use, modified 2026-06-25
- GitHub Advisory Database: [GHSA-p67v-3w7g-wjg7](https://github.com/advisories/GHSA-p67v-3w7g-wjg7), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-57437](https://nvd.nist.gov/vuln/detail/CVE-2026-57437), Public domain, modified 2026-10-25

---

Page: https://cve.day/CVE-2026-57437 · Whole record: https://cve.day/CVE-2026-57437.json · Rebuilt by cve.day 2026-11-25T22:59:26.372Z
