NokogiriApplication

CVE-2026-57436

MEDIUM · 5.3 CVSS v3.1 Published 2026-06-25
Fix available
A fix is available. Upgrade to 1.19.4 or later.
See remediation →
62/100
Remediation priority · Elevated
Remotely reachable No privileges Zero-click 8 weeks old

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, Nokogiri::XML::Document#root= validated only that the new root was a Nokogiri::XML::Node, allowing a DTD node to be set as the document root. The result is a heap use-after-free during garbage collection or finalization, leading to an invalid memory read or potentially a segfault. This vulnerability is fixed in 1.19.4.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

In Nokogiri versions prior to 1.19.4, the Document#root= setter only validated that the assigned node was a Nokogiri::XML::Node but failed to exclude DTD (Document Type Definition) nodes. When a DTD node is set as the document root, garbage collection or finalization triggers a heap use-after-free vulnerability, causing invalid memory reads or potential segfaults.

MitigationUpgrade Nokogiri to version 1.19.4 or later to receive the patch that adds proper node type validation to reject DTD nodes as document roots. Test thoroughly after upgrading to ensure compatibility with existing XML processing workflows.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
NokogiriApplication
Affected:< 1.19.4

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Check installed Nokogiri version
    Run `gem list nokogiri` or in Ruby: `require 'nokogiri'; puts Nokogiri::VERSION`
    Affected if Version is lower than 1.19.4 (e.g., 1.19.3, 1.18.x, etc.)
  2. Locate usage of Document#root= setter
    Search codebase for calls to `.root =` on Nokogiri::XML::Document objects, or search for `doc.root =` patterns in Ruby files
    Affected if Code assigns a value to document.root using the setter method
  3. Identify if DTD nodes are being assigned as root
    Search for patterns where a DTD node (e.g., result of `doc.children.find { |n| n.class == Nokogiri::XML::DTD }` or similar DTD retrieval) is passed to the root= setter
    Affected if Any code path passes a DTD node object to the root= setter, triggering the vulnerable code path
  4. Verify Ruby garbage collection behavior
    The vulnerability triggers during garbage collection or finalization of the DTD node, typically observable during document lifecycle operations or scope exits
    Affected if Application processes XML documents where DTD nodes could be set as root, and experiences segfaults or memory errors during GC cycles

Environment is affected if Nokogiri version is below 1.19.4 AND code uses Document#root= setter with potential DTD node assignment, leading to use-after-free during garbage collection.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 1.19.4 or later
Fixed in 1.19.4
Interim mitigation

Upgrade Nokogiri to version 1.19.4 or later to receive the patch that adds proper node type validation to reject DTD nodes as document roots. Test thoroughly after upgrading to ensure compatibility with existing XML processing workflows.

Recommended fix High confidence

Nokogiri 1.19.4

  1. Run `gem install nokogiri -v 1.19.4` to install the fixed version
  2. If using Bundler, update your Gemfile or Gemfile.lock to specify `gem 'nokogiri', '~> 1.19.4'` and run `bundle install`
  3. Verify the installed version by running `gem list nokogiri` or `Nokogiri::VERSION` in Ruby
  4. Test your application to confirm the upgrade does not introduce regressions
  5. If using a Gemfile.lock, consider running `bundle update nokogiri` to ensure the lock file reflects the new version
Caveat No breaking changes documented for this security release; however, test thoroughly as with any upgrade

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Nokogiri Scoped from the published advisory
  • Consultation2.0 h
  • Implementation2.0 h
  • Testing4.0 h
  • Review / QA2.0 h
10.0 hours of engineering $1,720
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,752.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2026-57436 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2026-57436 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data