All vulnerabilities

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.

From the GitHub Advisory Database, CC BY 4.0.

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.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
nokogiriRubyGems · osv:RubyGems:nokogiri
  • Every version before 1.19.5

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
Search the list for nokogiri

References