Skip to content

fix: bound two server-controlled allocations (Kerberos, AMQP) + Kerberos read timeout - #99

Merged
evilsocket merged 2 commits into
evilsocket:mainfrom
gigioneggiando:fix-alloc-caps
Jul 5, 2026
Merged

fix: bound two server-controlled allocations (Kerberos, AMQP) + Kerberos read timeout#99
evilsocket merged 2 commits into
evilsocket:mainfrom
gigioneggiando:fix-alloc-caps

Conversation

@gigioneggiando

Copy link
Copy Markdown
Contributor

Second batch from the private report, as promised. Two more server-triggerable DoS issues, one commit each. Same panic = "abort" amplification as #98 (a panic aborts the whole process).

1. Kerberos TCP response allocation + read timeout (commit 1)

src/plugins/kerberos/transport.rs: the TCP transport reads a 4-byte length prefix from the KDC and then does vec![0; resp_len as usize], so a malicious or compromised KDC (or a MITM) can request a ~4 GiB allocation and abort the process. It also set only connect_timeout, so a KDC that stalls mid-response hangs the operator's thread indefinitely on read_exact. This caps the response at 16 MiB (far above any real KRB-AS/TGS message) and sets read/write timeouts on the stream.

(The UDP transport in the same file is bounded by the UDP datagram limit, so it is left unchanged.)

2. AMQP connection.start allocation (commit 2)

src/plugins/amqp/mod.rs: reads the connection.start frame size from the server and does vec![0_u8; (u32::from_be_bytes(size) + 1) as usize] — a ~4 GiB allocation a malicious server can request; the + 1 also overflowed u32 in debug builds. This caps the frame at 1 MiB (the AMQP 0-9-1 default frame-max is 128 KiB) and computes the length in usize to avoid the overflow.

Builds clean with cargo clippy --all-targets under RUSTFLAGS="-Dwarnings" (default features). Happy to adjust the cap values if you'd prefer different limits. A broader read-timeout audit across the other protocol clients can follow in a later PR.

The Kerberos TCP transport read a 4-byte length prefix from the KDC and
then did `vec![0; resp_len as usize]`, so a malicious or compromised KDC
(or a MITM) could request a ~4 GiB allocation and abort the process
(panic = "abort"). It also set only connect_timeout, so a KDC that
stalled mid-response hung the operator's thread indefinitely on
read_exact. Cap the response at 16 MiB (far above any real KRB message)
and set read/write timeouts on the stream.
…size

The AMQP plugin read the connection.start frame size from the server and
did `vec![0_u8; (u32::from_be_bytes(size) + 1) as usize]`, so a malicious
server could request a ~4 GiB allocation and abort the process
(panic = "abort"); the `+ 1` also overflowed u32 in debug builds. Cap the
frame at 1 MiB (the AMQP 0-9-1 default frame-max is 128 KiB) and compute
the length in usize to avoid the overflow.
@evilsocket
evilsocket merged commit ac86e72 into evilsocket:main Jul 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants