This project demonstrates the Triple Handshake Attack using a customized build of the miTLS FlexTLS framework.
- Docker (Docker Desktop)
- OpenSSL (for manual testing)
For both options you need to start off by opening Docker Desktop.
This way will only be able to show the first 2 handshakes as openssl can't do the renegotiation by itself.
# Build everything
docker-compose build --no-cache
# Launch all services (MITM, server, and client)
docker-compose up- Logs in
mitm,server, andclientshow the attack progress in the same terminal. - MITM injects
HelloRequestfor handshake 3, but OpenSSL client does not complete renegotiation. - So this will end in error. (But can be used to demonstrate the first two handshakes)
Use this to demonstrate all three handshakes, including certificate reuse in handshake 3.
-
Start MITM and server:
docker-compose up mitm server
-
Open a new terminal. Run the OpenSSL server:
openssl s_server -accept 4433 \ -cert certs/server.crt -key certs/server.key \ -CAfile certs/ca.crt -Verify 1 -www
-
Open another terminal. Run the OpenSSL client:
openssl s_client -connect localhost:8443 \ -cert certs/client.crt -key certs/client.key \ -CAfile certs/ca.crt -reconnect -tls1_2
When the MITM sends the HelloRequest to trigger renegotiation:
-
If prompted or if nothing happens, press Enter in the OpenSSL client terminal to trigger the renegotiation.
-
Alternatively, restart the OpenSSL client with the same command to manually simulate the reused certificate.
- Handshake 1: Initial RSA connection.
- Handshake 2: Session resumption.
- Handshake 3: MITM triggers renegotiation using
HelloRequest. If the client reuses its original certificate, the attack succeeds.