diff options
| author | Divya Chellam <divya.chellam@windriver.com> | 2025-11-20 15:07:20 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-12-01 06:50:49 -0800 |
| commit | f58483837ce2ebfaf71ba4f8b75db5f6acc405a3 (patch) | |
| tree | 31b2b19735c3fd804c1c404fbffea5d2c649b767 /meta | |
| parent | cdc78fd36f440024c36f92c0170961c96f6d096b (diff) | |
| download | poky-f58483837ce2ebfaf71ba4f8b75db5f6acc405a3.tar.gz | |
ruby: fix CVE-2024-35176
REXML is an XML toolkit for Ruby. The REXML gem before 3.2.6 has a
denial of service vulnerability when it parses an XML that has many
`<`s in an attribute value. Those who need to parse untrusted XMLs
may be impacted to this vulnerability. The REXML gem 3.2.7 or later
include the patch to fix this vulnerability. As a workaround, don't
parse untrusted XMLs.
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2024-35176
Upstream-patch:
https://github.com/ruby/rexml/commit/4325835f92f3f142ebd91a3fdba4e1f1ab7f1cfb
(From OE-Core rev: a89fcaf0c3ac2afd95e836bc1356832296135696)
Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-devtools/ruby/ruby/CVE-2024-35176.patch | 112 | ||||
| -rw-r--r-- | meta/recipes-devtools/ruby/ruby_3.1.3.bb | 1 |
2 files changed, 113 insertions, 0 deletions
diff --git a/meta/recipes-devtools/ruby/ruby/CVE-2024-35176.patch b/meta/recipes-devtools/ruby/ruby/CVE-2024-35176.patch new file mode 100644 index 0000000000..83fa3fa4e7 --- /dev/null +++ b/meta/recipes-devtools/ruby/ruby/CVE-2024-35176.patch | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | From 4325835f92f3f142ebd91a3fdba4e1f1ab7f1cfb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nobuyoshi Nakada <nobu@ruby-lang.org> | ||
| 3 | Date: Thu, 16 May 2024 11:26:51 +0900 | ||
| 4 | Subject: [PATCH] Read quoted attributes in chunks (#126) | ||
| 5 | |||
| 6 | CVE: CVE-2024-35176 | ||
| 7 | |||
| 8 | Upstream-Status: Backport [https://github.com/ruby/rexml/commit/4325835f92f3f142ebd91a3fdba4e1f1ab7f1cfb] | ||
| 9 | |||
| 10 | Signed-off-by: Divya Chellam <divya.chellam@windriver.com> | ||
| 11 | --- | ||
| 12 | .../lib/rexml/parsers/baseparser.rb | 20 ++++++------- | ||
| 13 | .bundle/gems/rexml-3.2.5/lib/rexml/source.rb | 29 +++++++++++++++---- | ||
| 14 | 2 files changed, 34 insertions(+), 15 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb b/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb | ||
| 17 | index b97beb3..eab942d 100644 | ||
| 18 | --- a/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb | ||
| 19 | +++ b/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb | ||
| 20 | @@ -675,17 +675,17 @@ module REXML | ||
| 21 | message = "Missing attribute equal: <#{name}>" | ||
| 22 | raise REXML::ParseException.new(message, @source) | ||
| 23 | end | ||
| 24 | - unless match = @source.match(/(['"])(.*?)\1\s*/um, true) | ||
| 25 | - if match = @source.match(/(['"])/, true) | ||
| 26 | - message = | ||
| 27 | - "Missing attribute value end quote: <#{name}>: <#{match[1]}>" | ||
| 28 | - raise REXML::ParseException.new(message, @source) | ||
| 29 | - else | ||
| 30 | - message = "Missing attribute value start quote: <#{name}>" | ||
| 31 | - raise REXML::ParseException.new(message, @source) | ||
| 32 | - end | ||
| 33 | + unless match = @source.match(/(['"])/, true) | ||
| 34 | + message = "Missing attribute value start quote: <#{name}>" | ||
| 35 | + raise REXML::ParseException.new(message, @source) | ||
| 36 | + end | ||
| 37 | + quote = match[1] | ||
| 38 | + value = @source.read_until(quote) | ||
| 39 | + unless value.chomp!(quote) | ||
| 40 | + message = "Missing attribute value end quote: <#{name}>: <#{quote}>" | ||
| 41 | + raise REXML::ParseException.new(message, @source) | ||
| 42 | end | ||
| 43 | - value = match[2] | ||
| 44 | + @source.match(/\s*/um, true) | ||
| 45 | if prefix == "xmlns" | ||
| 46 | if local_part == "xml" | ||
| 47 | if value != "http://www.w3.org/XML/1998/namespace" | ||
| 48 | diff --git a/.bundle/gems/rexml-3.2.5/lib/rexml/source.rb b/.bundle/gems/rexml-3.2.5/lib/rexml/source.rb | ||
| 49 | index 4111d1d..7132147 100644 | ||
| 50 | --- a/.bundle/gems/rexml-3.2.5/lib/rexml/source.rb | ||
| 51 | +++ b/.bundle/gems/rexml-3.2.5/lib/rexml/source.rb | ||
| 52 | @@ -65,7 +65,11 @@ module REXML | ||
| 53 | encoding_updated | ||
| 54 | end | ||
| 55 | |||
| 56 | - def read | ||
| 57 | + def read(term = nil) | ||
| 58 | + end | ||
| 59 | + | ||
| 60 | + def read_until(term) | ||
| 61 | + @scanner.scan_until(Regexp.union(term)) or @scanner.rest | ||
| 62 | end | ||
| 63 | |||
| 64 | def match(pattern, cons=false) | ||
| 65 | @@ -151,9 +155,9 @@ module REXML | ||
| 66 | end | ||
| 67 | end | ||
| 68 | |||
| 69 | - def read | ||
| 70 | + def read(term = nil) | ||
| 71 | begin | ||
| 72 | - @scanner << readline | ||
| 73 | + @scanner << readline(term) | ||
| 74 | true | ||
| 75 | rescue Exception, NameError | ||
| 76 | @source = nil | ||
| 77 | @@ -161,6 +165,21 @@ module REXML | ||
| 78 | end | ||
| 79 | end | ||
| 80 | |||
| 81 | + def read_until(term) | ||
| 82 | + pattern = Regexp.union(term) | ||
| 83 | + data = [] | ||
| 84 | + begin | ||
| 85 | + until str = @scanner.scan_until(pattern) | ||
| 86 | + @scanner << readline(term) | ||
| 87 | + end | ||
| 88 | + rescue EOFError | ||
| 89 | + @scanner.rest | ||
| 90 | + else | ||
| 91 | + read if @scanner.eos? and !@source.eof? | ||
| 92 | + str | ||
| 93 | + end | ||
| 94 | + end | ||
| 95 | + | ||
| 96 | def match( pattern, cons=false ) | ||
| 97 | read if @scanner.eos? && @source | ||
| 98 | while true | ||
| 99 | @@ -205,8 +224,8 @@ module REXML | ||
| 100 | end | ||
| 101 | |||
| 102 | private | ||
| 103 | - def readline | ||
| 104 | - str = @source.readline(@line_break) | ||
| 105 | + def readline(term = nil) | ||
| 106 | + str = @source.readline(term || @line_break) | ||
| 107 | if @pending_buffer | ||
| 108 | if str.nil? | ||
| 109 | str = @pending_buffer | ||
| 110 | -- | ||
| 111 | 2.40.0 | ||
| 112 | |||
diff --git a/meta/recipes-devtools/ruby/ruby_3.1.3.bb b/meta/recipes-devtools/ruby/ruby_3.1.3.bb index 19641e5a51..6a381b2e40 100644 --- a/meta/recipes-devtools/ruby/ruby_3.1.3.bb +++ b/meta/recipes-devtools/ruby/ruby_3.1.3.bb | |||
| @@ -53,6 +53,7 @@ SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \ | |||
| 53 | file://CVE-2024-43398-0003.patch \ | 53 | file://CVE-2024-43398-0003.patch \ |
| 54 | file://CVE-2025-27221-0001.patch \ | 54 | file://CVE-2025-27221-0001.patch \ |
| 55 | file://CVE-2025-27221-0002.patch \ | 55 | file://CVE-2025-27221-0002.patch \ |
| 56 | file://CVE-2024-35176.patch \ | ||
| 56 | " | 57 | " |
| 57 | UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" | 58 | UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" |
| 58 | 59 | ||
