Improper resource allocation In ruby3.1
Description
An issue was discovered in the resolv gem before 0.7.2 for Ruby. Resolv::DNS::Resource.get_class, Resolv::DNS::Resource::Generic.create, and Resolv::DNS::SvcParam::Generic.create generate a new class for each unknown DNS resource record (type, class) pair, or each unknown SvcParamKey, encountered while decoding a response. Each generated class was permanently registered both as a constant on Resource (or SvcParam::Generic) and as an entry in a class-lookup hash (ClassHash), and thus the class remained reachable through that constant after the response was discarded. Type and class are each 16-bit values, and thus an attacker controlling DNS responses (a spoofed response, or a malicious or hijacked upstream DNS server) has roughly 2^32 distinct (type, class) pairs to choose from. A single response of a few hundred kilobytes carrying tens of thousands of distinct unknown types permanently grows process memory by tens of megabytes; repeated responses accumulate without bound and are never reclaimed by garbage collection, because the constant keeps each class alive. Any code path that calls Resolv::DNS::Message.decode on attacker-influenced DNS responses is affected. resolv is a default gem, and thus this is reachable from a plain Ruby installation without any additional dependency.
Mitigation
Update Impact
Minimal update. May introduce new vulnerabilities or breaking changes.
Ecosystem | Component | Affected version | Patched versions |
|---|---|---|---|
rpm rhel9 | 0:3.0.7-168.el9_8 | ||
rpm rhel10 | 0:3.3.12-15.el10_2 | ||
rpm rhel6 | - | - | |
rpm rhel7 | - | - | |
rpm rhel8 | 0:2.5.9-116.module+el8.10.0+24853+52b5af56 | ||
rpm rhel10 | 0:4.0.6-37.el10_2 | ||
rpm rhel10.0 | 0:3.3.12-12.el10_0 | ||
rpm rhel9.6 | 0:3.0.7-166.el9_6 | ||
alpine v3.21 | 3.3.13-r0 | ||
alpine v3.22 | 3.4.12-r0 |
1-10 of 17
10
Aliases