# CVE-2026-126064: Nokogiri use-after-free in attribute replacement

Source: https://junglewise.ai/threats/cve-2026-126064-nokogiri-is-an-open-source-xml-and-html-library-for-the-ruby  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-11-10. Updated: 2026-11-10  
License: CC BY 4.0 with a link back

CVE-2026-126064 · Severity: medium · CVSS 4 · Published 2026-11-10

Nokogiri is a widely-used XML and HTML parsing library for Ruby applications. A flaw in the CRuby native extension can cause the application to crash or read invalid memory when attribute values are replaced, potentially leading to data exposure or denial of service in applications that parse untrusted XML/HTML.

Technologies: [nokogiri (RubyGems)](https://junglewise.ai/threats/technologies/nokogiri). Vendors: [RubyGems](https://junglewise.ai/threats/vendors/rubygems), [Sparklemotion](https://junglewise.ai/threats/vendors/sparklemotion).

## Quick answers

**Is CVE-2026-126064 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-126064 being exploited in the wild.

**How severe is CVE-2026-126064?** Medium severity, with a CVSS score of 4, published 10 November 2026.

**Which products and versions are affected?** nokogiri (RubyGems) < 1.19.5, ECOSYSTEM:introduced=0,fixed=1.19.5; Sparklemotion Nokogiri before 1.19.5.

**Is there a fix for CVE-2026-126064?** Yes. nokogiri (RubyGems): upgrade to 1.19.5 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-126064 attacked?** It is attacked with local access or over the network, in a software library.

**Am I affected by CVE-2026-126064?** Check whether you run nokogiri (RubyGems) or Sparklemotion Nokogiri at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- nokogiri (RubyGems): upgrade to 1.19.5 or later

  ```sh
  bundle update nokogiri
  ```


## Technical details

A use-after-free vulnerability exists in the CRuby native extension when Node#[]= or Node#lang= methods replace existing attribute values. The vulnerability occurs when child nodes of an attribute have been accessed and wrapped—replacing the attribute value frees the native nodes while Ruby wrappers remain reachable, allowing subsequent access to trigger invalid reads or segmentation faults. JRuby implementations are not affected.

## Affected products

- sparklemotion Nokogiri before 1.19.5

## Identifiers

- CVE-2026-126064
- GHSA-3w22-6jfg-527w

## Timeline

- 2026-11-10: disclosed
- 2026-11-10: patched

## References

- [https://github.com/sparklemotion/nokogiri/commit/b15b518db9fd15fd6b046f73d1439c282e5cc425](https://github.com/sparklemotion/nokogiri/commit/b15b518db9fd15fd6b046f73d1439c282e5cc425)
- [https://github.com/sparklemotion/nokogiri/commit/feaed3c8c9bd9d81d064d4ca09b16044cd705d6f](https://github.com/sparklemotion/nokogiri/commit/feaed3c8c9bd9d81d064d4ca09b16044cd705d6f)

## Related threats

- [Nokogiri HTML5 serializer mutation XSS via noscript and attributes](https://junglewise.ai/threats/cve-2026-126063-nokogiri-is-an-open-source-xml-and-html-library-for-the-ruby)
- [JRuby: NONET is bypassed for external DTDs and entities when the systemId uses a short-form IPv4 host](https://junglewise.ai/threats/cve-2026-126062-nokogiri-is-an-open-source-xml-and-html-library-for-the-ruby)
- [Nokogiri unchecked return value in canonicalize method](https://junglewise.ai/threats/nokogiri-unchecked-return-value-in-canonicalize-method-3863de91)
- [Nokogiri XSLT transform memory leak](https://junglewise.ai/threats/nokogiri-xslt-transform-memory-leak-0441ddf7)
- [Nokogiri CSS selector tokenizer ReDoS](https://junglewise.ai/threats/nokogiri-css-selector-tokenizer-redos-d52ae203)
