
Python proof-of-concept that drives the iperf3 control protocol to trigger an unauthenticated UDP receive-worker infinite loop (CWE-835) denial of service.
DOS infinite-loop Vulnerability POC
An unauthenticated remote attacker who can reach an iperf3 -s server’s control
port can crash-loop the server’s UDP receive worker into an unrecoverable,
CPU-pinning infinite loop using a single crafted control-channel parameter
message followed by one UDP data packet. No credentials, no valid test
session, and no more than one small TCP message plus one 16-byte UDP
datagram are required.
Affected package: iperf3 (esnet/iperf)
Affected versions: current main at git c9b7422 (“3.21+”); the bug is
present in the shared blksize validation and receive-loop logic and does
not appear to be new to this commit — needs maintainer confirmation of the
earliest affected release. Not present in the CVE-2025-54349/54350/54351
fix set (those addressed iperf_auth.c and the --skip-rx-copy buffer
overflow in net.c; this is a distinct code path and root cause).
Patched version: none yet (0-day at time of report)
iperf_udp_recv() (src/iperf_udp.c:60) advances through a receive buffer
using a per-iteration stride, dgram_sz, taken directly from the
client-negotiated blksize (the len control parameter):
// src/iperf_udp.c:124-232 (abridged)
dgram_buf = sp->buffer;
dgram_buf_end = sp->buffer + buf_sz;
while (buf_sz >= dgram_sz && dgram_buf + dgram_sz <= dgram_buf_end) {
if (buf_sz < min_pkt_size) // min_pkt_size == 12
break;
... parse 12/20-byte packet header ...
dgram_buf += dgram_sz;
buf_sz -= dgram_sz;
}
If dgram_sz == 0, neither dgram_buf nor buf_sz changes on any
iteration. Both loop conditions (buf_sz >= 0 and an unmoving pointer
comparison) remain true forever, and the only internal break requires
buf_sz to shrink below 12 — which never happens. Once entered with
buf_sz >= 12 and dgram_sz == 0, the loop is unconditionally
infinite.
dgram_sz is set directly from sp->settings->blksize (iperf_udp.c:90
and :95), and blksize is attacker-controlled via the len field of the
control-channel JSON parameter exchange (get_parameters(),
src/iperf_api.c:2654-2661):
// src/iperf_api.c:2654-2661
if ((j_p = ...,"len", cJSON_Number)) != NULL){
if (j_p->valueint < 0){ i_errno = IEBLOCKSIZE; r = -1; }
else test->settings->blksize = j_p->valueint; // 0 is accepted
}
The post-parse sanity check (src/iperf_api.c:2805-2815) has a validation
gap specific to UDP:
// src/iperf_api.c:2805-2815
if ((test->protocol->id != Pudp && test->settings->blksize <= 0) // UDP: skipped
|| test->settings->blksize > MAX_BLOCKSIZE) {
i_errno = IEBLOCKSIZE; return -1;
}
if (test->protocol->id == Pudp &&
(test->settings->blksize > 0 && // <-- gated on > 0
(test->settings->blksize < MIN_UDP_BLOCKSIZE || test->settings->blksize > MAX_UDP_BLOCKSIZE))) {
i_errno = IEUDPBLOCKSIZE; return -1;
}
The non-UDP branch correctly rejects blksize <= 0. The UDP branch’s range
check is only applied when blksize is already greater than 0 — so
blksize == 0 bypasses both checks and is accepted as a valid UDP block
size, even though the genuine iperf3 client never sends this value (it
resolves -l 0 to a concrete positive size from the path MTU before
transmission — iperf_client_api.c:513-518). This is only reachable by a
client that speaks the wire protocol directly, i.e. a hostile peer.
A second condition is needed to actually reach the loop with buf_sz > 0:
by default, with blksize == 0, the plain UDP read requests 0 bytes and
returns early safely. Setting gro=1 with any positive gro_bf_size in
the same parameter message causes the receive size to instead be
gro_bf_size (iperf_udp.c:87), while dgram_sz is still taken from
blksize == 0 (iperf_udp.c:90). UDP_GRO is a standard, unprivileged
socket option on modern Linux (confirmed available in the tested build).
(Note: an initially-hypothesized alternate trigger via skip_rx_copy=1 /
MSG_TRUNC does not work — the stream buffer is allocated via
mmap(NULL, blksize, ...) in iperf_new_stream(), and blksize == 0
without GRO causes that mmap call to fail with EINVAL before the
stream/thread is even created. Only the GRO path reaches the vulnerable
loop; this was verified experimentally, not assumed.)
PARAM_EXCHANGE (state 9) byte.{"udp":true,"len":0,"gro":1,"gro_bf_size":1000,"omit":0,"time":10,"parallel":1}.CREATE_STREAMS (state 10).UDP_CONNECT_MSG handshake value, and receive the 4-byte
UDP_CONNECT_REPLY.num_streams=1, mode RECEIVER) immediately
transitions to TEST_START (state 1) then TEST_RUNNING (state 2)
on the control channel.No authentication, no valid iperf3 client, and no more than a handful of
protocol messages are required. --authorized-users (pre-shared
RSA/username auth), which is not the default configuration, is the only
mitigation.
The server’s per-stream receive thread is permanently pinned at ~100% CPU
and never completes; the affected test/connection can never be cleaned up
by the server on its own, and the process must be forcibly killed
(observed requiring SIGKILL; the process did not respond to normal
control-channel closure). Since iperf3 -s serves one test/connection at
a time by default, a single crafted packet renders the server unusable
until an operator manually intervenes — a clean, unauthenticated,
single-packet-triggered availability denial-of-service.
A standalone Python 3 script (no dependency on the iperf3 client binary)
that implements the control protocol described above and demonstrates the
hang is attached: poc_udp_dos.py.
$ ./src/iperf3 -s -p 5201
$ python3 poc_udp_dos.py <server-ip> 5201
Observed output (against a locally built git HEAD c9b7422 server):
[*] Server state -> 9 (expect 9=PARAM_EXCHANGE)
[*] Sending crafted params: {'udp': True, 'len': 0, 'gro': 1, 'gro_bf_size': 1000, ...}
[*] Server state -> 10 (expect 10=CREATE_STREAMS)
[*] UDP connect reply: 36373839
[*] Server state -> 1
[*] Server state -> 2
[*] Sending ONE malicious UDP datagram (16 bytes, dgram_sz=0 -> infinite loop)
[+] Control channel produced no further data for 15s after the single trigger datagram
CVSS 3.1: AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H = 7.5 HIGHCWE: CWE-835 (Loop with Unreachable Exit Condition) leading to
CWE-400 (Uncontrolled Resource Consumption)