Skip to content

Commit 91309e5

Browse files
[AUTO-CHERRYPICK] [High] Patch moby-engine for CVE-2025-30204 - branch 3.0-dev (#13542)
Co-authored-by: Dallas Delaney <106280731+dallasd1@users.noreply.github.com>
1 parent 902a1c0 commit 91309e5

2 files changed

Lines changed: 76 additions & 1 deletion

File tree

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

SPECS/moby-engine/moby-engine.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Summary: The open-source application container engine
44
Name: moby-engine
55
Version: 25.0.3
6-
Release: 11%{?dist}
6+
Release: 12%{?dist}
77
License: ASL 2.0
88
Group: Tools/Container
99
URL: https://mobyproject.org
@@ -26,6 +26,7 @@ Patch8: CVE-2024-45337.patch
2626
Patch9: CVE-2023-45288.patch
2727
Patch10: CVE-2025-22868.patch
2828
Patch11: CVE-2025-22869.patch
29+
Patch12: CVE-2025-30204.patch
2930

3031
%{?systemd_requires}
3132

@@ -121,6 +122,9 @@ fi
121122
%{_unitdir}/*
122123

123124
%changelog
125+
* Mon Apr 21 2025 Dallas Delaney <dadelan@microsoft.com> - 25.0.3-12
126+
- Patch CVE-2025-30204
127+
124128
* Mon Mar 17 2025 Dallas Delaney <dadelan@microsoft.com> - 25.0.3-11
125129
- Patch CVE-2025-22868 & CVE-2025-22869
126130

0 commit comments

Comments
 (0)