randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.56k stars 562 forks source link

DTLS: Retransmission handled incorrectly ("Received unexpected record version") #2316

Open Thiesius opened 4 years ago

Thiesius commented 4 years ago

In the beginning of the handshake the client sends ClientHello message with DTLS Record Version 1.0. The version of the inner message is 1.2. Server sets pending state to DTLS version 1.2. Client meanwhile retransmits the record again, thinking the packet got lost. Retransmitted message arrives to the server but the record version is checked against the pending state and obviously 1.0 != 1.2. As the consequence connection gets alerted while the message probably should be just dropped.

I created some extra info from our test cert environment.

This is the area of code causing the issue. I have added some vars to watch. watch

This zipfile contains wireshark dump of the handshake and dumped m_record_buf (which proves that it matches with the ClientHello message in the wireshark) dumps.zip

randombit commented 4 years ago

Makes sense and yes for DTLS we should just drop it instead of alerting.

randombit commented 4 years ago

Won't be fixed in time for 2.14.0 (release next Monday) but will address this in 2.15

seppy87 commented 4 years ago

I am still receiving this Exception in 2.15 :/

seppy87 commented 4 years ago

sorry found the error. ok it works

volok-aleksej commented 5 months ago

Hi, guys. This bug is fixed next pull request. Please check it. for reproducing it i have created simple application botan_bug.tar.gz