Skip to content

nokogiri

Nokogiri: Possible Use-After-Free when directly using `NokogirI::XML::XPathContext` beyond document lifetime

CVE-2026-57437Published 25 Jun 2026, 14:34 UTC

Real-world risk

1.1/ 10Low

Routine

If the vulnerable configuration applies to you: 2.6

PreliminaryFrom the CVSS vector only · confidence low

CVSS

1.7

scored by the vendor (CNA), CVSS 4.0

In plain words

No plain-language summary yet. The original description is below.

Original description (from GitHub_M)

Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, Nokogiri::XML::XPathContext did not keep its source document alive for garbage collection. If an XPathContext outlived its document and the document was collected, evaluating an XPath expression could read invalid memory and potentially segfault. This is only reachable when application code constructs an XPathContext directly and lets the document become unreachable while continuing to use the context. The normal Document#xpath, #css, and related search methods are not affected, and it is not triggerable by malicious document input. This vulnerability is fixed in 1.19.4.

Am I affected?

ProductAffected versions (from the sources)Fixed in
nokogiriNiche< 1.19.41.19.4

What to do

Update to a fixed version: 1.19.4.

Why this score

FactorValueEvidence×
ImpactMinorReflected XSS, CSRF with low effect, open redirect, minor leakFrom the CVSS vector0.30
Attacker positionInternetAnyone on the Internet can reach a typical deploymentFrom the CVSS vector1.00
Privileges neededNoneNo accountFrom the CVSS vector1.00
Victim interactionNoneNothingFrom the CVSS vector1.00
ConfigurationUncommonNeeds a non-default feature that a minority enablesFrom the CVSS vector0.45
ReliabilityReliableDeterministic: injection, logic bug, path traversalFrom the CVSS vector1.00

Threat level T1: Nothing known (× 0.85)

The default for a new disclosure

EPSS 0.3% chance of exploitation in 30 days (percentile 27), as of 2026-12-05.

The arithmetic
  1. Prerequisites multiplied together0.450
  2. Threat T1: Nothing known0.850
  3. 10 × impact 0.3 × prerequisites 0.45 × threat 0.851.147
  4. Rounded to one decimal between 0.1 and 101.1

How the score works

Exploitation and evidence timeline

  1. 25 Jun 2026 Published
  2. 3 Dec 2026 Risk 1.1 (cvss fallback)

Weakness

CWE-416

References

Get alerts for nokogiri

Free email or text alerts when a vulnerability in nokogiri reaches risk 8 or higher. Nothing else.