CVE-2021-41098
HIGH 7.5CVSS 3.1Improper Restriction of XML External Entity Reference (XXE) in Nokogiri on JRuby
Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri v1.12.4 and earlier, on JRuby only, the SAX parser resolves external entities by default. Users of Nokogiri on JRuby who parse untrusted documents using any of these classes are affected: Nokogiri::XML::SAX::Parse, Nokogiri::HTML4::SAX::Parser or its alias Nokogiri::HTML::SAX::Parser, Nokogiri::XML::SAX::PushParser, and Nokogiri::HTML4::SAX::PushParser or its alias Nokogiri::HTML::SAX::PushParser. JRuby users should upgrade to Nokogiri v1.12.5 or later to receive a patch for this issue. There are no workarounds available for v1.12.4 or earlier. CRuby users are not affected.
- Published
- 27 Sep 2021
- Last modified
- 8 Jul 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Modified
- Weakness
- CWE-611
- Also known as
- GHSA-2rr5-8q37-2w7h
- Sources
- NVDJSONOSV GHSA-2rr5-8q37-2w7hJSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| NVD | security-advisories@github.com (Secondary) | CVSS 3.0 | HIGH 7.5 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| OSV | GitHub | CVSS 3.0 | HIGH 7.5 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| NVD | nvd@nist.gov (Primary) | CVSS 2.0 | MEDIUM 5.0 | AV:N/AC:L/Au:N/C:P/I:N/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | nokogiri | nokogiricpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:* |
< 1.12.5 | 1.12.5 |
| OSV | RubyGems | nokogiri | < 1.12.5 | 1.12.5 |
References
- https://github.com/sparklemotion/nokogiri/commit/5bf729ff3cc84709ee3c3248c981584088bf9f6d · Patch, Third Party Advisory, WEB
- https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-2rr5-8q37-2w7h · Third Party Advisory, WEB
- https://nvd.nist.gov/vuln/detail/CVE-2021-41098 · ADVISORY
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2021-41098.yml · WEB
- https://github.com/sparklemotion/nokogiri · PACKAGE
History
- 25 Nov 2026 20:33 UTC · NVD: first stored (published 27 Sep 2021)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 27 Sep 2021)