Skip to content

Commit f1f242d

Browse files
(PA-6386) Patch/Upgrade Ruby for CVE-2024-27282
- Patches the ruby 'Use-After-Free' issue for regexp for 7.x (ruby 2.7.8). - Upstream fix commit: ruby/ruby@90b194b - Bump projects using ruby 3.2.3 to ruby 3.2.4 since 3.2.4 has addressed the CVE. - Remove windows patches not needed in upgraded ruby version.
1 parent 32a50cd commit f1f242d

File tree

7 files changed

+21
-9
lines changed

7 files changed

+21
-9
lines changed

configs/components/ruby-2.7.8.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
base = 'resources/patches/ruby_27'
3939
# Patch for https://bugs.ruby-lang.org/issues/14972
4040
pkg.apply_patch "#{base}/net_http_eof_14972_r2.5.patch"
41+
pkg.apply_patch "#{base}/regexp_use_after_free.patch"
4142

4243
pkg.apply_patch "#{base}/uri-redos-cve-2023-36617.patch"
4344

configs/components/ruby-3.2.3.rb renamed to configs/components/ruby-3.2.4.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The file name of the ruby component must match the ruby_version
2-
component 'ruby-3.2.3' do |pkg, settings, platform|
3-
pkg.version '3.2.3'
4-
pkg.sha256sum 'af7f1757d9ddb630345988139211f1fd570ff5ba830def1cc7c468ae9b65c9ba'
2+
component 'ruby-3.2.4' do |pkg, settings, platform|
3+
pkg.version '3.2.4'
4+
pkg.sha256sum 'c72b3c5c30482dca18b0f868c9075f3f47d8168eaf626d4e682ce5b59c858692'
55

66
# rbconfig-update is used to munge rbconfigs after the fact.
77
pkg.add_source("file://resources/files/ruby/rbconfig-update.rb")
@@ -50,8 +50,6 @@
5050
pkg.apply_patch "#{base}/windows_mingw32_mkmf.patch"
5151
pkg.apply_patch "#{base}/windows_nocodepage_utf8_fallback_r2.5.patch"
5252
pkg.apply_patch "#{base}/ruby-faster-load_32.patch"
53-
pkg.apply_patch "#{base}/revert_speed_up_rebuilding_loaded_feature_index.patch"
54-
pkg.apply_patch "#{base}/revert-ruby-double-load-symlink.patch"
5553
pkg.apply_patch "#{base}/revert_ruby_utf8_default_encoding.patch"
5654
end
5755

configs/projects/agent-runtime-main.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project 'agent-runtime-main' do |proj|
22

33
# Set preferred component versions if they differ from defaults:
4-
proj.setting :ruby_version, '3.2.3'
4+
proj.setting :ruby_version, '3.2.4'
55
proj.setting :rubygem_deep_merge_version, '1.2.2'
66
proj.setting :rubygem_highline_version, '3.0.1'
77
proj.setting :rubygem_hocon_version, '1.4.0'

configs/projects/pdk-runtime.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
proj.setting(:includedir, File.join(proj.prefix, 'include'))
4949
proj.setting(:bindir, File.join(proj.prefix, 'bin'))
5050

51-
proj.setting(:ruby_version, '3.2.3')
51+
proj.setting(:ruby_version, '3.2.4')
5252
proj.setting(:ruby_major_version, 3)
5353
proj.setting(:ruby_api, '3.2.0')
5454

configs/projects/pe-bolt-server-runtime-main.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Once we are no longer using ruby 2.5 we can update.
77
proj.setting(:no_doc, true)
88

9-
proj.setting(:ruby_version, '3.2.3')
9+
proj.setting(:ruby_version, '3.2.4')
1010
proj.setting(:openssl_version, '3.0')
1111

1212
# We enable legacy algorithms for winrm transport. Currently the winrm transport

configs/projects/pe-installer-runtime-main.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project 'pe-installer-runtime-main' do |proj|
2-
proj.setting(:ruby_version, '3.2.3')
2+
proj.setting(:ruby_version, '3.2.4')
33
proj.setting(:openssl_version, '3.0')
44
# NLTM uses MD4 unconditionally in its protocol, so legacy algos must be
55
# enabled in OpenSSL >= 3.0 for Bolt's WinRM transport to work.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/regexec.c b/regexec.c
2+
index 73694ab14a..140691ad42 100644
3+
--- a/regexec.c
4+
+++ b/regexec.c
5+
@@ -3449,8 +3449,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
6+
CASE(OP_MEMORY_END_PUSH_REC) MOP_IN(OP_MEMORY_END_PUSH_REC);
7+
GET_MEMNUM_INC(mem, p);
8+
STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */
9+
- STACK_PUSH_MEM_END(mem, s);
10+
mem_start_stk[mem] = GET_STACK_INDEX(stkp);
11+
+ STACK_PUSH_MEM_END(mem, s);
12+
MOP_OUT;
13+
JUMP;

0 commit comments

Comments
 (0)