Nokogiri vulnerabilities
18 known CVE vulnerabilities in Nokogiri, translated and rated.
- GHSA-5prr-v3j2-97mhMedium
A vulnerability in the Nokogiri library affects the `Nokogiri::XML::NodeSet#[]` method (and its alias `#slice`). The index check against the node set's bounds used a 32-bit-truncated copy of the index, allowing a large negative index to pass the check and then be used at full width, reading outside the node set's storage.
- GHSA-5v8h-3h3q-446pLow
A vulnerability in the Nokogiri library allows calling `Document#encoding=` with an invalid encoding (e.g., a non-string or a string containing a null byte), which frees the document's current encoding string without replacing it. The document is left referencing freed memory, leading to a use-after-free condition on the next call.
- GHSA-8678-w3jw-xfc2Low
The vulnerability in the Nokogiri library for JRuby causes the NONET option to be incorrectly enforced when parsing XML schemas. This allows an attacker to load external network resources, potentially leading to data leakage or SSRF attacks.
- GHSA-9cv2-cfxc-v4v2Low
Nokogiri has a bug in methods called on allocated-but-uninitialized native wrapper classes inheriting from `Nokogiri::XML::Node`. This causes a NULL pointer dereference that could crash the process.
- GHSA-p67v-3w7g-wjg7Low
The vulnerability in the Nokogiri library causes `Nokogiri::XML::XPathContext` to not keep its source document alive for garbage collection. If an XPathContext outlives its document and the document is collected, evaluating an XPath expression could read invalid memory and potentially segfault.
- GHSA-phwj-rprq-35ppLow
Nokogiri's CRuby native extension could leave a Ruby wrapper pointing to freed memory when replacing the value of an XML attribute. If Ruby code had already accessed an attribute child node, `Nokogiri::XML::Attr#value=` could free the underlying native child node while the wrapper remains.
- GHSA-wjv4-x9w8-wm3hLow
A vulnerability in the Nokogiri library allows a DTD node to be set as the document root, leading to a heap use-after-free during garbage collection or finalization. This results in an invalid memory read or potentially a segfault.
- GHSA-wfpw-mmfh-qq69Low
The vulnerability in the Nokogiri library affects the `Nokogiri::XML::Node#do_xinclude` method, which during XInclude processing removes `<xi:include>` nodes along with their children (e.g., `<xi:fallback>`) and declared namespaces. If an application previously accessed these nodes, unexpected behavior may occur.
- GHSA-g9g8-vgvw-g3vfUnknown
The vulnerability in the Nokogiri library affects the protected copy helper used by Node#dup and #clone methods. It unwrapped the source argument as an xmlNode without a type check, causing an out-of-bounds read on xmlNs structure and process crash when a non-Node object (e.g. Namespace) was supplied. Version 1.19.4 adds a type check and raises TypeError.
- CVE-2026-126064Low
In Nokogiri (CRuby), replacing an attribute value via Node#[]= or Node#lang= after code has accessed the attribute's child nodes frees native child nodes while their Ruby wrappers remain reachable. Later use of those wrappers can cause an invalid read or process segfault. JRuby is not affected.
- CVE-2026-126063Low
In Nokogiri (CRuby and TruffleRuby), the HTML5 serializer does not escape text inside noscript elements or angle brackets inside attribute values. When an application sanitizes untrusted HTML with default options, allows noscript, and sends serialized output to a scripting-enabled browser, the browser can parse markup Nokogiri did not produce, enabling mutation cross-site scripting. JRuby is not affected.
- CVE-2026-126062Low
In Nokogiri on JRuby, applications parsing untrusted XML with DTDLOAD, DTDVALID, or NOENT can have the NONET restriction bypassed when an external DTD or entity uses a short-form IPv4 host or absolute paths resolved against a network URL. The resolver can treat these identifiers as local and send a network request, potentially enabling server-side request forgery. CRuby and default parse options are not affected.
- CVE-2026-79772Medium
Nokogiri versions before 1.19.1 fail to check the return value from xmlC14NExecute in the canonicalize method, returning an empty string on failure instead of raising an exception. Attackers can exploit this to bypass signature validation in downstream SAML libraries by providing invalid canonicalized XML that is incorrectly accepted as valid.
- CVE-2026-79771Medium
Nokogiri versions before 1.19.3 contain a memory leak in the XSLT Stylesheet transform method when processing Ruby strings containing null bytes. Attackers can exploit this by passing attacker-controlled input with null bytes to transform parameters, causing heap allocations to leak and enabling denial of service against long-running processes.
- CVE-2026-79770High
Nokogiri versions before 1.19.3 contain regular expression denial of service vulnerabilities in the CSS selector tokenizer affecting string-literal and identifier tokenization. Attackers can inject adversarial CSS selectors into methods like Node#css, Node#at_css, and Searchable#search to cause exponential regex backtracking and denial of service.
- CVE-2026-79769Medium
Nokogiri versions before 1.19.4 contain a possible invalid (out-of-bounds) memory read in the protected internal Node#initialize_copy_with_args helper behind Node#dup and #clone, which unwrapped its source argument as an xmlNode without a type check. If application code calls this protected method with a non-Node argument (e.g., a Namespace), it reads an xmlNs out of bounds, crashing the process. This is only triggerable by a programming error and cannot be triggered by untrusted input or normal use of the public API. Only CRuby is affected. Version 1.19.4 adds a type check and raises TypeError.
- CVE-2025-6494Low
A vulnerability was found in sparklemotion nokogiri (commit c29c920907366cb74af13b4dc2230e9c9e23b833). It affects the function hashmap_get_with_hash of the file gumbo-parser/src/hashmap.c, leading to a heap-based buffer overflow. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. The real existence of this vulnerability is still doubted at the moment. The patch is named ada4708e5a67114402cd3feb70a4e1d1d7cf773a.
- CVE-2025-6490Low
In the nokogiri library (sparklemotion), the function hashmap_set_with_hash in gumbo-parser/src/hashmap.c contains a heap-based buffer overflow. It requires local access, and the exploit has been publicly disclosed, though the real existence of the vulnerability is still doubted. The patch was merged into the main branch but never appeared in an official release.
Vulnerability data from NVD (NIST) · CISA KEV · EPSS

