Skip to content

Commit bfd9038

Browse files
v-smalavathujslobodzian
authored andcommitted
[Medium] Patch influxdb for CVE-2025-22870 and CVE-2024-51744 (#13095)
Signed-off-by: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
1 parent 73d1b48 commit bfd9038

3 files changed

Lines changed: 218 additions & 2 deletions

File tree

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
From 70f398a64b207c0f9da5c11ac414e32d2097e79e Mon Sep 17 00:00:00 2001
2+
From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
3+
Date: Mon, 24 Mar 2025 18:07:18 -0500
4+
Subject: [PATCH] Addressing CVE-2024-51744
5+
Upstream Patch Reference: https://github.com/golang-jwt/jwt/commit/7b1c1c00a171c6c79bbdb40e4ce7d197060c1c2c
6+
7+
---
8+
.../github.com/form3tech-oss/jwt-go/parser.go | 36 +++++++++++--------
9+
vendor/github.com/golang-jwt/jwt/parser.go | 36 +++++++++++--------
10+
2 files changed, 42 insertions(+), 30 deletions(-)
11+
12+
diff --git a/vendor/github.com/form3tech-oss/jwt-go/parser.go b/vendor/github.com/form3tech-oss/jwt-go/parser.go
13+
index d6901d9..bfb480c 100644
14+
--- a/vendor/github.com/form3tech-oss/jwt-go/parser.go
15+
+++ b/vendor/github.com/form3tech-oss/jwt-go/parser.go
16+
@@ -14,12 +14,21 @@ type Parser struct {
17+
}
18+
19+
// Parse, validate, and return a token.
20+
-// keyFunc will receive the parsed token and should return the key for validating.
21+
-// If everything is kosher, err will be nil
22+
+// Parse parses, validates, verifies the signature and returns the parsed token. keyFunc will
23+
+// receive the parsed token and should return the key for validating.
24+
func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
25+
return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
26+
}
27+
28+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object
29+
+// implementing the Claims interface. This provides default values which can be overridden and
30+
+// allows a caller to use their own type, rather than the default MapClaims implementation of
31+
+// Claims.
32+
+//
33+
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such
34+
+// as RegisteredClaims), make sure that a) you either embed a non-pointer version of the claims or
35+
+// b) if you are using a pointer, allocate the proper memory for it before passing in the overall
36+
+// claims, otherwise you might run into a panic.
37+
func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
38+
token, parts, err := p.ParseUnverified(tokenString, claims)
39+
if err != nil {
40+
@@ -56,12 +65,17 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
41+
return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
42+
}
43+
44+
+ // Perform validation
45+
+ token.Signature = parts[2]
46+
+ if err := token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
47+
+ return token, &ValidationError{Inner: err, Errors: ValidationErrorSignatureInvalid}
48+
+ }
49+
+
50+
vErr := &ValidationError{}
51+
52+
// Validate Claims
53+
if !p.SkipClaimsValidation {
54+
if err := token.Claims.Valid(); err != nil {
55+
-
56+
// If the Claims Valid returned an error, check if it is a validation error,
57+
// If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
58+
if e, ok := err.(*ValidationError); !ok {
59+
@@ -69,22 +83,14 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
60+
} else {
61+
vErr = e
62+
}
63+
+ return token, vErr
64+
}
65+
}
66+
67+
- // Perform validation
68+
- token.Signature = parts[2]
69+
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
70+
- vErr.Inner = err
71+
- vErr.Errors |= ValidationErrorSignatureInvalid
72+
- }
73+
-
74+
- if vErr.valid() {
75+
- token.Valid = true
76+
- return token, nil
77+
- }
78+
+ // No errors so far, token is valid.
79+
+ token.Valid = true
80+
81+
- return token, vErr
82+
+ return token, nil
83+
}
84+
85+
// WARNING: Don't use this method unless you know what you're doing
86+
diff --git a/vendor/github.com/golang-jwt/jwt/parser.go b/vendor/github.com/golang-jwt/jwt/parser.go
87+
index d6901d9..bfb480c 100644
88+
--- a/vendor/github.com/golang-jwt/jwt/parser.go
89+
+++ b/vendor/github.com/golang-jwt/jwt/parser.go
90+
@@ -14,12 +14,21 @@ type Parser struct {
91+
}
92+
93+
// Parse, validate, and return a token.
94+
-// keyFunc will receive the parsed token and should return the key for validating.
95+
-// If everything is kosher, err will be nil
96+
+// Parse parses, validates, verifies the signature and returns the parsed token. keyFunc will
97+
+// receive the parsed token and should return the key for validating.
98+
func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
99+
return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
100+
}
101+
102+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object
103+
+// implementing the Claims interface. This provides default values which can be overridden and
104+
+// allows a caller to use their own type, rather than the default MapClaims implementation of
105+
+// Claims.
106+
+//
107+
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such
108+
+// as RegisteredClaims), make sure that a) you either embed a non-pointer version of the claims or
109+
+// b) if you are using a pointer, allocate the proper memory for it before passing in the overall
110+
+// claims, otherwise you might run into a panic.
111+
func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
112+
token, parts, err := p.ParseUnverified(tokenString, claims)
113+
if err != nil {
114+
@@ -56,12 +65,17 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
115+
return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
116+
}
117+
118+
+ // Perform validation
119+
+ token.Signature = parts[2]
120+
+ if err := token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
121+
+ return token, &ValidationError{Inner: err, Errors: ValidationErrorSignatureInvalid}
122+
+ }
123+
+
124+
vErr := &ValidationError{}
125+
126+
// Validate Claims
127+
if !p.SkipClaimsValidation {
128+
if err := token.Claims.Valid(); err != nil {
129+
-
130+
// If the Claims Valid returned an error, check if it is a validation error,
131+
// If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
132+
if e, ok := err.(*ValidationError); !ok {
133+
@@ -69,22 +83,14 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
134+
} else {
135+
vErr = e
136+
}
137+
+ return token, vErr
138+
}
139+
}
140+
141+
- // Perform validation
142+
- token.Signature = parts[2]
143+
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
144+
- vErr.Inner = err
145+
- vErr.Errors |= ValidationErrorSignatureInvalid
146+
- }
147+
-
148+
- if vErr.valid() {
149+
- token.Valid = true
150+
- return token, nil
151+
- }
152+
+ // No errors so far, token is valid.
153+
+ token.Valid = true
154+
155+
- return token, vErr
156+
+ return token, nil
157+
}
158+
159+
// WARNING: Don't use this method unless you know what you're doing
160+
--
161+
2.45.2
162+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 9b0870e4d74b720661460e3a7ac9b45945790799 Mon Sep 17 00:00:00 2001
2+
From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
3+
Date: Mon, 24 Mar 2025 17:42:42 -0500
4+
Subject: [PATCH] Addressing CVE-2025-22870
5+
Upstream Patch Reference: https://github.com/golang/go/commit/25177ecde0922c50753c043579d17828b7ee88e7
6+
7+
8+
---
9+
vendor/golang.org/x/net/http/httpproxy/proxy.go | 10 ++++++++--
10+
1 file changed, 8 insertions(+), 2 deletions(-)
11+
12+
diff --git a/vendor/golang.org/x/net/http/httpproxy/proxy.go b/vendor/golang.org/x/net/http/httpproxy/proxy.go
13+
index c3bd9a1..864961c 100644
14+
--- a/vendor/golang.org/x/net/http/httpproxy/proxy.go
15+
+++ b/vendor/golang.org/x/net/http/httpproxy/proxy.go
16+
@@ -14,6 +14,7 @@ import (
17+
"errors"
18+
"fmt"
19+
"net"
20+
+ "net/netip"
21+
"net/url"
22+
"os"
23+
"strings"
24+
@@ -180,8 +181,10 @@ func (cfg *config) useProxy(addr string) bool {
25+
if host == "localhost" {
26+
return false
27+
}
28+
- ip := net.ParseIP(host)
29+
- if ip != nil {
30+
+ nip, err := netip.ParseAddr(host)
31+
+ var ip net.IP
32+
+ if err == nil {
33+
+ ip = net.IP(nip.AsSlice())
34+
if ip.IsLoopback() {
35+
return false
36+
}
37+
@@ -363,6 +366,9 @@ type domainMatch struct {
38+
}
39+
40+
func (m domainMatch) match(host, port string, ip net.IP) bool {
41+
+ if ip != nil {
42+
+ return false
43+
+ }
44+
if strings.HasSuffix(host, m.host) || (m.matchHost && host == m.host[1:]) {
45+
return m.port == "" || m.port == port
46+
}
47+
--
48+
2.45.2
49+

SPECS/influxdb/influxdb.spec

Lines changed: 7 additions & 2 deletions
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.5
21-
Release: 3%{?dist}
21+
Release: 4%{?dist}
2222
License: MIT
2323
Vendor: Microsoft Corporation
2424
Distribution: Azure Linux
@@ -64,6 +64,8 @@ Patch5: CVE-2024-45338.patch
6464
Patch6: CVE-2024-28180.patch
6565
Patch7: CVE-2025-27144.patch
6666
Patch8: CVE-2025-22868.patch
67+
Patch9: CVE-2025-22870.patch
68+
Patch10: CVE-2024-51744.patch
6769
BuildRequires: clang
6870
BuildRequires: golang
6971
BuildRequires: kernel-headers
@@ -153,9 +155,12 @@ go test ./...
153155
%{_tmpfilesdir}/influxdb.conf
154156

155157
%changelog
156-
* Mon Apr 21 2025 Kavya Sree Kaitepalli <kkaitepalli@microsoft.com> - 2.7.5-3
158+
* Mon Apr 21 2025 Kavya Sree Kaitepalli <kkaitepalli@microsoft.com> - 2.7.5-4
157159
- Pin rust version
158160

161+
* Mon Mar 24 2025 Sreeniavsulu Malavathula <v-smalavathu@microsoft.com> - 2.7.5-3
162+
- Patch CVE-2025-22870, CVE-2024-51744
163+
159164
* Mon Mar 03 2025 Kanishk Bansal <kanbansal@microsoft.com> - 2.7.5-2
160165
- Fix CVE-2025-22868, CVE-2025-27144 with an upstream patch
161166

0 commit comments

Comments
 (0)