fix: bound two server-controlled allocations (Kerberos, AMQP) + Kerberos read timeout - #99
Merged
Merged
Conversation
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.
This was referenced Jul 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 doesvec![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 onlyconnect_timeout, so a KDC that stalls mid-response hangs the operator's thread indefinitely onread_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 doesvec![0_u8; (u32::from_be_bytes(size) + 1) as usize]— a ~4 GiB allocation a malicious server can request; the+ 1also 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-targetsunderRUSTFLAGS="-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.