CVE-2026-80213

resolv: Resolv gem: DNS allowlist and egress bypass, and cache poisoning via crafted hostnames

Published Aug 27, 2026 CVSS 3.1 · 4 Medium EPSS < 1% KEV · Not listed
Description
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. put_string packed the length with put_pack("C", d.length) and put_label 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 domain the attacker chose. A hostname suffix that the application validates against an allowlist becomes padding that never appears on the wire, and thus allowlist and egress checks can be bypassed. The recursive resolver caches the response under the attacker's name, and DNS logs record that name rather than the one the application asked for. A label length whose low octet lands in the 0xC0-0xFF range produces a length octet that conforming parsers read as the start of a compression pointer, with the following attacker-controlled byte as the offset.

Analysis

AI-generated

Technical impact

The vulnerability arises from an unchecked DNS label length field in the Ruby Resolv gem before version 0.7.2. When a label longer than 255 octets is encoded, the length is stored modulo 256 while the label data remains unchanged. This numeric truncation allows an attacker to inject values that are interpreted by DNS parsers as compression pointers or padding, causing the encoded DNS query to carry a different, attacker‑controlled domain name than the one supplied by the application. As a result, applications that perform allowlist or egress validation on the hostname being resolved can be tricked into sending queries for domains the attacker chooses, and the recursive resolver caches the response under that name. DNS logs will record the attacker‑chosen domain instead of the intended one, facilitating covert exfiltration or denial of service.

Affected Systems

This issue affects the Ruby Resolv gem. Any installation of resolv prior to version 0.7.2 is vulnerable. Systems running Ruby applications that depend on this gem, such as web servers or network utilities that resolve hostnames, are at risk unless they upgrade to 0.7.2 or newer.

Risk and Exploitability

The vulnerability is primarily exploitable when the application accepts arbitrary hostnames from untrusted sources. An attacker can craft a hostname that contains byte values designed to abuse the length field, causing the resolver to send a DNS query for a domain of the attacker’s choosing. Because the application treats the padding added to satisfy length constraints as invisible, the allowlist and egress filters are bypassed. The recursive resolver then caches the mapping, and DNS logs will show the attacker’s name, potentially aiding other malicious actions. The CVSS score of 4 indicates low severity, and the EPSS score of 0.0035 indicates a very low probability of exploitation, while the lack of a KEV listing suggests limited known exploitation at this time. The likely attack vector is network‑level DNS query manipulation triggered by controlled hostname input.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Resolv gem to version 0.7.2 or later.
  • Validate any hostname input for length and allowed characters before passing it to the resolver, ensuring compliance with RFC 1035.
  • Implement strict egress filtering or DNS query whitelisting to restrict queries to approved domains.
  • Monitor DNS logs for unexpected or attacker‑chosen domain names and investigate anomalies.
  • If an immediate upgrade is not possible, consider disabling recursive resolution within the application or using an external, hardened DNS resolver that enforces label length checks.

Generated by OpenCVE AI on September 1, 2026 at 17:46 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Title resolv: Resolv gem: DNS allowlist and egress bypass, and cache poisoning via crafted hostnames
Weaknesses CWE-130
References
Metrics threat_severity

None

threat_severity

Moderate

Type Values Removed Values Added
First Time appeared Ruby
Ruby resolv
Vendors & Products Ruby
Ruby resolv
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description 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. put_string packed the length with put_pack("C", d.length) and put_label 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 domain the attacker chose. A hostname suffix that the application validates against an allowlist becomes padding that never appears on the wire, and thus allowlist and egress checks can be bypassed. The recursive resolver caches the response under the attacker's name, and DNS logs record that name rather than the one the application asked for. A label length whose low octet lands in the 0xC0-0xFF range produces a length octet that conforming parsers read as the start of a compression pointer, with the following attacker-controlled byte as the offset.
Weaknesses CWE-197
References
Metrics cvssV3_1

{'score': 4, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:N'}

Weaknesses
  • CWE-130

    Improper Handling of Length Parameter Inconsistency

  • CWE-197

    Numeric Truncation Error

Sources

Status
PUBLISHED
Assigner
mitre
Published
Updated
Aug 27, 2026, 5:52 PM
Reserved
Aug 26, 2026, 1:45 AM
Status
Deferred
Published
Aug 27, 2026, 5:20 PM
Modified
Sep 9, 2026, 4:04 PM
Severity
Moderate
Public date
Aug 27, 2026, 2:22 PM