← Back to blog

BGP FlowSpec TCP flags: using SYN, ACK and RST matches without breaking real traffic

TCP flags can make FlowSpec rules precise against SYN, ACK or RST floods, but they become risky when they ignore connection state, asymmetric routing and legitimate protocol behavior.

BGP FlowSpec TCP flags: using SYN, ACK and RST matches without breaking real traffic
TCP flags are useful but incomplete

They describe packet intent, not connection legitimacy by themselves.

ACK and RST rules are especially sensitive

They can collide with real established traffic or recovery behavior.

State belongs in the right layer

FlowSpec can reduce volume; downstream filters should validate context when needed.

TCP flag matching is one of the most tempting BGP FlowSpec features because many attacks appear to have an obvious flag pattern: SYN floods, ACK floods, RST storms or strange combinations that normal stacks rarely generate. Used carefully, TCP flags can remove a large amount of attack traffic upstream. Used carelessly, they can drop legitimate sessions, break asymmetric paths or hide the real problem behind a rule that looks elegant on paper. This article explains when TCP flag matching helps, how to scope it, why state still matters, and how to combine it with protected transit instead of treating it as a universal TCP firewall.

The operational problem

The problem with TCP flags is that they look more meaningful than they really are. A SYN packet starts a connection, an ACK often belongs to an established flow, and RST may close a session. But FlowSpec sees one packet at a time. It does not know whether a SYN is part of a legitimate burst, whether an ACK belongs to a real connection seen on another path, or whether RST traffic is a symptom of an overloaded application.

This becomes even more delicate with asymmetric routing. If inbound traffic is scrubbed through one provider and outbound traffic leaves elsewhere, an upstream FlowSpec rule cannot see the whole state machine. A rule that seems safe in a lab can become too aggressive in production when the return path, NAT, load balancers or proxies are involved.

BGP / FlowSpec resources Related routing and mitigation guides.
Open offer
Anti-DDoS methodology How Peeryx thinks about layered mitigation.
Open offer

Why it matters before an attack

TCP floods can be highly disruptive even when bandwidth is not the only issue. High packet rates, SYN backlog pressure, connection table exhaustion and application timeouts can damage a service before links are full. TCP flag matches can help remove the obvious part of that pressure upstream.

But because TCP is stateful, false positives are costly. Dropping the wrong ACK traffic can make existing sessions freeze. Dropping RST blindly can make recovery slower. Dropping SYN too widely can block new users. TCP flags must therefore be used as part of a measured incident response, not as a permanent recipe copied from another network.

Possible technical approaches

For SYN floods, a narrow rule may target excessive SYN packets toward a specific protected host or port, especially when downstream SYN validation or proxying is also present. For ACK floods, the rule should be more cautious: confirm that the traffic is not legitimate return traffic, monitor established sessions and avoid broad prefix-wide matches. For RST storms, prefer short-lived containment and downstream analysis before making the rule wider.

The best solution combines layers. FlowSpec removes the obvious flag-heavy flood upstream. The mitigation stack behind it tracks baselines, rate anomalies, service ports and behavior. If the customer runs a game or API service, additional logic can validate sessions instead of assuming that one flag pattern tells the whole story.

How Peeryx designs this layer

Peeryx uses TCP flag matching only when it makes the upstream rule more precise. The preferred model is not to block “all ACK” or “all SYN” because an attack graph looks scary. Instead, the rule must be tied to the attacked destination, port, rate pattern and expected legitimate behavior.

Behind the upstream rule, Peeryx can keep more nuanced filtering in the mitigation layer. That separation is important: FlowSpec saves capacity and pps headroom, while the downstream stack protects session quality. For customers using protected transit, GRE/IPIP/VXLAN delivery or router VM, this gives room to react quickly without turning TCP into a blind upstream deny list.

View protected transit Protected IP transit with BGP, tunnels, cross-connect and router VM delivery.
Open offer
Talk to Peeryx Discuss prefixes, delivery and mitigation requirements.
Open offer

Concrete use case

A web API receives a SYN flood toward TCP/443. The attack is heavy enough to overload downstream state tables. A narrow FlowSpec rule matching SYN traffic to the attacked destination can remove a major part of the flood, while downstream systems still handle real handshakes. That is a good use of TCP flag filtering.

