TCP Flags Explained: SYN, ACK, FIN, RST and Spotting Abnormal Flags

TCP flags are single-bit control fields in the TCP header that tell the other side what a segment is for. RFC 9293 defines eight: SYN starts a connection, ACK confirms received data, FIN closes a connection gracefully, RST aborts it, PSH asks for immediate delivery, URG marks urgent data, and ECE and CWR handle congestion signals.

Jun 18, 2025 - 10:35
Updated: 
103.7k

Networking in IT Infrastructure · Explainer

Network Security, Penetration Testing, Security Tools, Authorized Labs & CTFs

TCP Flags Explained: SYN, ACK, FIN, RST and Spotting Abnormal Flags

Quick answer: TCP flags are single-bit control fields in the TCP header that tell the other side what a segment is for. RFC 9293 defines eight: SYN starts a connection, ACK confirms received data, FIN closes a connection gracefully, RST aborts it, PSH asks for immediate delivery, URG marks urgent data, and ECE and CWR handle congestion signals. Normal traffic follows predictable flag patterns, such as the SYN, SYN-ACK, ACK handshake. Combinations that never occur in real conversations, such as no flags at all, SYN with FIN, or FIN, PSH and URG together, usually point to scanning or crafted packets, so defenders alert on them.

Key takeaways

  • RFC 9293 is the current TCP standard and defines the control bits.
  • SYN, ACK, FIN and RST drive the connection life cycle.
  • ECE and CWR support Explicit Congestion Notification (RFC 3168).
  • Illegal flag combinations are strong signs of reconnaissance.
  • Firewalls, IDS rules and packet filters can detect and drop them.

Table of Contents

What Are TCP Flags?

Every TCP segment carries a header with ports, sequence and acknowledgement numbers, a window size and a set of control bits. RFC 9293, which replaced RFC 793 in 2022, defines these bits. Each is on (1) or off (0), and together they describe the purpose of the segment.

What Does Each TCP Flag Mean?

FlagNamePurpose
SYNSynchroniseStart a connection and set the initial sequence number
ACKAcknowledgeAcknowledgement number is valid; set on almost every segment after the first
FINFinishSender has no more data; graceful close
RSTResetAbort the connection or refuse a request to a closed port
PSHPushPass data to the application without waiting
URGUrgentUrgent pointer is valid; rarely used today (RFC 6093)
ECEECN-EchoSignal congestion or ECN capability (RFC 3168)
CWRCongestion Window ReducedSender has slowed down in response to ECE

An older ninth bit, NS, was experimental and is no longer used.

How Do Flags Open and Close a Connection?

  1. Open: client sends SYN, server replies SYN-ACK, client sends ACK. Data can now flow.
  2. Transfer: segments carry ACK, often with PSH when the application sends a burst.
  3. Graceful close: each side sends FIN and receives an ACK, usually four segments.
  4. Abrupt close: one side sends RST, for example when an application crashes or a port is closed.

Which Flag Combinations Are Abnormal?

PatternFlags setWhy it is suspicious
NullNoneEvery valid segment has at least one flag
FIN onlyFIN without ACKA real close always acknowledges data
XmasFIN, PSH, URGNo legitimate stack sends this mix
SYN-FINSYN and FINOpening and closing at once is contradictory
SYN-RSTSYN and RSTContradictory; crafted packet
Many SYNs, few ACKsSYNPort sweep or SYN flood
ACK with no sessionACKProbing firewall rules

These patterns are how tools probe for open ports and map firewalls, which MITRE tracks as T1046, network service discovery.

How Do Defenders Detect Abnormal Flags?

In Wireshark, these display filters use fields from the TCP field reference:

tcp.flags == 0x000                          # null
tcp.flags.fin == 1 and tcp.flags.psh == 1 and tcp.flags.urg == 1   # Xmas
tcp.flags.syn == 1 and tcp.flags.fin == 1   # SYN-FIN
tcp.flags.syn == 1 and tcp.flags.ack == 0   # new connection attempts

On a Linux sensor you own, tcpdump can watch for the same patterns:

sudo tcpdump -n 'tcp[tcpflags] == 0'
sudo tcpdump -n 'tcp[tcpflags] & (tcp-syn|tcp-fin) == (tcp-syn|tcp-fin)'

IDS tools such as Snort match flags with the flags rule option, and stateful firewalls drop segments that do not fit a known connection. Alert on volume as well as pattern: one host sending SYNs to hundreds of ports in seconds deserves a ticket.

How Do You Defend Against SYN Floods?

A SYN flood sends many SYNs and never completes the handshake, filling the server's queue of half-open connections. RFC 4987 lists mitigations: SYN cookies, larger backlogs, shorter timeouts, filtering spoofed sources and upstream DDoS protection. On Linux, check that SYN cookies are on:

sysctl net.ipv4.tcp_syncookies

Sending crafted packets to systems you do not own can breach Sections 43 and 66 of India's IT Act 2000. Test only with written permission and a defined scope, and keep logs, since CERT-In expects 180 days of retention.

For the full header layout, see our complete guide to TCP header flags, and compare transports in TCP vs UDP. Our SOC and network security training covers packet analysis in labs.

References

Frequently Asked Questions

RFC 9293 defines eight control bits: CWR, ECE, URG, ACK, PSH, RST, SYN and FIN. The old NS bit is no longer used.

The client sends SYN, the server replies with SYN-ACK and the client answers with ACK, after which data can flow.

FIN closes a connection gracefully after all data is sent, while RST aborts it immediately, often because of an error.

PSH asks the receiving TCP stack to pass buffered data to the application straight away instead of waiting for more.

A TCP segment with FIN, PSH and URG set together. Legitimate stacks never send it, so it usually indicates scanning.

Use Wireshark filters such as tcp.flags == 0x000, tcpdump expressions on tcp[tcpflags], or IDS rules using the flags option.

SYN cookies let a server answer SYNs without storing state until the handshake completes, which blunts SYN flood attacks.

They support Explicit Congestion Notification, letting routers signal congestion so senders slow down without dropping packets.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.