Skip to content

Commit fb8d13a

Browse files
CBL-Mariner-BotKanishk-Bansaljslobodzian
authored
[AUTO-CHERRYPICK] Patch prometheus for CVE-2025-30204 [High] - branch 3.0-dev (#13233)
Co-authored-by: Kanishk Bansal <[email protected]> Co-authored-by: jslobodzian <[email protected]>
1 parent 2c7db7b commit fb8d13a

File tree

2 files changed

+81
-4
lines changed

2 files changed

+81
-4
lines changed

SPECS/prometheus/CVE-2025-30204.patch

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
From 5dc62bf02f675d71ba521c6ae2a502474a0f351b Mon Sep 17 00:00:00 2001
2+
From: Kanishk-Bansal <[email protected]>
3+
Date: Fri, 28 Mar 2025 21:58:44 +0000
4+
Subject: [PATCH] CVE-2025-30204
5+
6+
Upstream Patch Reference : v4: https://github.com/golang-jwt/jwt/commit/2f0e9add62078527821828c76865661aa7718a84
7+
8+
---
9+
vendor/github.com/golang-jwt/jwt/v4/parser.go | 36 +++++++++++++++++++++++---
10+
1 file changed, 33 insertions(+), 3 deletions(-)
11+
12+
diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser.go b/vendor/github.com/golang-jwt/jwt/v4/parser.go
13+
index c0a6f69..8e7e67c 100644
14+
--- a/vendor/github.com/golang-jwt/jwt/v4/parser.go
15+
+++ b/vendor/github.com/golang-jwt/jwt/v4/parser.go
16+
@@ -7,6 +7,8 @@ import (
17+
"strings"
18+
)
19+
20+
+const tokenDelimiter = "."
21+
+
22+
type Parser struct {
23+
// If populated, only these methods will be considered valid.
24+
//
25+
@@ -123,9 +125,10 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
26+
// It's only ever useful in cases where you know the signature is valid (because it has
27+
// been checked previously in the stack) and you want to extract values from it.
28+
func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) {
29+
- parts = strings.Split(tokenString, ".")
30+
- if len(parts) != 3 {
31+
- return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
32+
+ var ok bool
33+
+ parts, ok = splitToken(tokenString)
34+
+ if !ok {
35+
+ return nil, nil, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
36+
}
37+
38+
token = &Token{Raw: tokenString}
39+
@@ -175,3 +178,30 @@ func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Toke
40+
41+
return token, parts, nil
42+
}
43+
+
44+
+// splitToken splits a token string into three parts: header, claims, and signature. It will only
45+
+// return true if the token contains exactly two delimiters and three parts. In all other cases, it
46+
+// will return nil parts and false.
47+
+func splitToken(token string) ([]string, bool) {
48+
+ parts := make([]string, 3)
49+
+ header, remain, ok := strings.Cut(token, tokenDelimiter)
50+
+ if !ok {
51+
+ return nil, false
52+
+ }
53+
+ parts[0] = header
54+
+ claims, remain, ok := strings.Cut(remain, tokenDelimiter)
55+
+ if !ok {
56+
+ return nil, false
57+
+ }
58+
+ parts[1] = claims
59+
+ // One more cut to ensure the signature is the last part of the token and there are no more
60+
+ // delimiters. This avoids an issue where malicious input could contain additional delimiters
61+
+ // causing unecessary overhead parsing tokens.
62+
+ signature, _, unexpected := strings.Cut(remain, tokenDelimiter)
63+
+ if unexpected {
64+
+ return nil, false
65+
+ }
66+
+ parts[2] = signature
67+
+
68+
+ return parts, true
69+
+}
70+
--
71+
2.45.2
72+

SPECS/prometheus/prometheus.spec

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Summary: Prometheus monitoring system and time series database
55
Name: prometheus
66
Version: 2.45.4
7-
Release: 9%{?dist}
7+
Release: 10%{?dist}
88
License: Apache-2.0
99
Vendor: Microsoft Corporation
1010
Distribution: Azure Linux
@@ -23,8 +23,10 @@ Patch2: CVE-2024-6104.patch
2323
Patch3: CVE-2024-24786.patch
2424
Patch4: CVE-2023-44487.patch
2525
Patch5: CVE-2025-22868.patch
26-
Patch6: 0001-Fix-exit-condition-of-TestQuerierIndexQueriesRace.patch
27-
Patch7: 0002-Improve-sensitivity-of-TestQuerierIndexQueriesRace.patch
26+
Patch6: CVE-2025-30204.patch
27+
Patch7: 0001-Fix-exit-condition-of-TestQuerierIndexQueriesRace.patch
28+
Patch8: 0002-Improve-sensitivity-of-TestQuerierIndexQueriesRace.patch
29+
2830
BuildRequires: golang
2931
BuildRequires: nodejs
3032
BuildRequires: nodejs-npm
@@ -141,9 +143,12 @@ fi
141143
%doc README.md RELEASE.md documentation
142144

143145
%changelog
144-
* Thu Mar 13 2025 Andrew Phelps <[email protected]> - 2.45.4-9
146+
* Mon Mar 31 2025 Andrew Phelps <[email protected]> - 2.45.4-10
145147
- Add patches to fix test reliability issues with TestQuerierIndexQueriesRace
146148

149+
* Sun Mar 30 2025 Kanishk Bansal <[email protected]> - 2.45.4-9
150+
- Patch CVE-2025-30204
151+
147152
* Thu Mar 06 2025 Sandeep Karambelkar <[email protected]> - 2.45.4-8
148153
- Fix CVE-2025-22868
149154

0 commit comments

Comments
 (0)