# CVE-2022-29181: Improper Handling of Unexpected Data Type in Nokogiri

- Severity: High 8.2 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 3.23%, higher than 88% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2022-05-20T00:00:00.000Z
- Modified: 2026-06-17T04:39:45.560Z
- Also known as: GHSA-xh29-r2w5-wx8m
- Weaknesses: CWE-241, CWE-843
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- sparklemotion nokogiri: < 1.13.6
- nokogiri (RubyGems): before 1.13.6
- nokogiri nokogiri: before 1.13.6
- apple macos: from 13.0 before 13.1

## Every score

- GitHub_M: CVSS:3.1 8.2 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H`
- GitHub: CVSS:3.1 8.2 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H`
- NVD: CVSS:3.1 8.2 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H`
- NVD: CVSS:2.0 6.4 Medium `AV:N/AC:L/Au:N/C:P/I:N/A:P`

## References

- <https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri/> (exploit, third-party-advisory)
- <https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xh29-r2w5-wx8m> (issue-tracking, third-party-advisory, web)
- <https://github.com/sparklemotion/nokogiri/commit/83cc451c3f29df397caa890afc3b714eae6ab8f7> (web)
- <https://github.com/sparklemotion/nokogiri/commit/db05ba9a1bd4b90aa6c76742cf6102a7c7297267> (patch, third-party-advisory, web)
- <https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.6> (release-notes, third-party-advisory, web)
- <https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri> (advisory)
- <https://security.gentoo.org/glsa/202208-29> (third-party-advisory, vendor-advisory, web)
- <https://support.apple.com/kb/HT213532> (third-party-advisory, web)
- <http://seclists.org/fulldisclosure/2022/Dec/23> (mailing-list, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-29181> (advisory)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2022-29181.yml> (web)
- <https://github.com/sparklemotion/nokogiri> (package)

## Sources

- CVE List: [CVE-2022-29181](https://www.cve.org/CVERecord?id=CVE-2022-29181), CVE Terms of Use, modified 2025-05-27
- GitHub Advisory Database: [GHSA-xh29-r2w5-wx8m](https://github.com/advisories/GHSA-xh29-r2w5-wx8m), CC-BY-4.0, modified 2025-05-27
- NVD: [CVE-2022-29181](https://nvd.nist.gov/vuln/detail/CVE-2022-29181), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-29181 · Whole record: https://cve.day/CVE-2022-29181.json · Rebuilt by cve.day 2026-11-25T22:58:11.854Z
