Skip to content

Commit 400e0da

Browse files
author
Henry Li
committed
resolve kubernetes CVE-2024-28180
1 parent a5e9d27 commit 400e0da

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

SPECS/kubernetes/CVE-2024-28180.patch

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
diff --git a/./vendor/gopkg.in/square/go-jose.v2/crypter.go b/../kubernetes/vendor/gopkg.in/square/go-jose.v2/crypter.go
2+
index be7433e..763eae0 100644
3+
--- a/./vendor/gopkg.in/square/go-jose.v2/crypter.go
4+
+++ b/../kubernetes/vendor/gopkg.in/square/go-jose.v2/crypter.go
5+
@@ -406,6 +406,9 @@ func (ctx *genericEncrypter) Options() EncrypterOptions {
6+
// Decrypt and validate the object and return the plaintext. Note that this
7+
// function does not support multi-recipient, if you desire multi-recipient
8+
// decryption use DecryptMulti instead.
9+
+//
10+
+// Automatically decompresses plaintext, but returns an error if the decompressed
11+
+// data would be >250kB or >10x the size of the compressed data, whichever is larger.
12+
func (obj JSONWebEncryption) Decrypt(decryptionKey interface{}) ([]byte, error) {
13+
headers := obj.mergedHeaders(nil)
14+
15+
@@ -470,6 +473,9 @@ func (obj JSONWebEncryption) Decrypt(decryptionKey interface{}) ([]byte, error)
16+
// with support for multiple recipients. It returns the index of the recipient
17+
// for which the decryption was successful, the merged headers for that recipient,
18+
// and the plaintext.
19+
+//
20+
+// Automatically decompresses plaintext, but returns an error if the decompressed
21+
+// data would be >250kB or >3x the size of the compressed data, whichever is larger.
22+
func (obj JSONWebEncryption) DecryptMulti(decryptionKey interface{}) (int, Header, []byte, error) {
23+
globalHeaders := obj.mergedHeaders(nil)
24+
25+
diff --git a/./vendor/gopkg.in/square/go-jose.v2/encoding.go b/../kubernetes/vendor/gopkg.in/square/go-jose.v2/encoding.go
26+
index 70f7385..ab9e086 100644
27+
--- a/./vendor/gopkg.in/square/go-jose.v2/encoding.go
28+
+++ b/../kubernetes/vendor/gopkg.in/square/go-jose.v2/encoding.go
29+
@@ -21,6 +21,7 @@ import (
30+
"compress/flate"
31+
"encoding/base64"
32+
"encoding/binary"
33+
+ "fmt"
34+
"io"
35+
"math/big"
36+
"strings"
37+
@@ -85,7 +86,7 @@ func decompress(algorithm CompressionAlgorithm, input []byte) ([]byte, error) {
38+
}
39+
}
40+
41+
-// Compress with DEFLATE
42+
+// deflate compresses the input.
43+
func deflate(input []byte) ([]byte, error) {
44+
output := new(bytes.Buffer)
45+
46+
@@ -97,15 +98,27 @@ func deflate(input []byte) ([]byte, error) {
47+
return output.Bytes(), err
48+
}
49+
50+
-// Decompress with DEFLATE
51+
+// inflate decompresses the input.
52+
+//
53+
+// Errors if the decompressed data would be >250kB or >10x the size of the
54+
+// compressed data, whichever is larger.
55+
func inflate(input []byte) ([]byte, error) {
56+
output := new(bytes.Buffer)
57+
reader := flate.NewReader(bytes.NewBuffer(input))
58+
59+
- _, err := io.Copy(output, reader)
60+
- if err != nil {
61+
+ maxCompressedSize := 10 * int64(len(input))
62+
+ if maxCompressedSize < 250000 {
63+
+ maxCompressedSize = 250000
64+
+ }
65+
+
66+
+ limit := maxCompressedSize + 1
67+
+ n, err := io.CopyN(output, reader, limit)
68+
+ if err != nil && err != io.EOF {
69+
return nil, err
70+
}
71+
+ if n == limit {
72+
+ return nil, fmt.Errorf("uncompressed data would be too large (>%d bytes)", maxCompressedSize)
73+
+ }
74+
75+
err = reader.Close()
76+
return output.Bytes(), err

SPECS/kubernetes/kubernetes.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Summary: Microsoft Kubernetes
1111
Name: kubernetes
1212
Version: 1.28.4
13-
Release: 10%{?dist}
13+
Release: 11%{?dist}
1414
License: ASL 2.0
1515
Vendor: Microsoft Corporation
1616
Distribution: Mariner
@@ -22,6 +22,7 @@ Patch0: CVE-2024-21626.patch
2222
Patch1: CVE-2023-48795.patch
2323
Patch2: CVE-2023-5408.patch
2424
Patch3: CVE-2023-45288.patch
25+
Patch4: CVE-2024-28180.patch
2526
BuildRequires: flex-devel
2627
BuildRequires: glibc-static >= 2.35-7%{?dist}
2728
BuildRequires: golang
@@ -268,6 +269,9 @@ fi
268269
%{_exec_prefix}/local/bin/pause
269270

270271
%changelog
272+
* Mon Oct 01 2024 Henry Li <[email protected]> - 1.28.4-11
273+
- Add patch to resolve CVE-2024-28180
274+
271275
* Mon Sep 09 2024 CBL-Mariner Servicing Account <[email protected]> - 1.28.4-10
272276
- Bump release to rebuild with go 1.22.7
273277

0 commit comments

Comments
 (0)