Ruby/nokogiri/1.13.8
Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is fast and standards-compliant by relying on native parsers like libxml2, libgumbo, or xerces.
https://rubygems.org/gems/nokogiri
MIT
12 Security Vulnerabilities
Update bundled libxml2 to v2.10.3 to resolve multiple CVEs
Summary
Nokogiri v1.13.9 upgrades the packaged version of its dependency libxml2 to v2.10.3 from v2.9.14.
libxml2 v2.10.3 addresses the following known vulnerabilities:
Please note that this advisory only applies to the CRuby implementation of Nokogiri < 1.13.9
, and only if the packaged libraries are being used. If you've overridden defaults at installation time to use system libraries instead of packaged libraries, you should instead pay attention to your distro's libxml2
release announcements.
Mitigation
Upgrade to Nokogiri >= 1.13.9
.
Users who are unable to upgrade Nokogiri may also choose a more complicated mitigation: compile and link Nokogiri against external libraries libxml2 >= 2.10.3
which will also address these same issues.
Impact
libxml2 CVE-2022-2309
- CVSS3 score: Under evaluation
- Type: Denial of service
- Description: NULL Pointer Dereference allows attackers to cause a denial of service (or application crash). This only applies when lxml is used together with libxml2 2.9.10 through 2.9.14. libxml2 2.9.9 and earlier are not affected. It allows triggering crashes through forged input data, given a vulnerable code sequence in the application. The vulnerability is caused by the iterwalk function (also used by the canonicalize function). Such code shouldn't be in wide-spread use, given that parsing + iterwalk would usually be replaced with the more efficient iterparse function. However, an XML converter that serialises to C14N would also be vulnerable, for example, and there are legitimate use cases for this code sequence. If untrusted input is received (also remotely) and processed via iterwalk function, a crash can be triggered.
Nokogiri maintainers investigated at #2620 and determined this CVE does not affect Nokogiri users.
libxml2 CVE-2022-40304
- CVSS3 score: Unspecified upstream
- Type: Data corruption, denial of service
- Description: When an entity reference cycle is detected, the entity content is cleared by setting its first byte to zero. But the entity content might be allocated from a dict. In this case, the dict entry becomes corrupted leading to all kinds of logic errors, including memory errors like double-frees.
See https://gitlab.gnome.org/GNOME/libxml2/-/commit/644a89e080bced793295f61f18aac8cfad6bece2
libxml2 CVE-2022-40303
- CVSS3 score: Unspecified upstream
- Type: Integer overflow
- Description: Integer overflows with XMLPARSEHUGE
See https://gitlab.gnome.org/GNOME/libxml2/-/commit/c846986356fc149915a74972bf198abc266bc2c0
References
Duplicate Advisory: Nokogiri updates packaged libxml2 to 2.13.6 to resolve CVE-2025-24928 and CVE-2024-56171
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-vvfq-8hwr-qm4m. This link is maintained to preserve external references.
Original Description
Summary
Nokogiri v1.18.3 upgrades its dependency libxml2 to v2.13.6.
libxml2 v2.13.6 addresses:
- CVE-2025-24928
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/847
- CVE-2024-56171
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/828
Impact
CVE-2025-24928
Stack-buffer overflow is possible when reporting DTD validation errors if the input contains a long (~3kb) QName prefix.
CVE-2024-56171
Use-after-free is possible during validation against untrusted
XML Schemas (.xsd) and, potentially, validation of untrusted documents
against trusted Schemas if they make use of xsd:keyref
in combination
with recursively defined types that have additional identity constraints.
Unchecked return value from xmlTextReaderExpand
- https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-qv4q-mr5r-qprj
- https://github.com/sparklemotion/nokogiri/commit/85410e38410f670cbbc8c5b00d07b843caee88ce
- https://github.com/sparklemotion/nokogiri/commit/9fe0761c47c0d4270d1a5220cfd25de080350d50
- https://github.com/advisories/GHSA-qv4q-mr5r-qprj
- https://nvd.nist.gov/vuln/detail/CVE-2022-23476
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2022-23476.yml
Summary
Nokogiri 1.13.8, 1.13.9
fails to check the return value from xmlTextReaderExpand
in the method Nokogiri::XML::Reader#attribute_hash
. This can lead to a null pointer exception when invalid markup is being parsed.
For applications using XML::Reader
to parse untrusted inputs, this may potentially be a vector for a denial of service attack.
Mitigation
Upgrade to Nokogiri >= 1.13.10
.
Users may be able to search their code for calls to either XML::Reader#attributes
or XML::Reader#attribute_hash
to determine if they are affected.
Severity
The Nokogiri maintainers have evaluated this as High Severity 7.5 (CVSS3.1).
References
Credit
This vulnerability was responsibly reported by @davidwilemski.
Duplicate Advisory: Nokogiri updates packaged libxml2 to v2.12.7 to resolve CVE-2024-34459
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-r95h-9x8f-r3f7. This link is maintained to preserve external references.
Original Description
Summary
Nokogiri v1.16.5 upgrades its dependency libxml2 to 2.12.7 from 2.12.6.
libxml2 v2.12.7 addresses CVE-2024-34459:
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/720
- patched by https://gitlab.gnome.org/GNOME/libxml2/-/commit/2876ac53
Impact
There is no impact to Nokogiri users because the issue is present only
in libxml2's xmllint
tool which Nokogiri does not provide or expose.
Timeline
- 2024-05-13 05:57 EDT, libxml2 2.12.7 release is announced
- 2024-05-13 08:30 EDT, nokogiri maintainers begin triage
- 2024-05-13 10:05 EDT, nokogiri v1.16.5 is released and this GHSA made public
Use-after-free in libxml2 via Nokogiri::XML::Reader
Summary
Nokogiri upgrades its dependency libxml2 as follows: - v1.15.6 upgrades libxml2 to 2.11.7 from 2.11.6 - v1.16.2 upgrades libxml2 to 2.12.5 from 2.12.4
libxml2 v2.11.7 and v2.12.5 address the following vulnerability:
CVE-2024-25062 / https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-25062 - described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/604 - patched by https://gitlab.gnome.org/GNOME/libxml2/-/commit/92721970
Please note that this advisory only applies to the CRuby implementation of Nokogiri, and only if the packaged libraries are being used. If you've overridden defaults at installation time to use system libraries instead of packaged libraries, you should instead pay attention to your distro's libxml2 release announcements.
JRuby users are not affected.
Severity
The Nokogiri maintainers have evaluated this as Moderate.
Impact
From the CVE description, this issue applies to the xmlTextReader
module (which underlies
Nokogiri::XML::Reader
):
When using the XML Reader interface with DTD validation and XInclude expansion enabled, processing crafted XML documents can lead to an xmlValidatePopElement use-after-free.
Mitigation
Upgrade to Nokogiri ~> 1.15.6
or >= 1.16.2
.
Users who are unable to upgrade Nokogiri may also choose a more complicated mitigation: compile and link Nokogiri against patched external libxml2 libraries which will also address these same issues.
Unchecked return value from xmlTextReaderExpand
Summary
Nokogiri 1.13.8, 1.13.9
fails to check the return value from xmlTextReaderExpand
in the method Nokogiri::XML::Reader#attribute_hash
. This can lead to a null pointer exception when invalid markup is being parsed.
For applications using XML::Reader
to parse untrusted inputs, this may potentially be a vector for a denial of service attack.
Mitigation
Upgrade to Nokogiri >= 1.13.10
.
Users may be able to search their code for calls to either XML::Reader#attributes
or XML::Reader#attribute_hash
to determine if they are affected.
Severity
The Nokogiri maintainers have evaluated this as High Severity 7.5 (CVSS3.1).
References
Credit
This vulnerability was responsibly reported by @davidwilemski.
Nokogiri updates packaged libxml2 to v2.13.8 to resolve CVE-2025-32414 and CVE-2025-32415
Summary
Nokogiri v1.18.8 upgrades its dependency libxml2 to v2.13.8.
libxml2 v2.13.8 addresses:
- CVE-2025-32414
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/889
- CVE-2025-32415
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/890
Impact
CVE-2025-32414: No impact
In libxml2 before 2.13.8 and 2.14.x before 2.14.2, out-of-bounds memory access can occur in the Python API (Python bindings) because of an incorrect return value. This occurs in xmlPythonFileRead and xmlPythonFileReadRaw because of a difference between bytes and characters.
There is no impact from this CVE for Nokogiri users.
CVE-2025-32415: Low impact
In libxml2 before 2.13.8 and 2.14.x before 2.14.2, xmlSchemaIDCFillNodeTables in xmlschemas.c has a heap-based buffer under-read. To exploit this, a crafted XML document must be validated against an XML schema with certain identity constraints, or a crafted XML schema must be used.
In the upstream issue, further context is provided by the maintainer:
The bug affects validation against untrusted XML Schemas (.xsd) and validation of untrusted documents against trusted Schemas if they make use of xsd:keyref in combination with recursively defined types that have additional identity constraints.
MITRE has published a severity score of 2.9 LOW (CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L) for this CVE.
Nokogiri updates packaged libxslt to v1.1.43 to resolve multiple CVEs
Summary
Nokogiri v1.18.4 upgrades its dependency libxslt to v1.1.43.
libxslt v1.1.43 resolves:
- CVE-2025-24855: Fix use-after-free of XPath context node
- CVE-2024-55549: Fix UAF related to excluded namespaces
Impact
CVE-2025-24855
Use-after-free due to xsltEvalXPathStringNs leaking xpathCtxt->node
- MITRE has rated this 7.8 High CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:H
- Upstream report: https://gitlab.gnome.org/GNOME/libxslt/-/issues/128
- NVD entry: https://nvd.nist.gov/vuln/detail/CVE-2025-24855
CVE-2024-55549
Use-after-free related to excluded result prefixes
- MITRE has rated this 7.8 High CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:H
- Upstream report: https://gitlab.gnome.org/GNOME/libxslt/-/issues/127
- NVD entry: https://nvd.nist.gov/vuln/detail/CVE-2024-55549
Update packaged libxml2 to v2.10.4 to resolve multiple CVEs
Summary
Nokogiri v1.14.3 upgrades the packaged version of its dependency libxml2 to v2.10.4 from v2.10.3.
libxml2 v2.10.4 addresses the following known vulnerabilities:
- CVE-2023-29469: Hashing of empty dict strings isn't deterministic
- CVE-2023-28484: Fix null deref in xmlSchemaFixupComplexType
- Schemas: Fix null-pointer-deref in xmlSchemaCheckCOSSTDerivedOK
Please note that this advisory only applies to the CRuby implementation of Nokogiri < 1.14.3
,
and only if the packaged libraries are being used. If you've overridden defaults at installation
time to use system libraries instead of packaged libraries, you should instead pay attention to
your distro's libxml2
release announcements.
Mitigation
Upgrade to Nokogiri >= 1.14.3
.
Users who are unable to upgrade Nokogiri may also choose a more complicated mitigation: compile
and link Nokogiri against external libraries libxml2 >= 2.10.4
which will also address these
same issues.
Impact
No public information has yet been published about the security-related issues other than the upstream commits. Examination of those changesets indicate that the more serious issues relate to libxml2 dereferencing NULL pointers and potentially segfaulting while parsing untrusted inputs.
The commits can be examined at:
- [CVE-2023-29469] Hashing of empty dict strings isn't deterministic (09a2dd45)
- [CVE-2023-28484] Fix null deref in xmlSchemaFixupComplexType (647e072e)
- schemas: Fix null-pointer-deref in xmlSchemaCheckCOSSTDerivedOK (4c6922f7)
Nokogiri updates packaged libxml2 to v2.12.7 to resolve CVE-2024-34459
Summary
Nokogiri v1.16.5 upgrades its dependency libxml2 to 2.12.7 from 2.12.6.
libxml2 v2.12.7 addresses CVE-2024-34459:
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/720
- patched by https://gitlab.gnome.org/GNOME/libxml2/-/commit/2876ac53
Impact
There is no impact to Nokogiri users because the issue is present only
in libxml2's xmllint
tool which Nokogiri does not provide or expose.
Timeline
- 2024-05-13 05:57 EDT, libxml2 2.12.7 release is announced
- 2024-05-13 08:30 EDT, nokogiri maintainers begin triage
- 2024-05-13 10:05 EDT, nokogiri v1.16.5 is released and this GHSA made public
Nokogiri updates packaged libxml2 to 2.13.6 to resolve CVE-2025-24928 and CVE-2024-56171
Summary
Nokogiri v1.18.3 upgrades its dependency libxml2 to v2.13.6.
libxml2 v2.13.6 addresses:
- CVE-2025-24928
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/847
- CVE-2024-56171
- described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/828
Impact
CVE-2025-24928
Stack-buffer overflow is possible when reporting DTD validation errors if the input contains a long (~3kb) QName prefix.
CVE-2024-56171
Use-after-free is possible during validation against untrusted
XML Schemas (.xsd) and, potentially, validation of untrusted documents
against trusted Schemas if they make use of xsd:keyref
in combination
with recursively defined types that have additional identity constraints.
Use-after-free in libxml2 via Nokogiri::XML::Reader
Summary
Nokogiri upgrades its dependency libxml2 as follows: - v1.15.6 upgrades libxml2 to 2.11.7 from 2.11.6 - v1.16.2 upgrades libxml2 to 2.12.5 from 2.12.4
libxml2 v2.11.7 and v2.12.5 address the following vulnerability:
CVE-2024-25062 / https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-25062 - described at https://gitlab.gnome.org/GNOME/libxml2/-/issues/604 - patched by https://gitlab.gnome.org/GNOME/libxml2/-/commit/92721970
Please note that this advisory only applies to the CRuby implementation of Nokogiri, and only if the packaged libraries are being used. If you've overridden defaults at installation time to use system libraries instead of packaged libraries, you should instead pay attention to your distro's libxml2 release announcements.
JRuby users are not affected.
Severity
The Nokogiri maintainers have evaluated this as Moderate.
Impact
From the CVE description, this issue applies to the xmlTextReader
module (which underlies
Nokogiri::XML::Reader
):
When using the XML Reader interface with DTD validation and XInclude expansion enabled, processing crafted XML documents can lead to an xmlValidatePopElement use-after-free.
Mitigation
Upgrade to Nokogiri ~> 1.15.6
or >= 1.16.2
.
Users who are unable to upgrade Nokogiri may also choose a more complicated mitigation: compile and link Nokogiri against patched external libxml2 libraries which will also address these same issues.
188 Other Versions
Version | License | Security | Released | |
---|---|---|---|---|
1.18.8 | MIT | 2025-04-21 - 19:13 | 2 months | |
1.18.7 | MIT | 1 | 2025-03-31 - 17:48 | 3 months |
1.18.6 | MIT | 1 | 2025-03-24 - 19:36 | 3 months |
1.18.5 | MIT | 1 | 2025-03-19 - 14:43 | 3 months |
1.18.4 | MIT | 1 | 2025-03-14 - 15:42 | 4 months |
1.18.3 | MIT | 2 | 2025-02-18 - 22:20 | 4 months |
1.18.2 | MIT | 4 | 2025-01-19 - 20:31 | 5 months |
1.18.1 | MIT | 4 | 2024-12-29 - 22:30 | 6 months |
1.18.0 | MIT | 4 | 2024-12-25 - 16:23 | 6 months |
1.18.0.rc1 | MIT | 4 | 2024-12-16 - 17:48 | 7 months |
1.17.2 | MIT | 4 | 2024-12-12 - 21:22 | 7 months |
1.17.1 | MIT | 4 | 2024-12-10 - 14:36 | 7 months |
1.17.0 | MIT | 4 | 2024-12-08 - 20:39 | 7 months |
1.16.8 | MIT | 4 | 2024-12-02 - 20:17 | 7 months |
1.16.7 | MIT | 4 | 2024-07-27 - 19:52 | 11 months |
1.16.6 | MIT | 4 | 2024-06-13 - 13:46 | about 1 year |
1.16.5 | MIT | 4 | 2024-05-13 - 14:01 | about 1 year |
1.16.4 | MIT | 6 | 2024-04-10 - 18:17 | about 1 year |
1.16.3 | MIT | 6 | 2024-03-15 - 21:21 | over 1 year |
1.16.2 | MIT | 6 | 2024-02-04 - 16:52 | over 1 year |
1.16.1 | MIT | 8 | 2024-02-03 - 16:27 | over 1 year |
1.16.0 | MIT | 8 | 2023-12-28 - 00:08 | over 1 year |
1.16.0.rc1 | MIT | 7 | 2023-12-13 - 22:00 | over 1 year |
1.15.7 | MIT | 6 | 2024-12-02 - 20:32 | 7 months |
1.15.6 | MIT | 6 | 2024-03-16 - 13:14 | over 1 year |
1.15.5 | MIT | 7 | 2023-11-17 - 16:13 | over 1 year |
1.15.4 | MIT | 7 | 2023-08-11 - 19:25 | almost 2 years |
1.15.3 | MIT | 7 | 2023-07-05 - 14:34 | almost 2 years |
1.15.2 | MIT | 7 | 2023-05-24 - 13:31 | about 2 years |
1.15.1 | MIT | 7 | 2023-05-19 - 14:06 | about 2 years |
1.15.0 | MIT | 7 | 2023-05-15 - 19:57 | about 2 years |
1.14.5 | MIT | 8 | 2023-05-24 - 13:04 | about 2 years |
1.14.4 | MIT | 8 | 2023-05-11 - 18:12 | about 2 years |
1.14.3 | MIT | 8 | 2023-04-11 - 17:00 | about 2 years |
1.14.2 | MIT | 9 | 2023-02-13 - 17:41 | over 2 years |
1.14.1 | MIT | 9 | 2023-01-30 - 19:40 | over 2 years |
1.14.0 | MIT | 9 | 2023-01-12 - 21:52 | over 2 years |
1.14.0.rc1 | MIT | 9 | 2022-12-29 - 15:47 | over 2 years |
1.13.10 | MIT | 9 | 2022-12-08 - 02:47 | over 2 years |
1.13.9 | MIT | 11 | 2022-10-18 - 15:48 | over 2 years |
1.13.8 | MIT | 12 | 2022-07-23 - 15:50 | almost 3 years |
1.13.7 | MIT | 10 | 2022-07-12 - 14:56 | almost 3 years |
1.13.6 | MIT | 10 | 2022-05-08 - 14:34 | about 3 years |
1.13.5 | MIT | 12 | 2022-05-04 - 20:41 | about 3 years |
1.13.4 | MIT | 13 | 2022-04-11 - 20:44 | about 3 years |
1.13.3 | MIT | 22 | 2022-02-22 - 04:52 | over 3 years |
1.13.2 | MIT | 22 | 2022-02-21 - 18:52 | over 3 years |
1.13.1 | MIT | 25 | 2022-01-13 - 16:04 | over 3 years |
1.13.0 | MIT | 25 | 2022-01-06 - 20:53 | over 3 years |
1.12.5 | MIT | 25 | 2021-09-27 - 19:03 | almost 4 years |