Now consider an ACK flood where the protected path is asymmetric. A broad ACK drop may look effective on the upstream graph, but it may also remove real established traffic that FlowSpec cannot correlate. The safer option is to start with destination and rate constraints, watch legitimate sessions, and move more complex validation to the mitigation layer.

1. Identify the flag pattern

Confirm whether SYN, ACK, RST or a combination is actually dominant.

2. Scope by destination and port

Avoid prefix-wide TCP flag rules unless there is no safer alternative.

3. Check symmetry and state

Know whether return traffic and connection state are visible to the filtering layer.

4. Withdraw when the pattern changes

TCP flag rules should evolve with the attack rather than remain static.

Frequent mistakes to avoid

  • Blocking all ACK traffic because the attack is called an ACK flood.
  • Forgetting that FlowSpec does not track TCP sessions.
  • Using the same flag rule across multiple unrelated customer services.
  • Leaving a temporary flag rule in place after the attack changes.
  • Ignoring load balancers, NAT or proxies that alter the connection path.

FAQ

Are TCP flags supported by every FlowSpec provider?

Not always in the same way. You must verify supported components and actions with the upstream provider.

Is SYN matching safer than ACK matching?

Often yes, because SYN is tied to connection opening, but it still needs destination and rate scope.

Can FlowSpec replace SYN cookies or proxy validation?

No. It can reduce volume upstream, but validation still belongs in a state-aware layer.

Should TCP flag rules be used for gaming?

Only with care. Some game platforms also use TCP for control or HTTP/TLS flows, and false positives can affect login or resource loading.

Conclusion

The safest Anti-DDoS architecture is the one that gives each layer a clear job: routing steers traffic, upstream rules reduce obvious pressure, and downstream mitigation protects the service context.

Peeryx focuses on that operational clarity: protected IP transit, controlled delivery models and filtering decisions that are strong enough to stop attacks without turning legitimate traffic into collateral damage.

Resources

Related reading

To go deeper, here are other useful pages and articles.

BGP & mitigation 8 min read

BGP Flowspec for DDoS: useful or dangerous?

What Flowspec does well, what it should never do alone and how to fit it into a safe multi-layer strategy.

Read the article
BGP & Anti-DDoS 12 min read

How BGP Anti-DDoS works: routing, mitigation and clean traffic

BGP Anti-DDoS is not a magic firewall. It is a routing model that steers prefixes toward a mitigation layer, filters the attack, then returns cleaner traffic through BGP, cross-connect or tunnels.

Read the article
DDoS guide Reading time: 6 min

Blackhole vs FlowSpec: which upstream DDoS control fits the situation

When blackholing is acceptable, when FlowSpec helps and why neither one replaces a real clean-traffic design.

Read article
VXLAN / IPIP 11 min read

DDoS protection over VXLAN or IPIP: when should you use them?

VXLAN and IPIP do not solve exactly the same clean traffic delivery problem after DDoS mitigation. This guide explains when each one makes sense, which limits matter and how to choose a model that matches your topology, edge design and operations. It also helps compare VXLAN, IPIP, GRE, clean handoff and post-mitigation traffic delivery with an operator-grade architecture, operations and buying logic.

Read the article
Protected IP transit 12 min read

Protected IP transit benefits for operators, hosters and exposed services

Protected IP transit combines Internet connectivity and Anti-DDoS mitigation in the same delivery model. The benefit is not only attack absorption, but clearer routing, cleaner handoff and fewer emergency migrations.

Read the article
DDoS guide Reading time: 7 min

Anycast for DDoS protection: when it helps

Anycast can improve absorption and proximity in some models, but it does not replace careful handoff and clean traffic delivery design.

Read article
DDoS guide Reading time: 7 min

Clean handoff design after DDoS mitigation

Clean traffic delivery is only useful if the handoff stays readable, supportable and aligned with the customer topology.

Read article
DDoS guide Reading time: 7 min

Operator buying checklist for Anti-DDoS and protected transit

A practical checklist for hosters, operators and technical buyers comparing Anti-DDoS providers, handoff models and protected transit offers.

Read article

Need to validate the right Anti-DDoS architecture?

Peeryx can review your prefixes, delivery model and attack exposure to propose protected IP transit, tunnel delivery or a gaming reverse proxy when it is the right fit.