CVE-2026-46727

Race Condition in Ruby 4 getaddrinfo Leading to Use‑After‑Free and Process Crash

Published May 22, 2026 CVSS 3.1 · 8.1 High EPSS < 1% KEV · Not listed
Description
An issue was discovered in Ruby 4 before 4.0.5. A race condition leading to a use-after-free in the pthread-based getaddrinfo timeout handler (rb_getaddrinfo in ext/socket/raddrinfo.c) allows a remote attacker who can delay DNS responses near the user-specified timeout to crash a Ruby process that calls Addrinfo.getaddrinfo(..., timeout:) or Socket.tcp(..., resolv_timeout:). Memory-corruption-based exploitation is theoretically possible. The attack could, for example, be carried out through a crafted authoritative DNS server or recursive resolver.

Analysis

AI-generated

Technical impact

A race condition in Ruby 4's getaddrinfo implementation can cause a use‑after‑free when the DNS response is delayed close to the user‑specified timeout. The resulting memory corruption can crash the Ruby process that calls Addrinfo.getaddrinfo with a timeout or Socket.tcp with a resolv_timeout. While the description only specifies a crash, the underlying use‑after‑free could theoretically be abused for arbitrary code execution if the attacker controls the allocator state, but no such exploitation has been confirmed.

Affected Systems

Ruby 4 is affected up to but not including version 4.0.5. All installations of Ruby 4 that perform DNS resolution with timeout handling are vulnerable, regardless of platform or distribution.

Risk and Exploitability

The CVSS score of 8.1 indicates a high severity. Because the attack requires a delayed DNS response near the timeout, the likely vector is remote network traffic; a malicious authoritative or recursive resolver could trigger the flaw. The EPSS score is not available, and the vulnerability is not listed in the CISA KEV catalog, so no public exploit data is currently known. Nevertheless, the crash risk is real, and memory‑corruption exploitation is theoretically possible, especially on systems where Ruby processes run with elevated privileges.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Ruby to version 4.0.5 or later, which contains the fixed pthread‑based getaddrinfo timeout handler.
  • Rebuild or reinstall any Ruby extensions that compile native code to ensure they are linked against the updated interpreter.
  • Limit DNS lookups to trusted resolvers or adjust application code to avoid using timeout parameters that expose the race condition when an update is not immediately feasible.

Generated by OpenCVE AI on May 22, 2026 at 19:26 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Title Race Condition in Ruby 4 getaddrinfo Leading to Use‑After‑Free and Process Crash
Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
Description An issue was discovered in Ruby 4 before 4.0.5. A race condition leading to a use-after-free in the pthread-based getaddrinfo timeout handler (rb_getaddrinfo in ext/socket/raddrinfo.c) allows a remote attacker who can delay DNS responses near the user-specified timeout to crash a Ruby process that calls Addrinfo.getaddrinfo(..., timeout:) or Socket.tcp(..., resolv_timeout:). Memory-corruption-based exploitation is theoretically possible. The attack could, for example, be carried out through a crafted authoritative DNS server or recursive resolver.
First Time appeared Ruby-lang
Ruby-lang ruby
Weaknesses CWE-362
CPEs cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*
Vendors & Products Ruby-lang
Ruby-lang ruby
References
Metrics cvssV3_1

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

Weaknesses
  • CWE-362

    Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

Sources

Status
PUBLISHED
Assigner
mitre
Published
Updated
May 22, 2026, 6:41 PM
Reserved
May 16, 2026, 12:00 AM
Status
Analyzed
Published
May 22, 2026, 6:16 PM
Modified
Jul 23, 2026, 4:10 PM