Skip to content

Commit 101be89

Browse files
[Medium] Patch ruby for CVE-2025-24294 (#14295)
1 parent 24af500 commit 101be89

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

SPECS/ruby/CVE-2025-24294.patch

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
From 0402b9455a79af510e18bbd60f83427fe30fea86 Mon Sep 17 00:00:00 2001
2+
From: BinduSri-6522866 <[email protected]>
3+
Date: Tue, 15 Jul 2025 07:41:43 +0000
4+
Subject: [PATCH] Address CVE-2025-24294
5+
6+
Upstream Patch reference: https://github.com/ruby/resolv/commit/4c2f71b5e80826506f78417d85b38481c058fb25
7+
---
8+
lib/resolv.rb | 6 +++++-
9+
test/resolv/test_dns.rb | 7 +++++++
10+
2 files changed, 12 insertions(+), 1 deletion(-)
11+
12+
diff --git a/lib/resolv.rb b/lib/resolv.rb
13+
index 57fd173..778891c 100644
14+
--- a/lib/resolv.rb
15+
+++ b/lib/resolv.rb
16+
@@ -1655,6 +1655,7 @@ class Resolv
17+
prev_index = @index
18+
save_index = nil
19+
d = []
20+
+ size = -1
21+
while true
22+
raise DecodeError.new("limit exceeded") if @limit <= @index
23+
case @data.getbyte(@index)
24+
@@ -1675,7 +1676,10 @@ class Resolv
25+
end
26+
@index = idx
27+
else
28+
- d << self.get_label
29+
+ l = self.get_label
30+
+ d << l
31+
+ size += 1 + l.string.bytesize
32+
+ raise DecodeError.new("name label data exceed 255 octets") if size > 255
33+
end
34+
end
35+
end
36+
diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb
37+
index 20c3408..c25026e 100644
38+
--- a/test/resolv/test_dns.rb
39+
+++ b/test/resolv/test_dns.rb
40+
@@ -589,6 +589,13 @@ class TestResolvDNS < Test::Unit::TestCase
41+
assert_operator(2**14, :<, m.to_s.length)
42+
end
43+
44+
+ def test_too_long_address
45+
+ too_long_address_message = [0, 0, 1, 0, 0, 0].pack("n*") + "\x01x" * 129 + [0, 0, 0].pack("cnn")
46+
+ assert_raise_with_message(Resolv::DNS::DecodeError, /name label data exceed 255 octets/) do
47+
+ Resolv::DNS::Message.decode too_long_address_message
48+
+ end
49+
+ end
50+
+
51+
def assert_no_fd_leak
52+
socket = assert_throw(self) do |tag|
53+
Resolv::DNS.stub(:bind_random_port, ->(s, *) {throw(tag, s)}) do
54+
--
55+
2.45.3
56+

SPECS/ruby/ruby.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Name: ruby
8787
# provides should be versioned according to the ruby version.
8888
# More info: https://stdgems.org/
8989
Version: %{ruby_version}
90-
Release: 4%{?dist}
90+
Release: 5%{?dist}
9191
License: (Ruby OR BSD) AND Public Domain AND MIT AND CC0 AND zlib AND UCD
9292
Vendor: Microsoft Corporation
9393
Distribution: Azure Linux
@@ -111,6 +111,7 @@ Patch4: CVE-2025-27219.patch
111111
Patch5: CVE-2025-27220.patch
112112
Patch6: CVE-2025-27221.patch
113113
Patch7: CVE-2025-6442.patch
114+
Patch8: CVE-2025-24294.patch
114115
BuildRequires: openssl-devel
115116
# Pkgconfig(yaml-0.1) is needed to build the 'psych' gem.
116117
BuildRequires: pkgconfig(yaml-0.1)
@@ -415,6 +416,9 @@ sudo -u test make test TESTS="-v"
415416
%{_rpmconfigdir}/rubygems.con
416417

417418
%changelog
419+
* Tue Jul 15 2025 BinduSri Adabala <[email protected]> - 3.3.5-5
420+
- Patch CVE-2025-24294
421+
418422
* Thu Jun 26 2025 Kevin Lockwood <[email protected]> - 3.3.5-4
419423
- Patch CVE-2025-6442
420424

0 commit comments

Comments
 (0)