RubyGems
CVE-2026-126064
Nokogiri: Use-After-Free in Nokogiri when replacing an attribute value
- Severity
- Low
- Published
- 10 Nov 2026
- Last changed
- 10 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 1.19.5
- Exploit chance
- 0.2% in the next 30 daysHigher than 4% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- Use after free (CWE-416)
- Also known as
- GHSA-3w22-6jfg-527w
- Sources
- OSV.dev and GitHub
Description
Nokogiri's CRuby native extension could leave a Ruby wrapper pointing to freed memory when replacing the value of an existing XML attribute via Nokogiri::XML::Node#[]= or Nokogiri::XML::Node#lang=. If Ruby code had already accessed the attribute's child nodes, replacing the value could free those native child nodes while their wrappers remained reachable. Using one of those child nodes afterwards could cause an invalid read and a possible segfault.
This is the same class of issue as GHSA-phwj-rprq-35pp, which was fixed for Attr#value= in Nokogiri 1.19.4.
Nokogiri 1.19.5 preserves all already-wrapped attribute child nodes before replacing the attribute value.
JRuby is not affected.
Workarounds
Upgrade to Nokogiri 1.19.5 or later.
As a workaround, avoid accessing attribute child nodes directly via Attr#children or similar before replacing the same attribute's value.
Affected software
| Software | Affected versions |
|---|---|
nokogiriRubyGems · osv:RubyGems:nokogiri |
|
About nokogiri
- Total downloads (RubyGems)
- 1,307,106,774RubyGems, 24 Nov 2026
Vulnerabilities in nokogiri
- In our list
- 3
- Published in the last 12 months
- 3
- Critical, last 12 months
- 0
- High, last 12 months
- 0
- Known exploited
- 0
- CVE-2026-126062JRuby: NONET is bypassed for external DTDs and entities when the systemId uses a short-form IPv4 hostLow 3.7 10 Nov 2026
- CVE-2026-126063Nokogiri: Mutation XSS through `noscript` content in Nokogiri's HTML5 serializerLow 10 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-126064
- GitHub Advisory Database https://github.com/advisories/GHSA-3w22-6jfg-527w