Skip to content

Commit c2cb363

Browse files
[AUTO-CHERRYPICK] influxdb: Fix CVE-2024-28180 - branch 3.0-dev (#12076)
Co-authored-by: KavyaSree2610 <[email protected]>
1 parent 44e4c5e commit c2cb363

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

SPECS/influxdb/CVE-2024-28180.patch

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

SPECS/influxdb/influxdb.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Summary: Scalable datastore for metrics, events, and real-time analytics
1919
Name: influxdb
2020
Version: 2.7.3
21-
Release: 8%{?dist}
21+
Release: 9%{?dist}
2222
License: MIT
2323
Vendor: Microsoft Corporation
2424
Distribution: Azure Linux
@@ -61,6 +61,7 @@ Patch2: CVE-2024-6104.patch
6161
Patch3: CVE-2023-45288.patch
6262
Patch4: CVE-2024-24786.patch
6363
Patch5: CVE-2024-45338.patch
64+
Patch6: CVE-2024-28180.patch
6465
BuildRequires: clang
6566
BuildRequires: golang
6667
BuildRequires: kernel-headers
@@ -150,6 +151,9 @@ go test ./...
150151
%{_tmpfilesdir}/influxdb.conf
151152

152153
%changelog
154+
* Wed Jan 27 2025 Kavya Sree Kaitepalli <[email protected]> - 2.7.3-9
155+
- Fix CVE-2024-28180
156+
153157
* Tue Dec 31 2024 Rohit Rawat <[email protected]> - 2.7.3-8
154158
- Add patch for CVE-2024-45338
155159

0 commit comments

Comments
 (0)