Skip to content

Commit 90e8d60

Browse files
[AutoPR- Security] Patch iperf3 for CVE-2025-54350, CVE-2025-54349 [MEDIUM] (#14430)
1 parent c7d20b2 commit 90e8d60

File tree

3 files changed

+134
-1
lines changed

3 files changed

+134
-1
lines changed

SPECS/iperf3/CVE-2025-54349.patch

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
From 79d560d64d50497717847bb2c12ede1f4a8ea7e9 Mon Sep 17 00:00:00 2001
2+
From: Sarah Larsen <[email protected]>
3+
Date: Wed, 25 Jun 2025 15:11:03 +0000
4+
Subject: [PATCH] Fix off-by-one heap overflow in auth.
5+
6+
Reported by Han Lee (Apple Information Security)
7+
CVE-2025-54349
8+
---
9+
src/iperf_auth.c | 18 +++++++++++++-----
10+
1 file changed, 13 insertions(+), 5 deletions(-)
11+
12+
diff --git a/src/iperf_auth.c b/src/iperf_auth.c
13+
index 72e85fc..86b4eba 100644
14+
--- a/src/iperf_auth.c
15+
+++ b/src/iperf_auth.c
16+
@@ -288,6 +288,7 @@ int encrypt_rsa_message(const char *plaintext, EVP_PKEY *public_key, unsigned ch
17+
}
18+
19+
int decrypt_rsa_message(const unsigned char *encryptedtext, const int encryptedtext_len, EVP_PKEY *private_key, unsigned char **plaintext, int use_pkcs1_padding) {
20+
+ int ret =0;
21+
#if OPENSSL_VERSION_MAJOR >= 3
22+
EVP_PKEY_CTX *ctx;
23+
#else
24+
@@ -310,7 +311,8 @@ int decrypt_rsa_message(const unsigned char *encryptedtext, const int encryptedt
25+
keysize = RSA_size(rsa);
26+
#endif
27+
rsa_buffer = OPENSSL_malloc(keysize * 2);
28+
- *plaintext = (unsigned char*)OPENSSL_malloc(keysize);
29+
+ // Note: +1 for NULL
30+
+ *plaintext = (unsigned char*)OPENSSL_malloc(keysize + 1);
31+
32+
BIO *bioBuff = BIO_new_mem_buf((void*)encryptedtext, encryptedtext_len);
33+
rsa_buffer_len = BIO_read(bioBuff, rsa_buffer, keysize * 2);
34+
@@ -320,13 +322,15 @@ int decrypt_rsa_message(const unsigned char *encryptedtext, const int encryptedt
35+
padding = RSA_PKCS1_PADDING;
36+
}
37+
#if OPENSSL_VERSION_MAJOR >= 3
38+
+
39+
plaintext_len = keysize;
40+
EVP_PKEY_decrypt_init(ctx);
41+
- int ret = EVP_PKEY_CTX_set_rsa_padding(ctx, padding);
42+
+
43+
+ ret = EVP_PKEY_CTX_set_rsa_padding(ctx, padding);
44+
if (ret < 0){
45+
goto errreturn;
46+
}
47+
- EVP_PKEY_decrypt(ctx, *plaintext, &plaintext_len, rsa_buffer, rsa_buffer_len);
48+
+ ret = EVP_PKEY_decrypt(ctx, *plaintext, &plaintext_len, rsa_buffer, rsa_buffer_len);
49+
EVP_PKEY_CTX_free(ctx);
50+
#else
51+
plaintext_len = RSA_private_decrypt(rsa_buffer_len, rsa_buffer, *plaintext, rsa, padding);
52+
@@ -337,7 +341,7 @@ int decrypt_rsa_message(const unsigned char *encryptedtext, const int encryptedt
53+
BIO_free(bioBuff);
54+
55+
/* Treat a decryption error as an empty string. */
56+
- if (plaintext_len < 0) {
57+
+ if (plaintext_len <= 0) {
58+
plaintext_len = 0;
59+
}
60+
61+
@@ -386,24 +390,28 @@ int decode_auth_setting(int enable_debug, const char *authtoken, EVP_PKEY *priva
62+
int plaintext_len;
63+
plaintext_len = decrypt_rsa_message(encrypted_b64, encrypted_len_b64, private_key, &plaintext, use_pkcs1_padding);
64+
free(encrypted_b64);
65+
- if (plaintext_len < 0) {
66+
+ if (plaintext_len <= 0) {
67+
return -1;
68+
}
69+
+
70+
plaintext[plaintext_len] = '\0';
71+
72+
char *s_username, *s_password;
73+
s_username = (char *) calloc(plaintext_len, sizeof(char));
74+
if (s_username == NULL) {
75+
+ OPENSSL_free(plaintext);
76+
return -1;
77+
}
78+
s_password = (char *) calloc(plaintext_len, sizeof(char));
79+
if (s_password == NULL) {
80+
+ OPENSSL_free(plaintext);
81+
free(s_username);
82+
return -1;
83+
}
84+
85+
int rc = sscanf((char *) plaintext, auth_text_format, s_username, s_password, &utc_seconds);
86+
if (rc != 3) {
87+
+ OPENSSL_free(plaintext);
88+
free(s_password);
89+
free(s_username);
90+
return -1;
91+
--
92+
2.45.4
93+

SPECS/iperf3/CVE-2025-54350.patch

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From 86bc637b483dc5de37f9a33583251bc08d32892e Mon Sep 17 00:00:00 2001
2+
From: "Bruce A. Mah" <[email protected]>
3+
Date: Tue, 24 Jun 2025 15:58:21 -0700
4+
Subject: [PATCH] Prevent crash due to assertion failures on malformed
5+
authentication attempt.
6+
7+
Reported by Han Lee (Apple Information Security)
8+
CVE-2025-54350
9+
---
10+
src/iperf_auth.c | 2 --
11+
1 file changed, 2 deletions(-)
12+
13+
diff --git a/src/iperf_auth.c b/src/iperf_auth.c
14+
index 72e85fc..b9f2bc0 100644
15+
--- a/src/iperf_auth.c
16+
+++ b/src/iperf_auth.c
17+
@@ -28,7 +28,6 @@
18+
#include "iperf_config.h"
19+
20+
#include <string.h>
21+
-#include <assert.h>
22+
#include <time.h>
23+
#include <sys/types.h>
24+
/* FreeBSD needs _WITH_GETLINE to enable the getline() declaration */
25+
@@ -152,7 +151,6 @@ int Base64Decode(const char* b64message, unsigned char** buffer, size_t* length)
26+
27+
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); //Do not use newlines to flush buffer
28+
*length = BIO_read(bio, *buffer, strlen(b64message));
29+
- assert(*length == decodeLen); //length should equal decodeLen, else something went horribly wrong
30+
BIO_free_all(bio);
31+
32+
return (0); //success
33+
--
34+
2.45.4
35+

SPECS/iperf3/iperf3.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: A network performance benchmark tool.
22
Name: iperf3
33
Version: 3.17.1
4-
Release: 2%{?dist}
4+
Release: 3%{?dist}
55
License: BSD and MIT and Public Domain
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -10,6 +10,8 @@ URL: https://github.com/esnet/iperf
1010
Source0: https://github.com/esnet/iperf/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
1111
Patch1: disablepg.patch
1212
Patch2: CVE-2024-53580.patch
13+
Patch3: CVE-2025-54350.patch
14+
Patch4: CVE-2025-54349.patch
1315
BuildRequires: autoconf >= 2.71
1416
BuildRequires: automake
1517

@@ -67,6 +69,9 @@ make %{?_smp_mflags} check
6769
%{_mandir}/man3/libiperf.3.gz
6870

6971
%changelog
72+
* Mon Aug 04 2025 Azure Linux Security Servicing Account <[email protected]> - 3.17.1-3
73+
- Patch for CVE-2025-54350, CVE-2025-54349
74+
7075
* Tue Dec 31 2024 Kanishk Bansal <[email protected]> - 3.17.1-2
7176
- Address CVE-2024-53580 using an upstream patch.
7277

0 commit comments

Comments
 (0)