# CVE-2026-57436: Nokogiri: Possible Use-After-Free when setting `Document#root=` to an invalid node type

- 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`
- 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:36:59.000Z
- Modified: 2026-10-25T23:10:00.167Z
- Also known as: GHSA-wjv4-x9w8-wm3h
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable yes, technical impact total
- 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::Document#root= validated only that the new root was a Nokogiri::XML::Node, allowing a DTD node to be set as the document root. The result is a heap use-after-free during garbage collection or finalization, leading to an invalid memory read or potentially a segfault. 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`
- 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`
- 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-wjv4-x9w8-wm3h> (mitigation, vendor-advisory, web)
- <https://github.com/sparklemotion/nokogiri> (package)

## Sources

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

---

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