p PatchFirst

CVE-2026-57236

CVE-2026-57236 · Nokogiri: Possible Use-After-Free when `Nokogiri::XML::Document#encoding=` raises an exception

CVSS 1.7 · Low · EPSS 0.4% · Fix available

Compare with your installed version

Affected products and known fixed versions are public information. Compare them with your installed version.

Check the installed version:

apk list -I -o ruby-nokogiri
dpkg-query -W -f='${source:Package} ${binary:Package} ${Version}\n' | awk '$1=="ruby-nokogiri"'

Assess your server’s risks

The free check gives you a rating and a risk summary by technology stack, without signing up. It does not answer whether this particular vulnerability affects you.

Monitoring matches public information against your servers’ software. Detailed findings for your servers include the order of updates.

curl -fsSL https://patchfirst.dev/check.sh | sh
Check your server for free →

Channels carry general technology news; monitoring reports new findings on your servers in your dashboard, through browser notifications, in Telegram or via a webhook.

This page contains facts from public vulnerability sources. Check the original advisory before updating.

Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, calling Document#encoding= with an invalid encoding (e.g., a non-string, or a string containing a null byte) raises an exception, but only after freeing the document's current encoding string without replacing it. The document is left referencing freed memory, so the next call to Document#encoding reads invalid memory, which can cause a segfault or leak freed bytes into a Ruby String. Affects the CRuby (libxml2) implementation only; JRuby is not affected. This vulnerability is fixed in 1.19.4.

Published
Updated

Fixes in distributions

  • RHSA-2026:50263 · Red Hat satellite 6.18 el9, Red Hat satellite capsule 6.18 el9 ·
  • RHSA-2026:50222 · Red Hat satellite 6.17 el9, Red Hat satellite capsule 6.17 el9 ·
  • RHSA-2026:50223 · Red Hat satellite 6.16 el8, Red Hat satellite 6.16 el9, Red Hat satellite capsule 6.16 el8, Red Hat satellite capsule 6.16 el9 ·
  • RHSA-2026:50221 · Red Hat satellite 6.19 el9, Red Hat satellite capsule 6.19 el9 ·

Stack: system · ruby

