A security advisory for Nokogiri (CVE GHSA-phwj-rprq-35pp) discloses a possible use-after-free vulnerability in the CRuby native extension. When Ruby code accesses an XML attribute's child node and then replaces the attribute value via `Nokogiri::XML::Attr#value=` or `#content=`, the underlying native child node can be freed while the Ruby wrapper remains reachable in the document node cache. A subsequent access or GC mark could dereference an invalid pointer, potentially causing a segfault. Severity is rated low because exploitation requires an unusual API usage pattern. The fix is included in Nokogiri 1.19.4, which preserves already-wrapped attribute child nodes before replacing the value. JRuby is unaffected. The workaround is to avoid accessing attribute child nodes via `Attr#child` before mutating the same attribute's value.

2m read timeFrom rubysec.com
Post cover image
Table of contents
SummarySeverityMitigationCredit
250 Impressions