CVE-2026-80213: Medium severity rubygems/resolv vulnerability
An issue was discovered in the resolv gem before 0.7.2 for Ruby. Resolv::DNS::MessageEncoder wrote a DNS label's length into a single octet without checking its range. A label longer than 255 octets had its length stored modulo 256 but the label data was written unchanged, and thus the bytes on the wire described a different name than the one the application asked to encode. RFC 1035 section 2.3.4 limits a label to 63 octets, and the two high bits of the length octet are reserved for compression pointers. putstring packed the length with putpack("C", d.length) and putlabel used it for labels, and thus any value from 0 to 255 could end up as a label length octet, including the reserved 0x40-0xBF range and the 0xC0-0xFF pointer range. Resolv::DNS::Name.create did not check per-label or total name length either, and thus an attacker-controlled hostname reached the encoder unchanged. An application that resolves an attacker-controlled hostname sends a query whose wire bytes name a domai
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/ruby3.3to a version that resolves this vulnerability.Fixed in 3.3.13-0+deb13u1 - Upgrade
Upgrade
azurelinux/rubyto a version that resolves this vulnerability.Fixed in 0:3.4.10-36.azl4 - Upgrade
Upgrade
debian/ruby3.3to a version that resolves this vulnerability.Fixed in 3.3.13-0+deb13u1Fixed in 3.3.14-0.1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 0.7.2
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using the resolv gem before 0.7.2 are exposed when they pass an attacker-controlled hostname to DNS resolution. The relevant path is Resolv::DNS::MessageEncoder encoding that hostname into a DNS query.
What does an attacker need to exploit the issue?
An attacker needs to control a hostname that the application will attempt to resolve. By supplying a label longer than 255 octets, the attacker can cause the encoded DNS query to describe a different domain name from the hostname the application processed.
Can hostname allowlists or DNS egress controls be bypassed?
Yes. A validated hostname suffix can become padding that is not present in the DNS wire representation, allowing a query for an attacker-chosen domain despite an application-side suffix allowlist or egress check.
What can be done before updating?
Reject DNS labels longer than 63 octets before they reach resolution, consistent with RFC 1035. Do not rely solely on suffix validation where attacker-controlled hostnames can be resolved; ensure the name permitted by policy is the name sent in the DNS request.
How can teams assess whether they are affected?
Check whether the application uses a resolv gem version before 0.7.2 and whether any untrusted input can influence hostnames submitted for DNS resolution. Pay particular attention to controls that validate hostnames by appending or checking an allowlisted suffix.