{"id":"CVE-2021-41098","published":"2021-09-27T19:35:11Z","modified":"2024-08-04T02:59:31Z","title":"Improper Restriction of XML External Entity Reference (XXE) in Nokogiri on JRuby","vendor":"sparklemotion","product":"nokogiri","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.5,"severity":"HIGH","version":"3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0146,"percentile":0.74197,"provenance":"source"},"cwes":[{"id":"CWE-611","name":"Improper Restriction of XML External Entity Reference"}],"references":[{"url":"https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-2rr5-8q37-2w7h","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/sparklemotion/nokogiri/commit/5bf729ff3cc84709ee3c3248c981584088bf9f6d","tags":["x_refsource_MISC"]}],"priority":{"score":20.1,"factors":[{"name":"EPSS percentile","points":14.84},{"name":"CVSS severity","points":5.25}]},"vendorSlug":"sparklemotion","affectedVersions":[{"vendor":"sparklemotion","product":"nokogiri","versions":["< 1.12.5"]}],"affected":[{"ecosystem":"RubyGems","package":"nokogiri","vulnerableRanges":["<1.12.5"],"patched":["1.12.5"],"from":["GHSA-2rr5-8q37-2w7h"],"provenance":"source"}],"summary":{"text":"The Nokogiri Rubygem's SAX parsers (Nokogiri::XML::SAX::Parser, the HTML4 SAX parser and push parsers) resolve external XML entities by default when running on JRuby, but not on CRuby. An attacker who can supply a document for parsing by these classes can exploit this by submitting untrusted input, with no authentication or user interaction needed, while users on Nokogiri v1.12.4 and earlier should upgrade to v1.12.5 or later, as no workaround exists.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T07:15:15Z"},"euvd":{"id":"EUVD-2021-1954","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-sparklemotion-nokogiri-cve-2021-41098","children":[{"from":"CVE-2021-41098","to":"CVE-2022-29181","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["ext/java/nokogiri/XmlSaxParserContext.java"],"commits":["https://github.com/sparklemotion/nokogiri/commit/5bf729ff3cc84709ee3c3248c981584088bf9f6d","https://github.com/sparklemotion/nokogiri/commit/83cc451c3f29df397caa890afc3b714eae6ab8f7","https://github.com/sparklemotion/nokogiri/commit/db05ba9a1bd4b90aa6c76742cf6102a7c7297267"],"basis":"shared function","functions":["XmlSaxParserContext"]}]},{"from":"CVE-2021-41098","to":"CVE-2026-126062","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["ext/java/nokogiri/internals/NokogiriEntityResolver.java"],"commits":["https://github.com/sparklemotion/nokogiri/commit/5bf729ff3cc84709ee3c3248c981584088bf9f6d","https://github.com/sparklemotion/nokogiri/commit/97f41b65f4ee0cac859b87f0b26d2648c4806cb8","https://github.com/sparklemotion/nokogiri/commit/e448ca2827a9198644610fb730259e12baacdeac"],"basis":"shared function","functions":["NokogiriEntityResolver"]}]}],"packageHistory":[{"cve":"CVE-2021-3517","published":"2021-05-19","fixed":"1.11.4","kev":false,"link":{"from":"CVE-2021-3517","to":"CVE-2021-41098","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"RubyGems:nokogiri","fromFixed":"1.11.4","toFixed":"1.12.5","daysApart":131}]}},{"cve":"CVE-2021-3518","published":"2021-05-18","fixed":"1.11.4","kev":false},{"cve":"CVE-2021-3537","published":"2021-05-14","fixed":"1.11.4","kev":false},{"cve":"CVE-2021-41098","published":"2021-09-27","fixed":"1.12.5","kev":false},{"cve":"CVE-2021-30560","published":"2021-08-03","fixed":"1.13.2","kev":false},{"cve":"CVE-2018-25032","published":"2022-03-25","fixed":"1.13.4","kev":false},{"cve":"CVE-2022-24836","published":"2022-04-11","fixed":"1.13.4","kev":false}],"package":"RubyGems:nokogiri"}}