Affected products and versions

  • nokogiri

    Versions
    • < 1.19.4: Affected

    No fix published

  • ruby-nokogiri Alpine 3.24

    Affected ranges
    • ECOSYSTEM: < 1.19.4-r0

    Update to 1.19.4-r0

  • ruby-nokogiri Debian 12

    Versions
    • 1.13.10+dfsg-2
    • 1.14.2+dfsg-1
    • 1.14.3+dfsg-1
    • 1.14.3+dfsg-2
    • 1.15.4+dfsg-1
    • 1.16.0+dfsg-1
    All versions (17)
    • 1.16.0+dfsg-2
    • 1.16.2+dfsg-1
    • 1.16.4+dfsg-1
    • 1.17.2+dfsg-1~exp1
    • 1.18.10+dfsg-1
    • 1.18.10+dfsg-2
    • 1.18.10+dfsg-3
    • 1.18.2+dfsg-1
    • 1.19.1+dfsg-1
    • 1.19.3+dfsg-1
    • 1.19.4+dfsg-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Debian 13

    Versions
    • 1.18.10+dfsg-1
    • 1.18.10+dfsg-2
    • 1.18.10+dfsg-3
    • 1.18.2+dfsg-1
    • 1.19.1+dfsg-1
    • 1.19.3+dfsg-1
    All versions (7)
    • 1.19.4+dfsg-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Debian 14

    Versions
    • 1.18.10+dfsg-1
    • 1.18.10+dfsg-2
    • 1.18.10+dfsg-3
    • 1.18.2+dfsg-1
    • 1.19.1+dfsg-1
    • 1.19.3+dfsg-1
    Affected ranges
    • ECOSYSTEM: < 1.19.4+dfsg-1

    Update to 1.19.4+dfsg-1

  • nokogiri RubyGems

    Versions
    • 1.0.0
    • 1.0.1
    • 1.0.2
    • 1.0.3
    • 1.0.4
    • 1.0.5
    All versions (194)
    • 1.0.6
    • 1.0.7
    • 1.1.0
    • 1.1.1
    • 1.10.0
    • 1.10.0.rc1
    • 1.10.1
    • 1.10.10
    • 1.10.2
    • 1.10.3
    • 1.10.4
    • 1.10.5
    • 1.10.6
    • 1.10.7
    • 1.10.8
    • 1.10.9
    • 1.11.0
    • 1.11.0.rc1
    • 1.11.0.rc2
    • 1.11.0.rc3
    • 1.11.0.rc4
    • 1.11.1
    • 1.11.2
    • 1.11.3
    • 1.11.4
    • 1.11.5
    • 1.11.6
    • 1.11.7
    • 1.12.0
    • 1.12.0.rc1
    • 1.12.1
    • 1.12.2
    • 1.12.3
    • 1.12.4
    • 1.12.5
    • 1.13.0
    • 1.13.1
    • 1.13.10
    • 1.13.2
    • 1.13.3
    • 1.13.4
    • 1.13.5
    • 1.13.6
    • 1.13.7
    • 1.13.8
    • 1.13.9
    • 1.14.0
    • 1.14.0.rc1
    • 1.14.1
    • 1.14.2
    • 1.14.3
    • 1.14.4
    • 1.14.5
    • 1.15.0
    • 1.15.1
    • 1.15.2
    • 1.15.3
    • 1.15.4
    • 1.15.5
    • 1.15.6
    • 1.15.7
    • 1.16.0
    • 1.16.0.rc1
    • 1.16.1
    • 1.16.2
    • 1.16.3
    • 1.16.4
    • 1.16.5
    • 1.16.6
    • 1.16.7
    • 1.16.8
    • 1.17.0
    • 1.17.1
    • 1.17.2
    • 1.18.0
    • 1.18.0.rc1
    • 1.18.1
    • 1.18.10
    • 1.18.2
    • 1.18.3
    • 1.18.4
    • 1.18.5
    • 1.18.6
    • 1.18.7
    • 1.18.8
    • 1.18.9
    • 1.19.0
    • 1.19.1
    • 1.19.2
    • 1.19.3
    • 1.2.0
    • 1.2.1
    • 1.2.2
    • 1.2.3
    • 1.3.0
    • 1.3.1
    • 1.3.2
    • 1.3.3
    • 1.4.0
    • 1.4.1
    • 1.4.2
    • 1.4.2.1
    • 1.4.3
    • 1.4.3.1
    • 1.4.4
    • 1.4.4.1
    • 1.4.4.2
    • 1.4.5
    • 1.4.6
    • 1.4.7
    • 1.5.0
    • 1.5.0.beta.1
    • 1.5.0.beta.2
    • 1.5.0.beta.3
    • 1.5.0.beta.4
    • 1.5.1
    • 1.5.1.rc1
    • 1.5.10
    • 1.5.11
    • 1.5.2
    • 1.5.3
    • 1.5.3.rc2
    • 1.5.3.rc3
    • 1.5.3.rc4
    • 1.5.3.rc5
    • 1.5.3.rc6
    • 1.5.4
    • 1.5.4.rc1
    • 1.5.4.rc2
    • 1.5.4.rc3
    • 1.5.5
    • 1.5.5.rc1
    • 1.5.5.rc2
    • 1.5.5.rc3
    • 1.5.6
    • 1.5.6.rc1
    • 1.5.6.rc2
    • 1.5.6.rc3
    • 1.5.7
    • 1.5.7.rc1
    • 1.5.7.rc2
    • 1.5.7.rc3
    • 1.5.8
    • 1.5.9
    • 1.6.0
    • 1.6.0.rc1
    • 1.6.1
    • 1.6.2
    • 1.6.2.1
    • 1.6.2.rc1
    • 1.6.2.rc2
    • 1.6.2.rc3
    • 1.6.3
    • 1.6.3.1
    • 1.6.3.rc1
    • 1.6.3.rc2
    • 1.6.3.rc3
    • 1.6.4
    • 1.6.4.1
    • 1.6.5
    • 1.6.6.1
    • 1.6.6.2
    • 1.6.6.3
    • 1.6.6.4
    • 1.6.7
    • 1.6.7.1
    • 1.6.7.2
    • 1.6.7.rc2
    • 1.6.7.rc3
    • 1.6.7.rc4
    • 1.6.8
    • 1.6.8.1
    • 1.6.8.rc1
    • 1.6.8.rc2
    • 1.6.8.rc3
    • 1.7.0
    • 1.7.0.1
    • 1.7.1
    • 1.7.2
    • 1.8.0
    • 1.8.1
    • 1.8.2
    • 1.8.3
    • 1.8.4
    • 1.8.5
    • 1.9.0
    • 1.9.0.rc1
    • 1.9.1
    Affected ranges
    • ECOSYSTEM: < 1.19.4

    Update to 1.19.4

  • ruby-nokogiri Ubuntu Pro 14.04 LTS

    Versions
    • 1.5.9-2
    • 1.5.9-3
    • 1.6.0-1
    • 1.6.1+ds-1
    • 1.6.1+ds-1ubuntu0.1~esm1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu 16.04 LTS

    Versions
    • 1.6.6.2+ds-2build2
    • 1.6.6.3-1
    • 1.6.7-1
    • 1.6.7.1-1
    • 1.6.7.2-3
    • 1.6.7.2-3build1
    All versions (7)
    • 1.6.7.2-3ubuntu0.1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu 18.04 LTS

    Versions
    • 1.8.0-1
    • 1.8.1-1
    • 1.8.1-1build1
    • 1.8.2-1build1
    • 1.8.2-1ubuntu0.1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu Pro 20.04 LTS

    Versions
    • 1.10.3+dfsg1-2
    • 1.10.4+dfsg1-1
    • 1.10.7+dfsg1-1
    • 1.10.7+dfsg1-2
    • 1.10.7+dfsg1-2build1
    • 1.10.7+dfsg1-2ubuntu0.1~esm2
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu Pro 22.04 LTS

    Versions
    • 1.11.1+dfsg-2ubuntu1
    • 1.11.7+dfsg-3
    • 1.11.7+dfsg-3build1
    • 1.13.1+dfsg-2
    • 1.13.1+dfsg-2ubuntu0.1~esm1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu 24.04 LTS

    Versions
    • 1.14.3+dfsg-2
    • 1.16.2+dfsg-1
    • 1.16.2+dfsg-1build1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu 25.10

    Versions
    • 1.16.4+dfsg-1build1
    • 1.18.2+dfsg-1build1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu 26.10

    Versions
    • 1.18.10+dfsg-3
    • 1.19.1+dfsg-1
    • 1.19.3+dfsg-1
    • 1.19.4+dfsg-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • ruby-nokogiri Ubuntu 26.04 LTS

    Versions
    • 1.18.2+dfsg-1build1
    • 1.18.10+dfsg-2
    • 1.18.10+dfsg-3
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

Original sources

Check your server →