Skip to content

Commit 7f3b3ae

Browse files
[AUTO-CHERRYPICK] keda: Fix CVE-2022-32149 with a patch - branch main (#10339)
Co-authored-by: sindhu-karri <33163197+sindhu-karri@users.noreply.github.com>
1 parent 54ddc3d commit 7f3b3ae

2 files changed

Lines changed: 75 additions & 2 deletions

File tree

SPECS/keda/CVE-2022-32149.patch

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
From 7ee36713a66401f828dfe476196ca290f7c23ffe Mon Sep 17 00:00:00 2001
2+
From: Sindhu Karri <lakarri@microsoft.com>
3+
Date: Wed, 28 Aug 2024 05:01:17 +0000
4+
Subject: [PATCH] Fix CVE-2022-32149
5+
6+
---
7+
From 434eadcdbc3b0256971992e8c70027278364c72c Mon Sep 17 00:00:00 2001
8+
From: Roland Shoemaker <bracewell@google.com>
9+
Date: Fri, 2 Sep 2022 09:35:37 -0700
10+
Subject: [PATCH] language: reject excessively large Accept-Language strings
11+
12+
The BCP 47 tag parser has quadratic time complexity due to inherent
13+
aspects of its design. Since the parser is, by design, exposed to
14+
untrusted user input, this can be leveraged to force a program to
15+
consume significant time parsing Accept-Language headers.
16+
17+
The parser cannot be easily rewritten to fix this behavior for
18+
various reasons. Instead the solution implemented in this CL is to
19+
limit the total complexity of tags passed into ParseAcceptLanguage
20+
by limiting the number of dashes in the string to 1000. This should
21+
be more than enough for the majority of real world use cases, where
22+
the number of tags being sent is likely to be in the single digits.
23+
24+
Thanks to the OSS-Fuzz project for discovering this issue and to Adam
25+
Korczynski (ADA Logics) for writing the fuzz case and for reporting the
26+
issue.
27+
28+
Fixes CVE-2022-32149
29+
Fixes golang/go#56152
30+
31+
Change-Id: I7bda1d84cee2b945039c203f26869d58ee9374ae
32+
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1565112
33+
Reviewed-by: Damien Neil <dneil@google.com>
34+
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
35+
Reviewed-on: https://go-review.googlesource.com/c/text/+/442235
36+
TryBot-Result: Gopher Robot <gobot@golang.org>
37+
Auto-Submit: Roland Shoemaker <roland@golang.org>
38+
Run-TryBot: Roland Shoemaker <roland@golang.org>
39+
---
40+
vendor/golang.org/x/text/language/parse.go | 5 +++++
41+
1 file changed, 5 insertions(+)
42+
43+
diff --git a/vendor/golang.org/x/text/language/parse.go b/vendor/golang.org/x/text/language/parse.go
44+
index 11acfd8..11d11f4 100644
45+
--- a/vendor/golang.org/x/text/language/parse.go
46+
+++ b/vendor/golang.org/x/text/language/parse.go
47+
@@ -133,6 +133,7 @@ func update(b *language.Builder, part ...interface{}) (err error) {
48+
}
49+
50+
var errInvalidWeight = errors.New("ParseAcceptLanguage: invalid weight")
51+
+var errTagListTooLarge = errors.New("tag list exceeds max length")
52+
53+
// ParseAcceptLanguage parses the contents of an Accept-Language header as
54+
// defined in http://www.ietf.org/rfc/rfc2616.txt and returns a list of Tags and
55+
@@ -150,6 +151,10 @@ func ParseAcceptLanguage(s string) (tag []Tag, q []float32, err error) {
56+
57+
entry, weight := split(entry, ';')
58+
59+
+ if strings.Count(s, "-") > 1000 {
60+
+ return nil, nil, errTagListTooLarge
61+
+ }
62+
+
63+
// Scan the language.
64+
t, err := Parse(entry)
65+
if err != nil {
66+
--
67+
2.33.8
68+

SPECS/keda/keda.spec

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Kubernetes-based Event Driven Autoscaling
22
Name: keda
33
Version: 2.4.0
4-
Release: 22%{?dist}
4+
Release: 23%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -31,7 +31,9 @@ Source1: %{name}-%{version}-vendor-v2.tar.gz
3131
Patch0: CVE-2022-21698.patch
3232
Patch1: CVE-2023-44487.patch
3333
Patch2: CVE-2021-44716.patch
34-
Patch3: CVE-2024-6104.patch
34+
Patch3: CVE-2022-32149.patch
35+
Patch4: CVE-2024-6104.patch
36+
3537

3638
BuildRequires: golang
3739

@@ -67,6 +69,9 @@ cp ./bin/keda-adapter %{buildroot}%{_bindir}
6769
%{_bindir}/%{name}-adapter
6870

6971
%changelog
72+
* Fri Aug 30 2024 Sindhu Karri <lakarri@microsoft.com> - 2.4.0-23
73+
- Fix CVE-2022-32149 with a patch
74+
7075
* Thu Aug 01 2024 Bala <balakumaran.kannan@microsoft.com> - 2.4.0-22
7176
- Patch CVE-2024-6104
7277

0 commit comments

Comments
 (0)