Aller au contenu
CyberEd DZ

La poignée de main TCP

En bref

Comment débute toute connexion TCP : la poignée de main en trois temps. Trois paquets reconnaissables au premier coup d'œil, à la base de toute une classe d'attaques.

Objectifs

  • Réciter la séquence SYN / SYN-ACK / ACK
  • Reconnaître la poignée de main dans une capture
  • Expliquer ce que signale une connexion semi-ouverte

Before TCP sends any real data, the two machines perform a three-way handshake to agree that both can send and receive. It is three small packets, and understanding it explains a huge amount of what you will see in a packet capture.

Client Server SYNSYN-ACKACK
SYN, SYN-ACK, ACK. Three packets, and the connection is open.

The three steps

The client sends a SYN ("I want to talk, here is my starting sequence number"). The server replies SYN-ACK ("understood, and here is mine"). The client sends a final ACK, and the connection is established. Only now does data flow.

$ sudo tcpdump -n -i any "tcp port 80 and host example.com"
IP 10.0.0.5.51514 > 93.184.216.34.80: Flags [S]  seq 1069
IP 93.184.216.34.80 > 10.0.0.5.51514: Flags [S.] seq 4200, ack 1070
IP 10.0.0.5.51514 > 93.184.216.34.80: Flags [.]  ack 4201

Tip

A half-open connection — a SYN with no matching ACK — is the signature of a port scan or a SYN flood. You have just learned to recognise one.

À retenir

  • TCP ouvre avec SYN, SYN-ACK, ACK
  • Les données ne circulent qu'après la poignée de main
  • Un SYN sans ACK trahit un scan ou un flood