Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session resumption not working when Connection ID is used #5872

Closed
cartoush opened this issue May 25, 2022 · 3 comments · Fixed by #5915
Closed

Session resumption not working when Connection ID is used #5872

cartoush opened this issue May 25, 2022 · 3 comments · Fixed by #5915
Assignees
Labels
bug component-tls priority-high High priority - will be reviewed soon

Comments

@cartoush
Copy link

Summary

I have recently implemented the connection ID in a multi threaded DTLS server which already had session resumption. Though when trying to accomplish a session resumption with connection ID enabled it seems the client does not properly process the CID sent by the server and thus, does not send any Connection ID record with the last flight, making the server reject the handshake

System information

Mbed TLS version (number or commit id): v3.0.0
Operating system and version: Linux manjaro 5.10.114-1-MANJARO
Configuration (if not default, please attach mbedtls_config.h): resumption_fail.zip
Compiler and options (if you used a pre-built binary, please indicate how you obtained it): GCC

Expected behavior

The client should transmit a Connection ID record embedding the CID received from the server, allowing the server to finish processing the session resumption

Actual behavior

The client does not transmit any Connection ID record to the server after having received the ServerHello, the server thus does not manage to parse the connection ID and drops the session resumption as a consequence

Steps to reproduce

Attempt a session resumption with connection ID enabled

Additional information

I have attached debug logs from the client and server I use and the PCAP file corresponding to the logs

@yanesca yanesca self-assigned this May 25, 2022
@yanesca
Copy link
Contributor

yanesca commented May 25, 2022

@Thibautartis thank you for your bug report!

Indeed, adding resumption to a passing CID test in ssl-opt.sh makes it fail:

requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID
run_test    "5872" \
            "$P_SRV debug_level=3 dtls=1 tickets=0 cid=1 cid_val=dead" \
            "$P_CLI debug_level=3 dtls=1 tickets=0 reconnect=1 cid=1 cid_val=beef" \
            0 \
            -c "Enable use of CID extension." \
            -s "Enable use of CID extension." \
            -c "client hello, adding CID extension" \
            -s "found CID extension"           \
            -s "Use of CID extension negotiated" \
            -s "server hello, adding CID extension" \
            -c "found CID extension" \
            -c "Use of CID extension negotiated" \
            -s "Copy CIDs into SSL transform" \
            -c "Copy CIDs into SSL transform" \
            -c "Peer CID (length 2 Bytes): de ad" \
            -s "Peer CID (length 2 Bytes): be ef" \
            -s "Use of Connection ID has been negotiated" \
            -c "Use of Connection ID has been negotiated"

Our test programs and environment are different from what @Thibautartis has and it would be best to validate the fix with them once it is ready.

@yanesca yanesca added bug component-tls priority-high High priority - will be reviewed soon labels May 25, 2022
@yanesca yanesca removed their assignment May 25, 2022
@AndrzejKurek AndrzejKurek self-assigned this Jun 1, 2022
@AndrzejKurek
Copy link
Contributor

In case of a session resumption the transforms were being populated before extension parsing, which resulted in the client rejecting a server hello that contained a connection ID.
Fixed here, further investigation pending regarding the impact on other extensions.

@AndrzejKurek
Copy link
Contributor

AndrzejKurek commented Jun 23, 2022

Investigating other extensions revealed one pre-existing example program bug, but no other problems with extensions and session resumption:

  • renegotiation - working fine;
  • max_fragment_length - OK, uses ssl->conf, which exists after handshake;
  • encrypt_then_mac - OK, uses ssl->negotiate, which exists after handshake;
  • extended_master_secret - OK, no premaster used when session is resumed;
  • session_ticket - OK, uses ssl->conf;
  • supported_point_formats - OK, public client part of ECDH key exchange is done before affected code;
  • ecjpake_kkpp - missing call to mbedtls_ssl_set_hs_ecjpake_password in ssl_client2 before resumption, apart from that working fine. Filed an issue;
  • alpn - OK, uses ssl->conf;
  • srtp - OK, uses ssl->conf;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-tls priority-high High priority - will be reviewed soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants