الانتقال إلى المحتوى
CyberEd DZ

مصافحة TCP

باختصار

كيف تبدأ كل اتصال TCP: المصافحة الثلاثية. ثلاث حزم تتعرّف عليها فوراً في الالتقاط، وتقوم عليها فئة كاملة من الهجمات.

الأهداف

  • سرد تسلسل SYN / SYN-ACK / ACK
  • التعرّف على المصافحة في التقاط الحزم
  • شرح دلالة الاتصال نصف المفتوح

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.

للمراجعة

  • يبدأ TCP بـ SYN ثم SYN-ACK ثم ACK
  • لا تتدفّق البيانات إلا بعد اكتمال المصافحة
  • SYN بلا ACK علامة مسح أو إغراق