Skip to content

Commit 28385f1

Browse files
[AUTO-CHERRYPICK] [Medium] Patch azcopy for CVE-2025-22870 and CVE-2024-51744 - branch main (#13153)
Co-authored-by: Sreenivasulu Malavathula (HCL Technologies Ltd) <v-smalavathu@microsoft.com>
1 parent 877ff01 commit 28385f1

3 files changed

Lines changed: 145 additions & 1 deletion

File tree

SPECS/azcopy/CVE-2024-51744.patch

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
From 82929346de41771c3c3e3db7970644afdefa5369 Mon Sep 17 00:00:00 2001
2+
From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
3+
Date: Mon, 17 Mar 2025 14:33:58 -0500
4+
Subject: [PATCH] Addressing CVE-2024-51744.patch
5+
6+
---
7+
vendor/github.com/golang-jwt/jwt/v4/parser.go | 41 +++++++++----------
8+
1 file changed, 20 insertions(+), 21 deletions(-)
9+
10+
diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser.go b/vendor/github.com/golang-jwt/jwt/v4/parser.go
11+
index c0a6f69..9dd36e5 100644
12+
--- a/vendor/github.com/golang-jwt/jwt/v4/parser.go
13+
+++ b/vendor/github.com/golang-jwt/jwt/v4/parser.go
14+
@@ -36,19 +36,21 @@ func NewParser(options ...ParserOption) *Parser {
15+
return p
16+
}
17+
18+
-// Parse parses, validates, verifies the signature and returns the parsed token.
19+
-// keyFunc will receive the parsed token and should return the key for validating.
20+
+// Parse parses, validates, verifies the signature and returns the parsed token. keyFunc will
21+
+// receive the parsed token and should return the key for validating.
22+
func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
23+
return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
24+
}
25+
26+
-// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims
27+
-// interface. This provides default values which can be overridden and allows a caller to use their own type, rather
28+
-// than the default MapClaims implementation of Claims.
29+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object
30+
+// implementing the Claims interface. This provides default values which can be overridden and
31+
+// allows a caller to use their own type, rather than the default MapClaims implementation of
32+
+// Claims.
33+
//
34+
-// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
35+
-// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
36+
-// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
37+
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such
38+
+// as RegisteredClaims), make sure that a) you either embed a non-pointer version of the claims or
39+
+// b) if you are using a pointer, allocate the proper memory for it before passing in the overall
40+
+// claims, otherwise you might run into a panic.
41+
func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
42+
token, parts, err := p.ParseUnverified(tokenString, claims)
43+
if err != nil {
44+
@@ -85,12 +87,17 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
45+
return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
46+
}
47+
48+
+ // Perform validation
49+
+ token.Signature = parts[2]
50+
+ if err := token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
51+
+ return token, &ValidationError{Inner: err, Errors: ValidationErrorSignatureInvalid}
52+
+ }
53+
+
54+
vErr := &ValidationError{}
55+
56+
// Validate Claims
57+
if !p.SkipClaimsValidation {
58+
if err := token.Claims.Valid(); err != nil {
59+
-
60+
// If the Claims Valid returned an error, check if it is a validation error,
61+
// If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
62+
if e, ok := err.(*ValidationError); !ok {
63+
@@ -98,22 +105,14 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
64+
} else {
65+
vErr = e
66+
}
67+
+ return token, vErr
68+
}
69+
}
70+
71+
- // Perform validation
72+
- token.Signature = parts[2]
73+
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
74+
- vErr.Inner = err
75+
- vErr.Errors |= ValidationErrorSignatureInvalid
76+
- }
77+
-
78+
- if vErr.valid() {
79+
- token.Valid = true
80+
- return token, nil
81+
- }
82+
+ // No errors so far, token is valid.
83+
+ token.Valid = true
84+
85+
- return token, vErr
86+
+ return token, nil
87+
}
88+
89+
// ParseUnverified parses the token but doesn't validate the signature.
90+
--
91+
2.45.2
92+

SPECS/azcopy/CVE-2025-22870.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 9e740dda3b87118fdd86a8afea6f3b8e01ed2aa2 Mon Sep 17 00:00:00 2001
2+
From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
3+
Date: Mon, 17 Mar 2025 14:32:13 -0500
4+
Subject: [PATCH] Addressing CVE-2025-22870
5+
6+
---
7+
vendor/golang.org/x/net/http/httpproxy/proxy.go | 10 ++++++++--
8+
1 file changed, 8 insertions(+), 2 deletions(-)
9+
10+
diff --git a/vendor/golang.org/x/net/http/httpproxy/proxy.go b/vendor/golang.org/x/net/http/httpproxy/proxy.go
11+
index 6404aaf..d89c257 100644
12+
--- a/vendor/golang.org/x/net/http/httpproxy/proxy.go
13+
+++ b/vendor/golang.org/x/net/http/httpproxy/proxy.go
14+
@@ -14,6 +14,7 @@ import (
15+
"errors"
16+
"fmt"
17+
"net"
18+
+ "net/netip"
19+
"net/url"
20+
"os"
21+
"strings"
22+
@@ -177,8 +178,10 @@ func (cfg *config) useProxy(addr string) bool {
23+
if host == "localhost" {
24+
return false
25+
}
26+
- ip := net.ParseIP(host)
27+
- if ip != nil {
28+
+ nip, err := netip.ParseAddr(host)
29+
+ var ip net.IP
30+
+ if err == nil {
31+
+ ip = net.IP(nip.AsSlice())
32+
if ip.IsLoopback() {
33+
return false
34+
}
35+
@@ -360,6 +363,9 @@ type domainMatch struct {
36+
}
37+
38+
func (m domainMatch) match(host, port string, ip net.IP) bool {
39+
+ if ip != nil {
40+
+ return false
41+
+ }
42+
if strings.HasSuffix(host, m.host) || (m.matchHost && host == m.host[1:]) {
43+
return m.port == "" || m.port == port
44+
}
45+
--
46+
2.45.2
47+

SPECS/azcopy/azcopy.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: The new Azure Storage data transfer utility - AzCopy v10
22
Name: azcopy
33
Version: 10.25.1
4-
Release: 3%{?dist}
4+
Release: 4%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -28,6 +28,8 @@ Source0: https://github.com/Azure/azure-storage-azcopy/archive/refs/tags/
2828
# - For the value of "--mtime" use the date "2021-04-26 00:00Z" to simplify future updates.
2929
Source1: azure-storage-%{name}-%{version}-vendor.tar.gz
3030
Patch0: CVE-2025-22868.patch
31+
Patch1: CVE-2025-22870.patch
32+
Patch2: CVE-2024-51744.patch
3133

3234
BuildRequires: golang
3335
BuildRequires: git
@@ -64,6 +66,9 @@ go test -mod=vendor
6466
%{_bindir}/azcopy
6567

6668
%changelog
69+
* Mon Mar 17 2025 Sreeniavsulu Malavathula <v-smalavathu@microsoft.com> - 10.25.1-4
70+
- Fix CVE-2025-22870, CVE-2024-51744 with an upstream patch
71+
6772
* Tue Mar 04 2025 Kanishk Bansal <kanbansal@microsoft.com> - 10.25.1-3
6873
- Fix CVE-2025-22868 with an upstream patch
6974

0 commit comments

Comments
 (0)