{"id":"CVE-2022-29181","aliases":["CVE-2022-29181","GHSA-xh29-r2w5-wx8m"],"related":[],"kind":"vulnerability","state":"published","title":"Improper Handling of Unexpected Data Type in Nokogiri","summary":"Nokogiri is an open source XML and HTML library for Ruby. Nokogiri prior to version 1.13.6 does not type-check all inputs into the XML and HTML4 SAX parsers, allowing specially crafted untrusted inputs to cause illegal memory access errors (segfault) or reads from unrelated memory. Version 1.13.6 contains a patch for this issue. As a workaround, ensure the untrusted input is a `String` by calling `#to_s` or equivalent.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Nokogiri is an open source XML and HTML library for Ruby. Nokogiri prior to version 1.13.6 does not type-check all inputs into the XML and HTML4 SAX parsers, allowing specially crafted untrusted inputs to cause illegal memory access errors (segfault) or reads from unrelated memory. Version 1.13.6 contains a patch for this issue. As a workaround, ensure the untrusted input is a `String` by calling `#to_s` or equivalent.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nNokogiri `< v1.13.6` does not type-check all inputs into the XML and HTML4 SAX parsers. For CRuby users, this may allow specially crafted untrusted inputs to cause illegal memory access errors (segfault) or reads from unrelated memory.\n\n### Severity\n\nThe Nokogiri maintainers have evaluated this as **High 8.2** (CVSS3.1).\n\n\n### Mitigation\n\nCRuby users should upgrade to Nokogiri `>= 1.13.6`.\n\nJRuby users are not affected.\n\n\n### Workarounds\n\nTo avoid this vulnerability in affected applications, ensure the untrusted input is a `String` by calling `#to_s` or equivalent.\n\n\n### Credit\n\nThis vulnerability was responsibly reported by @agustingianni and the Github Security Lab.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Nokogiri es una biblioteca XML y HTML de código abierto para Ruby. En versiones anteriores a 1.13.6, Nokogiri no comprobaba todas las entradas en los analizadores SAX de XML y HTML4, lo que permitía que entradas no confiables especialmente diseñadas causaran errores de acceso a memoria ilegales (segfault) o lecturas de memoria no relacionadas. La versión 1.13.6 contiene un parche para este problema. Como mitigación, asegúrese de que la entrada no confiable es una \"String\" llamando a \"#to_s\" o su equivalente","source":"nvd"}],"published":"2022-05-20T00:00:00.000Z","modified":"2026-06-17T04:39:45.560Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H","score":8.2,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H","score":8.2,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H","score":8.2,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H","score":8.2,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:N/A:P","score":6.4,"rating":"MEDIUM"}],"cwes":["CWE-241","CWE-843"],"affected":[{"ranges":[{"version":"< 1.13.6","status":"affected"}],"vendor":"sparklemotion","product":"nokogiri","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.13.6"}],"ecosystem":"RubyGems","package":"nokogiri","purl":"pkg:gem/nokogiri","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.13.6"}],"vendor":"nokogiri","product":"nokogiri","cpe":"cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*","source":"nvd"},{"ranges":[{"status":"affected","introduced":"13.0","fixed":"13.1"}],"vendor":"apple","product":"macos","cpe":"cpe:2.3:o:apple:macos:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xh29-r2w5-wx8m","tags":["issue-tracking","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/sparklemotion/nokogiri/commit/83cc451c3f29df397caa890afc3b714eae6ab8f7","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/sparklemotion/nokogiri/commit/db05ba9a1bd4b90aa6c76742cf6102a7c7297267","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.6","tags":["release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri","tags":["advisory","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri/","tags":["exploit","third-party-advisory","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://security.gentoo.org/glsa/202208-29","tags":["third-party-advisory","vendor-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://support.apple.com/kb/HT213532","tags":["third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"http://seclists.org/fulldisclosure/2022/Dec/23","tags":["mailing-list","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29181","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2022-29181.yml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/sparklemotion/nokogiri","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-04-22T15:41:19.551Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-29181","url":"https://www.cve.org/CVERecord?id=CVE-2022-29181","licence":"CVE Terms of Use","modified":"2025-05-27T14:51:01.821Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-xh29-r2w5-wx8m","url":"https://github.com/advisories/GHSA-xh29-r2w5-wx8m","licence":"CC-BY-4.0","modified":"2025-05-27T15:18:51.177Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-29181","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29181","licence":"Public domain","modified":"2026-06-17T04:39:45.560Z"}],"updatedAt":"2026-11-25T22:58:11.854Z","epss":{"score":0.0323,"percentile":0.88587,"date":"2026-12-01T12:00:22.000Z"}}