Vulnerabilities in pkg:gem/nokogiri
PACKAGECVE-2026-79770 is a HIGH (CVSS 7.5) nokogiri css selector tokenizer has vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Nokogiri libraries in the RubyGems ecosystem. The issue involves nokogiri css selector tokenizer has regular expression backtracking. Remediation is available by upgrading affected packages to version 1.19.3.
pkg:gem/nokogiri
Vulnerability advisories affecting package pkg:gem/nokogiri. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-c4rq-3m3g-8wgx | CVE-2026-79770 | HIGH | Nokogiri CSS selector tokenizer has regular expression backtracking |
| GHSA-5jhf-fpp7-v2pv | - | HIGH | Duplicate Advisory: Nokogiri CSS selector tokenizer has regular expression backtracking |
| GHSA-v2fc-qm4h-8hqv | CVE-2026-79771 | MODERATE | Nokogiri XSLT transform has a memory leak |
| GHSA-rh9x-7xjc-vwx2 | - | MODERATE | Duplicate Advisory: Nokogiri XSLT transform has a memory leak |
| GHSA-wx95-c6cv-8532 | CVE-2026-79772 | MODERATE | Nokogiri does not check the return value from xmlC14NExecute |
| GHSA-xqqh-3w52-q8p7 | - | MODERATE | Duplicate Advisory: Nokogiri does not check the return value from xmlC14NExecute |
| GHSA-phwj-rprq-35pp | - | LOW | Nokogiri: Possible Use-After-Free when setting an attribute value via `Nokogiri::XML::Attr#value=` or `#content=` |
| GHSA-wfpw-mmfh-qq69 | - | LOW | Nokogiri: Possible Use-After-Free in XInclude Processing |
| GHSA-p67v-3w7g-wjg7 | - | LOW | Nokogiri: Possible Use-After-Free when directly using `NokogirI::XML::XPathContext` beyond document lifetime |
| GHSA-wjv4-x9w8-wm3h | - | LOW | Nokogiri: Possible Use-After-Free when setting `Document#root=` to an invalid node type |
| GHSA-5prr-v3j2-97mh | - | MODERATE | Nokogiri: Possible Out-of-Bounds Read in `Nokogiri::XML::NodeSet#[]` |
| GHSA-9cv2-cfxc-v4v2 | - | LOW | Nokogiri: Null Pointer Dereference calling methods on uninitialized wrapper classes |
| GHSA-8678-w3jw-xfc2 | - | LOW | Nokogiri: XML::Schema on JRuby allows network requests when NONET is set, bypassing CVE-2020-26247 |
| GHSA-5v8h-3h3q-446p | - | LOW | Nokogiri: Possible Use-After-Free when `Nokogiri::XML::Document#encoding=` raises an exception |
| GHSA-4hm9-844j-jmxp | CVE-2019-13117 | MODERATE | Uninitialized read in Nokogiri gem |
| GHSA-242x-7cm6-4w8j | CVE-2019-18197 | HIGH | Nokogiri affected by libxslt Use of Uninitialized Resource/Use After Free vulnerability |
| GHSA-cf46-6xxh-pc75 | CVE-2019-13118 | HIGH | libxslt Type Confusion vulnerability that affects Nokogiri |
| GHSA-qxcg-xjjg-66mj | CVE-2019-11068 | CRITICAL | Nokogiri vulnerable to libxslt protection mechanism bypass |
| GHSA-6qvp-r6r3-9p7h | CVE-2018-14404 | HIGH | Nokogiri NULL Pointer Dereference |
| GHSA-353f-x4gh-cqq8 | - | CRITICAL | Nokogiri patches vendored libxml2 to resolve multiple CVEs |
| GHSA-jc9r-qcgw-fxq9 | CVE-2025-6494 | LOW | sparklemotion nokogiri hashmap.c hashmap_get_with_hash heap-based overflow |
| GHSA-pf9w-gvcf-gv7m | CVE-2025-6490 | LOW | sparklemotion nokogiri hashmap.c hashmap_set_with_hash heap-based overflow |
| GHSA-xh29-r2w5-wx8m | CVE-2022-29181 | HIGH | Nokogiri Improperly Handles Unexpected Data Type |
| GHSA-vcc3-rw6f-jv97 | - | MODERATE | Duplicate Advisory: Use-after-free in libxml2 via Nokogiri::XML::Reader |
| GHSA-xc9x-jj77-9p9j | - | MODERATE | Nokogiri update packaged libxml2 to v2.12.5 to resolve CVE-2024-25062 |
| GHSA-5w6v-399v-w3cc | - | LOW | Nokogiri updates packaged libxml2 to v2.13.8 to resolve CVE-2025-32414 and CVE-2025-32415 |
| GHSA-mrxw-mxhj-p664 | - | HIGH | Nokogiri updates packaged libxslt to v1.1.43 to resolve multiple CVEs |
| GHSA-5mwf-688x-mr7x | - | LOW | Duplicate Advisory: Nokogiri updates packaged libxml2 to 2.13.6 to resolve CVE-2025-24928 and CVE-2024-56171 |
| GHSA-vvfq-8hwr-qm4m | - | LOW | Nokogiri updates packaged libxml2 to 2.13.6 to resolve CVE-2025-24928 and CVE-2024-56171 |
| GHSA-r3w4-36x6-7r99 | - | LOW | Duplicate Advisory: Nokogiri updates packaged libxml2 to v2.12.7 to resolve CVE-2024-34459 |
| GHSA-r95h-9x8f-r3f7 | - | LOW | Nokogiri updates packaged libxml2 to v2.12.7 to resolve CVE-2024-34459 |
| GHSA-cr5j-953j-xw5p | CVE-2019-5477 | CRITICAL | Nokogiri Command Injection Vulnerability |
| GHSA-jw9f-hh49-cvp9 | CVE-2021-3517 | HIGH | Nokogiri contains libxml Out-of-bounds Write vulnerability |
| GHSA-r58r-74gx-6wx3 | CVE-2017-15412 | HIGH | Nokogiri gem, via libxml, is affected by DoS vulnerabilities |
| GHSA-vmfx-gcfq-wvm2 | CVE-2019-5815 | HIGH | Nokogiri implementation of libxslt vulnerable to heap corruption |
| GHSA-v4f8-2847-rwm7 | CVE-2021-3518 | HIGH | Nokogiri Implements libxml2 version vulnerable to use-after-free |
| GHSA-286v-pcf5-25rc | CVE-2021-3537 | MODERATE | Nokogiri Implements libxml2 version vulnerable to null pointer dereferencing |
| GHSA-7rrm-v45f-jp64 | - | MODERATE | Nokogiri updates packaged dependency on libxml2 from 2.9.10 to 2.9.12 |
| GHSA-crjr-9rc5-ghw8 | CVE-2022-24836 | HIGH | Nokogiri Inefficient Regular Expression Complexity |
| GHSA-x7rv-cr6v-4vm4 | CVE-2018-8048 | MODERATE | Cross-site Scripting in loofah |
| GHSA-jxjr-5h69-qw3w | CVE-2015-7499 | MODERATE | Heap-based buffer overflow in nokogiri |
| GHSA-pf6m-fxpq-fg8v | CVE-2017-5029 | HIGH | Nokogiri implementation of libxslt lacks integer overflow checks |
| GHSA-7hp2-xwpj-95jq | CVE-2015-8806 | HIGH | Denial of service or RCE from libxml2 and libxslt |
| GHSA-jc36-42cf-vqwj | CVE-2018-25032 | HIGH | Nokogiri affected by zlib's Out-of-bounds Write vulnerability |
| GHSA-59gp-qqm7-cw4j | CVE-2021-30560 | HIGH | Nokogiri has vulnerable dependencies on libxml2 and libxslt |
| GHSA-x2fm-93ww-ggvx | CVE-2017-16932 | HIGH | Nokogiri gem, via libxml, is affected by DoS vulnerabilities |
| GHSA-62qp-3fxm-9wxf | CVE-2013-6460 | MODERATE | Nokogiri vulnerable to DoS while parsing XML documents |
| GHSA-jmhh-w7xp-wg39 | CVE-2013-6461 | MODERATE | Nokogiri vulnerable to DoS while parsing XML entities |
| GHSA-882p-jqgm-f45g | CVE-2017-18258 | MODERATE | Uncontrolled resource consumption in nokogiri |
| GHSA-pxvg-2qj5-37jq | - | MODERATE | Nokogiri updates packaged libxml2 to v2.10.4 to resolve multiple CVEs |
| GHSA-q7wx-62r7-j2x7 | CVE-2015-1819 | MODERATE | Nokogiri vulnerable to libxml XML Entity Expansion |
| GHSA-xjqg-9jvg-fgx2 | CVE-2015-5312 | HIGH | Nokogiri subject to DoS via libxml2 vulnerability |
| GHSA-6wj9-77wq-jq7p | CVE-2012-6685 | HIGH | Nokogiri is vulnerable to XML External Entity (XXE) attack |
| GHSA-qv4q-mr5r-qprj | CVE-2022-23476 | HIGH | Unchecked return value from xmlTextReaderExpand |
| GHSA-2qc6-mcvw-92cw | - | MODERATE | Update bundled libxml2 to v2.10.3 to resolve multiple CVEs |
| GHSA-vr8q-g5c7-m54m | CVE-2020-26247 | MODERATE | Nokogiri::XML::Schema trusts input by default, exposing risk of XXE vulnerability |
| GHSA-cgx6-hpwq-fhv5 | - | HIGH | Integer Overflow or Wraparound in libxml2 affects Nokogiri |
| GHSA-fr52-4hqw-p27f | CVE-2016-4658 | CRITICAL | Nokogiri does not forbid namespace nodes in XPointer ranges |
| GHSA-7553-jr98-vx47 | CVE-2020-7595 | HIGH | libxml as used in Nokogiri has an infinite loop in a certain end-of-file situation |
| GHSA-gx8x-g87m-h5q6 | - | HIGH | Denial of Service (DoS) in Nokogiri on JRuby |
| GHSA-xxx9-3xcr-gjj3 | - | MODERATE | XML Injection in Xerces Java affects Nokogiri |
| GHSA-v6gp-9mmm-c6p5 | - | HIGH | Out-of-bounds Write in zlib affects Nokogiri |
| GHSA-fq42-c5rg-92c2 | - | HIGH | Vulnerable dependencies in Nokogiri |
| GHSA-2rr5-8q37-2w7h | CVE-2021-41098 | HIGH | Improper Restriction of XML External Entity Reference (XXE) in Nokogiri on JRuby |
| GHSA-8c56-cpmw-89x7 | CVE-2017-9050 | HIGH | Out-of-bounds read in nokogiri |
CVE-2026-79770 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-79770
To remediate this vulnerability, upgrade all affected Nokogiri dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade nokogiri to 1.19.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for nokogiri
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-79770, inspect your project dependencies for Nokogiri:
inspect dependencies for nokogiri
Analyze the terminal output to locate any version of Nokogiri in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.19.3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Nokogiri, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-79770 Affected Nokogiri Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
nokogiri
|
RubyGems |
< 1.19.3
|
1.19.3
|
References
Frequently Asked Questions
What is CVE-2026-79770?
Which Nokogiri versions are affected?
What version fixes CVE-2026-79770?
Is nokogiri affected?
What is the CVSS score of CVE-2026-79770?
What CWE is associated with CVE-2026-79770?
How can I check RubyGems dependencies for CVE-2026-79770?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-c4rq-3m3g-8wgx",
"modified" : "2026-09-02T14:43:29Z",
"published" : "2026-05-06T18:24:18Z",
"aliases" : [ "CVE-2026-79770" ],
"summary" : "Nokogiri CSS selector tokenizer has regular expression backtracking",
"details" : "## Summary\n\nNokogiri's CSS selector tokenizer contains regular expressions whose construction may result in exponential regex backtracking on adversarial selectors. Three ReDoS vectors are addressed in this release:\n\n1. String-literal tokenization on certain unterminated quoted-string input.\n2. String-literal tokenization on a separate class of hex-escape-rich input.\n3. Identifier tokenization on hex-escape-rich input.\n\nThe public CSS selector methods that funnel through the affected tokenizer are `Nokogiri::CSS.xpath_for`, `Node#css`, `Node#at_css`, `Searchable#search`, and `CSS::Parser#parse`.\n\n\n## Mitigation\n\nUpgrade to Nokogiri `>= 1.19.3`.\n\nIf users are unable to upgrade, two options are available:\n\n- Avoid the use of attacker-controlled text in CSS selectors. Applications that only pass developer-authored selectors to Nokogiri are not directly exposed.\n- Set global `Regexp.timeout` (Ruby 3.2+, JRuby 9.4+) to bound parse time.\n\n## Severity\n\nThe Nokogiri maintainers have evaluated this as **High Severity** (CVSS 7.5, `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`).\n\nAn attacker able to inject user-supplied text into a CSS selector parse method can cause exponential backtracking, resulting in a potential denial of service.\n\n\n## Resources\n\n- [CWE-1333: Inefficient Regular Expression Complexity](https://cwe.mitre.org/data/definitions/1333.html)\n\n\n## Credit\n\nVector 1 was responsibly reported by @colby-swandale. Vectors 2 and 3 were discovered by @flavorjones during the response to the original report.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "nokogiri"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.19.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-c4rq-3m3g-8wgx"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-79770"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sparklemotion/nokogiri"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/nokogiri-before-redos-via-css-selector-tokenizer"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1333" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-06T18:24:18Z",
"nvd_published_at" : null
}
}