← Back to blog

BGP FlowSpec packet length filtering: when size-based DDoS rules help

Packet length filtering can remove repetitive floods with stable sizes, especially UDP reflection or garbage floods. It becomes dangerous when legitimate protocols share the same size profile.

BGP FlowSpec packet length filtering: when size-based DDoS rules help
Length is a signal, not proof

Packet size can identify attack patterns, but it rarely proves illegitimacy alone.

Ranges must be narrow and justified

Broad size filters can collide with legitimate UDP, monitoring or control traffic.

Best used as pre-filtering

Use length rules to reduce volume, then let downstream logic handle mixed traffic.

Packet length matching is a practical BGP FlowSpec component because many DDoS attacks repeat the same packet sizes at very high rates. A UDP reflection flood, a malformed packet stream or a botnet tool may produce stable length ranges that are easy to shave upstream. But packet size is not identity. Legitimate protocols also create predictable sizes, path MTU can change behavior, and some applications use bursts that look repetitive. This guide explains how to use packet length filtering as an upstream relief tool, how to combine it with ports and protocols, and where the false-positive traps appear.

The operational problem

The core problem is that packet length looks precise while still being context-free. An attack may use 60-byte UDP packets or a narrow 1200-byte range, and that signature may be extremely useful. But a legitimate service can also produce repeatable lengths, especially game protocols, voice traffic, tunnels, DNS, monitoring or fixed-format application messages.

A second problem is fragmentation and MTU behavior. If a rule assumes that all packets in a length range are bad, it may interact badly with tunnels, encapsulation overhead or changing paths. Length matching should therefore be tied to a real attack observation, not copied from a generic list of “bad sizes”.

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

Packet length filtering matters because it can save capacity quickly. Against a repetitive flood, a length range combined with destination, protocol and port can remove a large amount of traffic before it hits the protected handoff. This is valuable when the goal is to keep a 100G port, tunnel or filtering server below saturation.

It also matters because the same feature can create invisible user pain. The graph shows dropped packets, the link breathes again, but a game server loses handshake packets or an API health check becomes unstable. That is why size-based filtering must be tested against the normal profile of the protected service.

Possible technical approaches

A safe FlowSpec length rule should usually include more than length: destination scope, IP protocol, source or destination port when relevant, and a short lifetime. Multiple narrow ranges are safer than one wide range if the provider supports them. If the pattern is unstable, it is often better to use rate-based downstream filtering instead of trying to describe the whole attack with length alone.

For services with known packet profiles, baseline first. Learn normal packet size distribution before the incident when possible. During an attack, compare the flood with the baseline and push only the part that is clearly outside or clearly excessive. For gaming, this is particularly important because legitimate UDP can be compact, repetitive and latency-sensitive.

How Peeryx designs this layer

Peeryx uses packet length filtering as a de-grossing tool when the attack signature is stable enough. The rule should reduce the flood before it consumes protected capacity, but it should not replace traffic-aware mitigation. The downstream stack still needs to understand the protected service, especially for UDP-heavy applications and game servers.

In practice, this means Peeryx can combine FlowSpec length rules with protected IP transit, GRE/IPIP/VXLAN delivery and post-filter firewall rules. If the customer runs gaming traffic, the optional game filtering layer can help distinguish abusive patterns from normal sessions instead of treating size alone as the final truth.

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 UDP amplification attack sends millions of packets in a narrow size range toward one protected IP. The destination, protocol, port and packet length are all stable. A FlowSpec rule matching that combination can remove a major share of the attack upstream and keep the customer handoff usable.

Now consider a FiveM or Minecraft-related UDP service. Some legitimate traffic may also be repetitive and small. A broad rule that drops a popular packet length across the whole service can create player disconnects. The safer approach is to match the attack destination and range precisely, observe accepted player traffic, then refine downstream rather than widening upstream.

1. Capture the size distribution

Look for stable peaks that are clearly attack-related.

2. Add protocol and port context

Length alone is rarely safe enough for production.

3. Limit destination scope

Target the attacked host or prefix slice rather than all customers.

4. Re-evaluate during mutation

Attack tools often change packet size once the first filter works.

Frequent mistakes to avoid

  • Dropping a packet size globally because it appeared in one attack.
  • Using one wide range instead of several precise ranges.
  • Ignoring tunnel overhead, MTU and fragmentation behavior.
  • Assuming game UDP traffic is malicious because it is repetitive.
  • Leaving size filters active after the attack signature changes.

FAQ

Is packet length filtering useful against UDP floods?

Yes, when the flood has stable sizes and the rule is combined with destination, protocol and port scope.

Can packet length alone prove traffic is malicious?

No. It is a useful signal, not a complete legitimacy decision.

Does FlowSpec support multiple length ranges?

It depends on the upstream provider and implementation. This must be verified before relying on it.

Is length filtering safe for game servers?

It can be, but only with careful baselining and narrow rules because legitimate game UDP may be repetitive.

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.