Skip to content

Commit 5a0497d

Browse files
[AUTO-CHERRYPICK] cni : Fix CVE-2022-29526 and CVE-2024-45338 - branch 3.0-dev (#12077)
Co-authored-by: KavyaSree2610 <[email protected]>
1 parent c2cb363 commit 5a0497d

File tree

3 files changed

+133
-1
lines changed

3 files changed

+133
-1
lines changed

SPECS/cni/CVE-2022-29526.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From e13d51dae376f08ea381869af4880ca312111086 Mon Sep 17 00:00:00 2001
2+
From: Damien Neil <[email protected]>
3+
Date: Tue, 12 Apr 2022 13:38:17 -0700
4+
Subject: [PATCH] [release-branch.go1.17] syscall: check correct group in
5+
Faccessat
6+
7+
The Faccessat call checks the user, group, or other permission bits of a
8+
file to see if the calling process can access it. The test to see if the
9+
group permissions should be used was made with the wrong group id, using
10+
the process's group id rather than the file's group id. Fix this to use
11+
the correct group id.
12+
13+
No test since we cannot easily change file permissions when not running
14+
as root and the test is meaningless if running as root.
15+
16+
For #52313
17+
Fixes #52439
18+
19+
Change-Id: I4e2c84754b0af7830b40fd15dedcbc58374d75ee
20+
Reviewed-on: https://go-review.googlesource.com/c/go/+/399539
21+
Reviewed-by: Ian Lance Taylor <[email protected]>
22+
Run-TryBot: Ian Lance Taylor <[email protected]>
23+
TryBot-Result: Gopher Robot <[email protected]>
24+
(cherry picked from commit f66925e854e71e0c54b581885380a490d7afa30c)
25+
Reviewed-on: https://go-review.googlesource.com/c/go/+/401078
26+
Auto-Submit: Tatiana Bradley <[email protected]>
27+
Run-TryBot: Tatiana Bradley <[email protected]>
28+
Run-TryBot: Damien Neil <[email protected]>
29+
Auto-Submit: Damien Neil <[email protected]>
30+
Reviewed-by: Tatiana Bradley <[email protected]>
31+
---
32+
vendor/golang.org/x/sys/unix/syscall_linux.go | 2 +-
33+
1 file changed, 1 insertion(+), 1 deletion(-)
34+
35+
diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go
36+
index 3041f6f8fceda7..b2cc53e5c0dbe3 100644
37+
--- a/vendor/golang.org/x/sys/unix/syscall_linux.go
38+
+++ b/vendor/golang.org/x/sys/unix/syscall_linux.go
39+
@@ -106,7 +106,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
40+
gid = Getgid()
41+
}
42+
43+
- if uint32(gid) == st.Gid || isGroupMember(gid) {
44+
+ if uint32(gid) == st.Gid || isGroupMember(int(st.Gid)) {
45+
fmode = (st.Mode >> 3) & 7
46+
} else {
47+
fmode = st.Mode & 7

SPECS/cni/CVE-2024-45338.patch

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From 8e66b04771e35c4e4125e8c60334b34e2423effb Mon Sep 17 00:00:00 2001
2+
From: Roland Shoemaker <[email protected]>
3+
Date: Wed, 04 Dec 2024 09:35:55 -0800
4+
Subject: [PATCH] html: use strings.EqualFold instead of lowering ourselves
5+
6+
Instead of using strings.ToLower and == to check case insensitive
7+
equality, just use strings.EqualFold, even when the strings are only
8+
ASCII. This prevents us unnecessarily lowering extremely long strings,
9+
which can be a somewhat expensive operation, even if we're only
10+
attempting to compare equality with five characters.
11+
12+
Thanks to Guido Vranken for reporting this issue.
13+
14+
Fixes golang/go#70906
15+
Fixes CVE-2024-45338
16+
17+
Change-Id: I323b919f912d60dab6a87cadfdcac3e6b54cd128
18+
Reviewed-on: https://go-review.googlesource.com/c/net/+/637536
19+
LUCI-TryBot-Result: Go LUCI <[email protected]>
20+
Auto-Submit: Gopher Robot <[email protected]>
21+
Reviewed-by: Roland Shoemaker <[email protected]>
22+
Reviewed-by: Tatiana Bradley <[email protected]>
23+
---
24+
vendor/golang.org/x/net/html/doctype.go | 2 +-
25+
vendor/golang.org/x/net/html/foreign.go | 3 +--
26+
vendor/golang.org/x/net/html/parse.go | 4 ++--
27+
3 files changed, 4 insertions(+), 5 deletions(-)
28+
29+
diff --git a/vendor/golang.org/x/net/html/doctype.go b/vendor/golang.org/x/net/html/doctype.go
30+
index c484e5a..bca3ae9 100644
31+
--- a/vendor/golang.org/x/net/html/doctype.go
32+
+++ b/vendor/golang.org/x/net/html/doctype.go
33+
@@ -87,7 +87,7 @@ func parseDoctype(s string) (n *Node, quirks bool) {
34+
}
35+
}
36+
if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" &&
37+
- strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" {
38+
+ strings.EqualFold(lastAttr.Val, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
39+
quirks = true
40+
}
41+
}
42+
diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go
43+
index 9da9e9d..e8515d8 100644
44+
--- a/vendor/golang.org/x/net/html/foreign.go
45+
+++ b/vendor/golang.org/x/net/html/foreign.go
46+
@@ -40,8 +40,7 @@ func htmlIntegrationPoint(n *Node) bool {
47+
if n.Data == "annotation-xml" {
48+
for _, a := range n.Attr {
49+
if a.Key == "encoding" {
50+
- val := strings.ToLower(a.Val)
51+
- if val == "text/html" || val == "application/xhtml+xml" {
52+
+ if strings.EqualFold(a.Val, "text/html") || strings.EqualFold(a.Val, "application/xhtml+xml") {
53+
return true
54+
}
55+
}
56+
diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go
57+
index 038941d..cb012d8 100644
58+
--- a/vendor/golang.org/x/net/html/parse.go
59+
+++ b/vendor/golang.org/x/net/html/parse.go
60+
@@ -1031,7 +1031,7 @@ func inBodyIM(p *parser) bool {
61+
if p.tok.DataAtom == a.Input {
62+
for _, t := range p.tok.Attr {
63+
if t.Key == "type" {
64+
- if strings.ToLower(t.Val) == "hidden" {
65+
+ if strings.EqualFold(t.Val, "hidden") {
66+
// Skip setting framesetOK = false
67+
return true
68+
}
69+
@@ -1459,7 +1459,7 @@ func inTableIM(p *parser) bool {
70+
return inHeadIM(p)
71+
case a.Input:
72+
for _, t := range p.tok.Attr {
73+
- if t.Key == "type" && strings.ToLower(t.Val) == "hidden" {
74+
+ if t.Key == "type" && strings.EqualFold(t.Val, "hidden") {
75+
p.addElement()
76+
p.oe.pop()
77+
return true
78+
--
79+
2.25.1
80+

SPECS/cni/cni.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
Summary: Container Network Interface - networking for Linux containers
2525
Name: cni
2626
Version: 1.1.2
27-
Release: 3%{?dist}
27+
Release: 4%{?dist}
2828
License: Apache-2.0
2929
Vendor: Microsoft Corporation
3030
Distribution: Azure Linux
@@ -50,6 +50,8 @@ Source2: build.sh
5050
Source3: %{name}-%{version}-vendor.tar.gz
5151
Patch0: CVE-2021-38561.patch
5252
Patch1: CVE-2022-32149.patch
53+
Patch2: CVE-2024-45338.patch
54+
Patch3: CVE-2022-29526.patch
5355
BuildRequires: golang
5456
BuildRequires: systemd-rpm-macros
5557
BuildRequires: xz
@@ -115,6 +117,9 @@ install -m 755 -d "%{buildroot}%{cni_doc_dir}"
115117
%{_sbindir}/cnitool
116118

117119
%changelog
120+
* Thu Jan 23 2025 Kavya Sree Kaitepalli <[email protected]> - 1.1.2-4
121+
- Patch CVE-2024-45338 and CVE-2022-29526
122+
118123
* Fri Sep 06 2024 Muhammad Falak R Wani <[email protected]> - 1.1.2-3
119124
- Patch CVE-2022-32149
120125

0 commit comments

Comments
 (0)