Use After Free Affecting nokogiri package, versions [,1.19.4)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.4% (34th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Use After Free vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-UNMANAGED-NOKOGIRI-17391924
  • published21 Jun 2026
  • disclosed19 Jun 2026
  • creditZheng Yu

Introduced: 19 Jun 2026

CVE-2026-57436  (opens in a new tab)
CWE-416  (opens in a new tab)

How to fix?

Upgrade nokogiri to version 1.19.4 or higher.

Overview

Affected versions of this package are vulnerable to Use After Free in the Document#root=. An attacker can cause invalid memory reads or potentially a segmentation fault by assigning a non-element node, such as a DTD, as the document root.

Note: This is only exploitable if application code explicitly assigns a non-element node to Document#root=; it cannot be triggered by untrusted input or normal API usage.

Workaround

This vulnerability can be mitigated by avoiding assignment of non-element nodes, such as DTDs, via Document#root=.

CVSS Base Scores

version 4.0
version 3.1