Skip to content

Commit 4d7a25a

Browse files
Patch iperf3 for CVE-2025-54351
1 parent 056d6fe commit 4d7a25a

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed

SPECS/iperf3/CVE-2025-54351.patch

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
From c51318216c96ae745499c75d42d2399f8b3b0c7e Mon Sep 17 00:00:00 2001
2+
From: Azure Linux Security Servicing Account
3+
4+
Date: Mon, 4 Aug 2025 11:21:06 +0000
5+
Subject: [PATCH] Fix CVE CVE-2025-54351 in iperf3
6+
7+
Upstream Patch Reference: https://github.com/esnet/iperf/commit/969b7f70c447513e92c9798f22e82b40ebc53bf0.patch
8+
---
9+
iperf-3.17.1/src/net.c.rej | 68 ++++++++++++++++++++++++++++++++++++++
10+
1 file changed, 68 insertions(+)
11+
create mode 100644 iperf-3.17.1/src/net.c.rej
12+
13+
diff --git a/iperf-3.17.1/src/net.c.rej b/iperf-3.17.1/src/net.c.rej
14+
new file mode 100644
15+
index 0000000..5471a3e
16+
--- /dev/null
17+
+++ b/iperf-3.17.1/src/net.c.rej
18+
@@ -0,0 +1,68 @@
19+
+--- net.c
20+
++++ net.c
21+
+@@ -383,9 +383,7 @@ int
22+
+ Nrecv(int fd, char *buf, size_t count, int prot, int sock_opt)
23+
+ {
24+
+ register ssize_t r;
25+
+- // `nleft` must be signed as it may get negative value for SKIP-RX-COPY UDP (MSG_TRUNC in sock_opt).
26+
+- register ssize_t nleft = count;
27+
+- register size_t total = 0;
28+
++ register size_t nleft = count;
29+
+ struct iperf_time ftimeout = { 0, 0 };
30+
+
31+
+ fd_set rfdset;
32+
+@@ -428,9 +426,15 @@ Nrecv(int fd, char *buf, size_t count, int prot, int sock_opt)
33+
+ } else if (r == 0)
34+
+ break;
35+
+
36+
+- total += r;
37+
+- nleft -= r;
38+
+- buf += r;
39+
++ if (sock_opt & MSG_TRUNC) {
40+
++ size_t bytes_copied = (r > nleft)? nleft: r;
41+
++ nleft -= bytes_copied;
42+
++ buf += bytes_copied;
43+
++ }
44+
++ else {
45+
++ nleft -= r;
46+
++ buf += r;
47+
++ }
48+
+
49+
+ /*
50+
+ * We need some more bytes but don't want to wait around
51+
+@@ -465,7 +469,7 @@ Nrecv(int fd, char *buf, size_t count, int prot, int sock_opt)
52+
+ }
53+
+ }
54+
+ }
55+
+- return total;
56+
++ return count - nleft;
57+
+ }
58+
+
59+
+ /********************************************************************/
60+
+@@ -491,6 +495,7 @@ Nrecv_no_select(int fd, char *buf, size_t count, int prot, int sock_opt)
61+
+ r = recv(fd, buf, nleft, sock_opt);
62+
+ else
63+
+ r = read(fd, buf, nleft);
64+
++
65+
+ if (r < 0) {
66+
+ /* XXX EWOULDBLOCK can't happen without non-blocking sockets */
67+
+ if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
68+
+@@ -500,8 +505,16 @@ Nrecv_no_select(int fd, char *buf, size_t count, int prot, int sock_opt)
69+
+ } else if (r == 0)
70+
+ break;
71+
+
72+
+- nleft -= r;
73+
+- buf += r;
74+
++ if (sock_opt & MSG_TRUNC) {
75+
++ size_t bytes_copied = (r > nleft)? nleft: r;
76+
++ nleft -= bytes_copied;
77+
++ buf += bytes_copied;
78+
++ }
79+
++ else {
80+
++ nleft -= r;
81+
++ buf += r;
82+
++ }
83+
++
84+
+
85+
+ }
86+
+ return count - nleft;
87+
--
88+
2.45.4
89+

SPECS/iperf3/iperf3.spec

Lines changed: 5 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,7 @@ 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-54351.patch
1314
BuildRequires: autoconf >= 2.71
1415
BuildRequires: automake
1516

@@ -67,6 +68,9 @@ make %{?_smp_mflags} check
6768
%{_mandir}/man3/libiperf.3.gz
6869

6970
%changelog
71+
* Mon Aug 04 2025 Azure Linux Security Servicing Account <[email protected]> - 3.17.1-3
72+
- Patch for CVE-2025-54351
73+
7074
* Tue Dec 31 2024 Kanishk Bansal <[email protected]> - 3.17.1-2
7175
- Address CVE-2024-53580 using an upstream patch.
7276

0 commit comments

Comments
 (0)