summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorMeenali Gupta <meenali.gupta@windriver.com>2023-09-27 03:39:35 +0000
committerSteve Sakoman <steve@sakoman.com>2023-09-30 09:43:59 -1000
commita54b91946cff4ec8a417b74bdb2c7f22ef0c9b11 (patch)
tree28cb89db11a5af5c285aac180d4b6a1da1122624 /meta/recipes-devtools
parenta1b812eefa6a8ac64bd5e5f24010c80f2bd541ad (diff)
downloadpoky-a54b91946cff4ec8a417b74bdb2c7f22ef0c9b11.tar.gz
ruby: fix CVE-2023-36617
Backport two patches [1] [2] to fix CVE-2023-36617 (From OE-Core rev: 7a40082e4e080eaf5f88bd24f7169b7731028529) Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/ruby/ruby/CVE-2023-36617_1.patch52
-rw-r--r--meta/recipes-devtools/ruby/ruby/CVE-2023-36617_2.patch47
-rw-r--r--meta/recipes-devtools/ruby/ruby_3.1.3.bb2
3 files changed, 101 insertions, 0 deletions
diff --git a/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_1.patch b/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_1.patch
new file mode 100644
index 0000000000..57a15d302e
--- /dev/null
+++ b/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_1.patch
@@ -0,0 +1,52 @@
1From 9c2eb12776c1b5df2517a7e618e5fe818cc3395e Mon Sep 17 00:00:00 2001
2From: Nobuyoshi Nakada <nobu@ruby-lang.org>
3Date: Thu, 27 Jul 2023 15:53:01 +0800
4Subject: [PATCH] ruby: Fix quadratic backtracking on invalid relative URI
5
6Upstream-Status: Backport [https://github.com/ruby/uri/commit/9010ee2536adda10a0555ae1ed6fe2f5808e6bf1]
7CVE: CVE-2023-36617
8
9Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com>
10---
11 lib/uri/rfc2396_parser.rb | 4 ++--
12 test/uri/test_parser.rb | 12 ++++++++++++
13 2 files changed, 14 insertions(+), 2 deletions(-)
14
15diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb
16index 76a8f99..00c66cf 100644
17--- a/lib/uri/rfc2396_parser.rb
18+++ b/lib/uri/rfc2396_parser.rb
19@@ -497,8 +497,8 @@ module URI
20 ret = {}
21
22 # for URI::split
23- ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
24- ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
25+ ret[:ABS_URI] = Regexp.new('\A\s*+' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
26+ ret[:REL_URI] = Regexp.new('\A\s*+' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
27
28 # for URI::extract
29 ret[:URI_REF] = Regexp.new(pattern[:URI_REF])
30diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb
31index 03de137..01ed32a 100644
32--- a/test/uri/test_parser.rb
33+++ b/test/uri/test_parser.rb
34@@ -63,4 +63,16 @@ class URI::TestParser < Test::Unit::TestCase
35 assert_equal("\u3042", p1.unescape('%e3%81%82'.force_encoding(Encoding::US_ASCII)))
36 assert_equal("\xe3\x83\x90\xe3\x83\x90", p1.unescape("\xe3\x83\x90%e3%83%90"))
37 end
38+
39+ def test_rfc2822_parse_relative_uri
40+ pre = ->(length) {
41+ " " * length + "\0"
42+ }
43+ parser = URI::RFC2396_Parser.new
44+ assert_linear_performance((1..5).map {|i| 10**i}, pre: pre) do |uri|
45+ assert_raise(URI::InvalidURIError) do
46+ parser.split(uri)
47+ end
48+ end
49+ end
50 end
51--
522.40.0
diff --git a/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_2.patch b/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_2.patch
new file mode 100644
index 0000000000..ff558183b6
--- /dev/null
+++ b/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_2.patch
@@ -0,0 +1,47 @@
1From eea5868120509c245216c4b5c2d4b5db1c593d0e Mon Sep 17 00:00:00 2001
2From: Nobuyoshi Nakada <nobu@ruby-lang.org>
3Date: Thu, 27 Jul 2023 16:16:30 +0800
4Subject: [PATCH] ruby: Fix quadratic backtracking on invalid port number
5
6Upstream-Status: Backport [https://github.com/ruby/uri/commit/9d7bcef1e6ad23c9c6e4932f297fb737888144c8]
7CVE: CVE-2023-36617
8Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com>
9---
10 lib/uri/rfc3986_parser.rb | 2 +-
11 test/uri/test_parser.rb | 10 ++++++++++
12 2 files changed, 11 insertions(+), 1 deletion(-)
13
14diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb
15index 3c89311..cde3ea7 100644
16--- a/lib/uri/rfc3986_parser.rb
17+++ b/lib/uri/rfc3986_parser.rb
18@@ -101,7 +101,7 @@ module URI
19 QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
20 FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
21 OPAQUE: /\A(?:[^\/].*)?\z/,
22- PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
23+ PORT: /\A[\x09\x0a\x0c\x0d ]*+\d*[\x09\x0a\x0c\x0d ]*\z/,
24 }
25 end
26
27diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb
28index 01ed32a..81c2210 100644
29--- a/test/uri/test_parser.rb
30+++ b/test/uri/test_parser.rb
31@@ -75,4 +75,14 @@ class URI::TestParser < Test::Unit::TestCase
32 end
33 end
34 end
35+
36+ def test_rfc3986_port_check
37+ pre = ->(length) {"\t" * length + "a"}
38+ uri = URI.parse("http://my.example.com")
39+ assert_linear_performance((1..5).map {|i| 10**i}, pre: pre) do |port|
40+ assert_raise(URI::InvalidComponentError) do
41+ uri.port = port
42+ end
43+ end
44+ end
45 end
46--
472.40.0
diff --git a/meta/recipes-devtools/ruby/ruby_3.1.3.bb b/meta/recipes-devtools/ruby/ruby_3.1.3.bb
index 72030508dd..228a2204db 100644
--- a/meta/recipes-devtools/ruby/ruby_3.1.3.bb
+++ b/meta/recipes-devtools/ruby/ruby_3.1.3.bb
@@ -31,6 +31,8 @@ SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \
31 file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \ 31 file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \
32 file://CVE-2023-28756.patch \ 32 file://CVE-2023-28756.patch \
33 file://CVE-2023-28755.patch \ 33 file://CVE-2023-28755.patch \
34 file://CVE-2023-36617_1.patch \
35 file://CVE-2023-36617_2.patch \
34 " 36 "
35UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" 37UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/"
36 38