A use-after-free vulnerability (GHSA-p67v-3w7g-wjg7) has been disclosed in Nokogiri, the Ruby XML/HTML parsing library. When application code directly constructs an `Nokogiri::XML::XPathContext` and allows its source document to be garbage-collected while the context is still in use, evaluating XPath expressions can read invalid memory and potentially cause a segfault. Only the CRuby implementation is affected; JRuby is not. Normal usage via `Document#xpath`, `#css`, and related methods is unaffected. The fix is included in Nokogiri 1.19.4, which ensures the XPathContext keeps its source document alive for its own lifetime. The workaround is to keep a reference to the source document for as long as any derived XPathContext is in use.

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