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.
Published: 2026-08-27
Score: 4 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Bypass of DNS name validation and allowlist checks
Action: Apply Patch
AI Analysis

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.

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

Remediation

No vendor fix or workaround currently provided.

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 yet.

History

Tue, 01 Sep 2026 12:15:00 +0000

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


Fri, 28 Aug 2026 16:45:00 +0000

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

Thu, 27 Aug 2026 18:00:00 +0000

Type Values Removed Values Added
Metrics ssvc

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


Thu, 27 Aug 2026 16:45:00 +0000

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'}


cve-icon MITRE

Status: PUBLISHED

Assigner: mitre

Published:

Updated: 2026-08-27T17:52:14.240Z

Reserved: 2026-08-26T01:45:16.494Z

Link: CVE-2026-80213

cve-icon Vulnrichment

Updated: 2026-08-27T17:52:09.541Z

cve-icon NVD

Status : Deferred

Published: 2026-08-27T17:20:51.037

Modified: 2026-09-09T16:04:24.933

Link: CVE-2026-80213

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-08-27T14:22:23Z

Links: CVE-2026-80213 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-09-01T18:00:18Z

Weaknesses
  • CWE-130

    Improper Handling of Length Parameter Inconsistency

  • CWE-197

    Numeric Truncation Error