CVE-2022-29181
Ruby vulnerability analysis and mitigation

Overview

Nokogiri prior to version 1.13.6 contained a vulnerability (CVE-2022-29181) that does not type-check all inputs into the XML and HTML4 SAX parsers. The vulnerability was discovered in May 2022 and affects the open-source XML and HTML library for Ruby. This security issue allows specially crafted untrusted inputs to cause illegal memory access errors (segfault) or reads from unrelated memory (NVD, GitHub Advisory).

Technical details

The vulnerability stems from type confusion issues in both xml_sax_parser_context.c and html4_sax_parser_context.c files. The parse_memory function fails to verify that the input data is a Ruby string before processing, allowing attackers to pass non-string objects that could cause memory access violations. The issue has been assigned a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H (GitHub Lab).

Impact

For CRuby users, this vulnerability could lead to denial of service (DoS) through application crashes or potential information disclosure through memory leaks. If Nokogiri is being used in a way that reflects parsing results to the attacker, the vulnerability could be exploited to leak arbitrary Ruby strings containing sensitive information by guessing valid memory addresses (GitHub Lab).

Exploitability

The vulnerability can be exploited by providing specially crafted input to the XML and HTML4 SAX parsers. A proof of concept exists that demonstrates how the process can be crashed by dereferencing invalid memory addresses. JRuby users are not affected by this vulnerability (GitHub Advisory).

Mitigation and workarounds

Users should upgrade to Nokogiri version 1.13.6 or later which contains a patch for this vulnerability. As a temporary workaround, users can ensure untrusted input is converted to a String by calling #to_s or equivalent before passing it to the parser (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related Ruby vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-85396HIGH8.7
  • Ruby logoRuby
  • ruby-zip
NoYesSep 03, 2026
CVE-2026-81097HIGH8.6
  • Ruby logoRuby
  • rails-mcp-server
NoYesAug 27, 2026
CVE-2026-53769MEDIUM6.5
  • Ruby logoRuby
  • go-toolset:rhel8::golang-src
NoYesSep 04, 2026
GHSA-mvxr-6m87-mv2qMEDIUM5.3
  • Ruby logoRuby
  • mail
NoYesSep 02, 2026
CVE-2026-63435MEDIUM5.3
  • Ruby logoRuby
  • logstash-9.4
NoYesSep 01, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management