Skip to content

Commit 272c12a

Browse files
[AUTO-CHERRYPICK] [Low] Patch kubevirt for CVE-2024-51744 - branch main (#13388)
Co-authored-by: jykanase <v-jykanase@microsoft.com>
1 parent a98d6e6 commit 272c12a

2 files changed

Lines changed: 94 additions & 1 deletion

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
From 309f73af3177c403db2e81ff53885504a3764f7a Mon Sep 17 00:00:00 2001
2+
From: jykanase <v-jykanase@microsoft.com>
3+
Date: Thu, 27 Mar 2025 06:32:35 +0000
4+
Subject: [PATCH] CVE-2024-51744
5+
6+
Source Link: https://github.com/golang-jwt/jwt/commit/7b1c1c00a171c6c79bbdb40e4ce7d197060c1c2c
7+
---
8+
.../github.com/form3tech-oss/jwt-go/parser.go | 38 ++++++++++---------
9+
1 file changed, 21 insertions(+), 17 deletions(-)
10+
11+
diff --git a/vendor/github.com/form3tech-oss/jwt-go/parser.go b/vendor/github.com/form3tech-oss/jwt-go/parser.go
12+
index d6901d9..183cbf8 100644
13+
--- a/vendor/github.com/form3tech-oss/jwt-go/parser.go
14+
+++ b/vendor/github.com/form3tech-oss/jwt-go/parser.go
15+
@@ -13,13 +13,20 @@ type Parser struct {
16+
SkipClaimsValidation bool // Skip claims validation during token parsing
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 +63,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 +81,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+
--
87+
2.45.2
88+

SPECS/kubevirt/kubevirt.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Summary: Container native virtualization
2020
Name: kubevirt
2121
Version: 0.59.0
22-
Release: 26%{?dist}
22+
Release: 27%{?dist}
2323
License: ASL 2.0
2424
Vendor: Microsoft Corporation
2525
Distribution: Mariner
@@ -43,6 +43,8 @@ Patch10: CVE-2024-45338.patch
4343
Patch11: CVE-2023-3978.patch
4444
Patch12: CVE-2025-22869.patch
4545
Patch13: CVE-2023-48795.patch
46+
Patch14: CVE-2024-51744.patch
47+
4648
%global debug_package %{nil}
4749
BuildRequires: glibc-devel
4850
BuildRequires: glibc-static >= 2.35-7%{?dist}
@@ -222,6 +224,9 @@ install -p -m 0644 cmd/virt-handler/nsswitch.conf %{buildroot}%{_datadir}/kube-v
222224
%{_bindir}/virt-tests
223225

224226
%changelog
227+
* Thu Mar 27 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 0.59.0-27
228+
- Fix CVE-2024-51744
229+
225230
* Fri Apr 04 2025 Sumedh Sharma <sumsharma@microsoft.com> - 0.59.0-26
226231
- Add patch to resolve CVE-2023-48795
227232

0 commit comments

Comments
 (0)