Перейти к содержимому

Detecting distributed DDoS attacks in sampled network traffic

Это содержимое пока не доступно на вашем языке.

CASTLES Security Research · October 2026

Author: CASTLES network research team · Published 14 October 2026 · Version 1.0

This note explains how Castles Flow detects volumetric DDoS attacks from sampled flow telemetry, and what we saw running it in production next to an established commercial detection system. It covers the estimation model, per-host detection, detection of distributed (carpet-bombing) attacks, traffic baselines, and the limits packet sampling puts on each of them. We walk through five real attacks as they appear in the Flow interface, then three large events seen by the СОТА filter.

We do not disclose customer or operator data. Target addresses, prefixes, object names and equipment identifiers are masked in every screenshot. All times are UTC, and so is the 12-hour time axis on Flow charts.

Castles Flow runs in production at an internet exchange, at a transit node and in two of our own networks. One more deployment runs at a third-party DDoS protection operator, where Flow and the operator’s existing commercial detector read the same sFlow feed. The comparison results and all five attack cases below come from that site.

Telemetry sources:

  • sFlow v5 from switches and routers;
  • NetFlow v9 and IPFIX from routers;
  • packet mirroring (SPAN) into an XDP sensor that samples locally and emits records in the same format.

Production sampling rates run from 1:1024 to 1:65536. At the comparison site the switch samples at 1:1024 and the collector keeps every 16th sample for detection and history. So the detector and the charts below work at an effective 1:16384. Every detection result in this note was obtained at that coarse rate.

Each stored sample is one record with its frame length and effective sampling rate. Traffic is aggregated in 5-second buckets:

  • packets per second = Σ(rate) / 5;
  • bits per second = Σ(frame length × rate × 8) / 5.

For sFlow, the sampling rate comes from each flow sample. For NetFlow v9 and IPFIX it is resolved in order of precedence: the record itself, then options templates keyed by sampler ID, then the exporter default, then the rate configured for the device. If the rate cannot be resolved, the record is stored but left out of detection. Assuming a rate of 1 would silently understate an attack by orders of magnitude. For mirrored traffic, the effective rate is the switch rate times the local sensor rate. When the collector thins samples, it multiplies the stored rate by the thinning factor.

We checked the estimate against SNMP interface counters on the full 1:1024 feed at the comparison site. Over the validation window, sFlow came in 2.0% below the counters on ingress and 1.4% below on egress.

Field problems we hit. None of them raised an obvious error; each produced plausible but wrong numbers:

  • Double counting on link aggregation. Summing SNMP counters for a LAG and its member ports doubles the reference. At first it looked like the switch was under-reporting sFlow by a factor of about 0.55. The sFlow data were fine. The fix was to exclude aggregate interfaces from the reference by interface type.
  • Counter wrap. On a busy port the 32-bit sample pool counter wraps in about a minute, so it cannot be used as a long-window cross-check.
  • Interface index format. About 2% of samples had an input index of 0 and an output index in the alternative sFlow format. Treating these as unknown dropped them from egress accounting.
  • Direction filtering. An egress-only collection setting threw away all inbound traffic, which is the direction attacks arrive in. Detection has to use ingress samples.

Every 5 seconds the detector reads 5-second aggregates keyed by destination address and attack vector. Each vector has its own thresholds in packets per second and bits per second. If a host has a learned baseline, the effective threshold is whichever is larger: the static threshold or 1.1 × baseline.

The vector catalogue has 28 entries. Thirteen are reflection and amplification vectors (DNS, NTP, SSDP, CLDAP, memcached, SNMP, chargen, mDNS, MSSQL, NetBIOS, RIPv1, rpcbind, L2TP). The others cover total traffic, generic UDP and ICMP, TCP flag floods (SYN, RST, null, SYN-ACK, ACK), IP fragments, IP null and private protocols, and service-specific SYN and UDP query floods.

Normal decisions use a 60-second moving average rather than raw buckets. At a coarse sampling rate, one noisy bucket is not an attack. Default lifecycle:

  • an incident opens after a sustained period above threshold (120 seconds by default; 60 seconds at the comparison site, to match the reference system);
  • it clears after 240 seconds below 90% of threshold;
  • a new incident within 300 seconds of the previous one is merged into it;
  • at least 25 samples are required before any decision.

Very large floods take a separate fast path. When raw buckets exceed twice the high threshold, the incident opens at high severity without waiting for the moving average. Cases 1 and 2 below opened this way.

A carpet-bombing attack spreads traffic across many addresses in a customer’s prefixes, so each address stays under its own threshold. Per-host detection does not fire, by construction.

Flow catches these attacks on two levels.

  1. Spread rule. For each monitored object and vector, a host counts as hit once it exceeds 50% of its host threshold. A bucket counts as carpet when at least 10 hosts are hit. The object threshold is the host threshold times the minimum host count. The 50% level absorbs sampling noise: at coarse rates, a host under real attack can dip below its full threshold for a bucket. While a carpet incident is open, it suppresses host incidents for the same object and vector, so operators see one attack instead of hundreds of alerts.
  2. Object profile. Total inbound traffic for the monitored object is compared with its learned baseline. An incident opens when traffic beats the baseline by a configured margin and is also above an absolute floor.

Our first baseline was the 95th percentile of the last 60 minutes. It learned from the attacks themselves. During a long attack the baseline climbed until the attack no longer looked anomalous. In an early comparison this cost us 17 misses out of 18 object-level attacks seen by the reference system.

The current object baseline:

  • takes the median traffic of each hour, counting an hour only if it has at least 15 minutes of data;
  • builds one value per hour of day (UTC) as an exponentially weighted average over 7 days with a 1-day half-life;
  • excludes minutes that belong to detected object-level or carpet incidents;
  • is kept separately for packets and bits per second, inbound direction;
  • falls back to the 60-minute median while history is empty, and does not detect at all while the baseline is zero.

That last point exists because of a legacy rule we replaced. A baseline percentage of 0 used to mean “any traffic above baseline”. Over 90 days it produced 3.87 million false alerts at one site and 53 thousand at another.

Sampling turns a traffic rate into a sample count. In a 5-second bucket at rate 1:R, an attack of P packets per second yields n = 5P / R samples on average. The relative standard error of the estimate is about 1/√n.

Sampling rate Rate represented by one sample per bucket Rate needed for 25 samples per bucket (≈20% error)
1:1024 205 pps 5.1 kpps
1:4096 819 pps 20.5 kpps
1:16384 3.3 kpps 81.9 kpps

At the comparison site (effective 1:16384), that works out as follows:

  • Large attacks are measured precisely. The 35.4 Mpps flood in case 2 gave about 10,800 samples per bucket; the 24.7 Mpps flood in case 1, about 7,500.
  • Thresholds sit close to the sampling floor. The host UDP threshold there is 50 kpps, roughly 15 samples per bucket, so a single bucket at that level can read 20-30% high or low. This is why normal decisions use the 60-second average and the 25-sample minimum, and why the carpet rule counts hosts at half threshold.
  • Sampling hurts small vectors first. A fragment flood of a few thousand packets per second is about one sample per bucket. These floods account for most of the reference-only alerts below.

These figures are analytical. We have not yet measured detection probability against sampling rate in the field (see Limitations).

All five cases come from the comparison site. Peaks on incident cards are the detector’s figures. Charts show 5-second buckets, so chart peaks can run somewhat higher than the card.

Case 1. 286 Gbit/s UDP flood on a single address

Section titled “Case 1. 286 Gbit/s UDP flood on a single address”

10 October 2026, 10:52:35-11:01:25. UDP to destination port 443 from 7,750 unique sources, with 99.6% of packets at 1024-1518 bytes. The incident peaked at 285.9 Gbit/s and 24.7 Mpps against a host threshold of 50 kpps. The highest 5-second bucket hit 298.3 Gbit/s. The fast path opened UDP, TOTAL and IPFRAG at 10:52:40, and IPPRIV followed at 10:53:25.

Reading the same feed on a 1-minute scale, the reference system reported 266 Gbit/s and 23.4 Mpps.

Case 1: incident card with four attack vectors

Case 1: packet rate in 5-second buckets with the detection timeline

Case 1: packet size distribution

2 October 2026, 12:44:25-12:58:00. UDP from 27,624 unique sources, and every sampled packet was 64-127 bytes. The incident peaked at 35.4 Mpps but only 18.7 Gbit/s. It opened on the fast path at 12:44:30. The reference system raised no host alert for this address, only an object-level profile alert.

The per-bucket series for this attack has already aged out of storage, so we can show only the incident record and its summaries.

Case 2: incident card, 35.4 Mpps at 18.7 Gbit/s

Case 2: all packets in the 64-127 byte range

12 October 2026, 21:51:25-21:58:20. UDP spread over 158 addresses in one customer object made up of four prefixes. The carpet incident peaked at 45.3 Gbit/s and 4.0 Mpps against an object threshold of 250 kpps. It opened at 21:51:30 and escalated to high at 21:52:30. The reference system had no matching alert for this object during that period.

Case 3: carpet incident over 158 hosts

12 October 2026, 16:47-16:53. UDP and fragments over 67 addresses in 12 prefixes, peaking at 17.4 Gbit/s and 1.51 Mpps. The list of hit hosts shows why this is a carpet. The busiest address took 72 kpps and every other one took less. With a per-host threshold of 50 kpps, only a few addresses crossed it even at peak, and most of the 17.4 Gbit/s stayed under per-host detection.

Case 4: hosts of the carpet with their individual peaks

Case 5. Inbound attack on an object, caught by the profile

Section titled “Case 5. Inbound attack on an object, caught by the profile”

11 October 2026, 17:53:00-18:37:55. Inbound traffic to one customer object rose from a 3.50 Gbit/s baseline to far above the 6.66 Gbit/s profile threshold. The incident peaked at 40.4 Gbit/s and 3.6 Mpps, with the highest 5-second bucket at 50.8 Gbit/s at 18:02:35. It opened at 17:53:05 and escalated at 17:54:05.

Over the same period the reference system raised a single alert on this object: an outbound-profile alert peaking at 475 Mbit/s. Because object and time overlapped, the automatic comparison counted it as a match. Manual review showed the two systems were reporting different directions. Matching on object and time alone overstates how much two detectors agree.

Case 5: inbound traffic against baseline and threshold

Results against a commercial detection system

Section titled “Results against a commercial detection system”

Method. At the third-party operator, Flow and the reference system get the same sFlow feed and use the same thresholds and lifecycle settings. Every hour a script looks at a 70-minute window. It pulls the reference system’s DoS alerts through its API and Flow incidents from Flow’s database, then matches them: host alerts by destination address, object alerts by object, with a 600-second tolerance on time overlap. Flow incidents from one attack are grouped, and a single group can match several reference alerts. Each system’s peaks are reported the way that system reports them: 5-second buckets for Flow, 1-minute averages for the reference. Between 29 September and 13 October 2026 the script produced 268 hourly reports.

Six-hour window, 11 October.

  • Host alerts: the reference raised 33 and Flow matched 30. The three misses were IP fragmentation floods of 3-4 kpps, which the reference itself rated lowest importance.
  • Object alerts: all 12 reference alerts matched.
  • Flow raised 31 attack groups the reference did not (23 host, 8 object). We have not classified them as true or false positives yet.

24-hour window, 12-13 October.

  • 81 matched groups.
  • 27 reference-only alerts: 11 fragmentation floods of 3-8 kpps, plus 16 object-profile alerts on a single customer object still under investigation.
  • 104 Flow-only groups. Six are carpet or object attacks above 5 Gbit/s, cases 3 and 4 among them. Most of the rest are host alerts close to threshold and low-volume object alerts at night, when the baseline is lowest. These have not been classified yet either.

When both systems saw the same attack, their volume estimates were close. Some of the remaining gap in peaks comes from 5-second versus 1-minute aggregation. The rest may come from how each system processes samples, and we cannot inspect that on the reference side.

Flow only detects attacks; mitigation runs on a separate system. For a sense of scale, here are the three largest events of the last 30 days on a production СОТА filter installation. The figures are per-minute totals across the installation, taken from its monitoring. СОТА reports traffic per protection policy rather than per attack vector, and none of the five cases above went through it.

Event (UTC) Inbound peak Dropped, max Passed, max
28 Sep 2026, 20:35-21:30 207.8 Mpps; 417.9 Gbit/s 207.1 Mpps; 413.8 Gbit/s 0.96 Mpps; 4.1 Gbit/s
2-3 Oct 2026, 16:00-09:00 168.0 Mpps; 398.6 Gbit/s 161.1 Mpps; 389.8 Gbit/s 16.5 Mpps; 10.8 Gbit/s
4 Oct 2026, 13:30-19:55 49.4 Mpps; 445.7 Gbit/s 40.3 Mpps; 412.4 Gbit/s 16.7 Mpps; 25.4 Gbit/s

Within one event, the packet and bit peaks can land in different minutes. Passed traffic includes legitimate traffic of the protected networks.

СОТА, 28 September: inbound and dropped packets per second

СОТА, 4 October: inbound, dropped and passed bits per second

  • No labelled false-positive rate yet. Flow-only detections (31 in the six-hour window, 104 in the 24-hour window) have not been reviewed one by one, so we do not claim a false-positive rate. An alert-labelling workflow is the next step.
  • Sampling effects are calculated, not measured. The table above comes straight from sampling statistics. We plan a field experiment that re-runs detection on the full 1:1024 data subsampled to coarser rates.
  • Detection latency. Incident start is the first bucket the detector attributes to the attack. The open event follows once lifecycle conditions are met, which was 5 seconds later in cases 1-3. The two systems define attack start differently, so we do not compare reaction times and do not quote a general “detected in N seconds” figure.
  • One comparison site. The side-by-side results cover one operator and two weeks of data. They should not be read as a general accuracy figure.
  • Retention. Per-bucket series are kept for a limited time. For older attacks only incident records and summaries remain, as in case 2.
  • Baseline rollout. The current object baseline runs at the comparison site. Other sites still run earlier detector versions.
  1. The two results should be read separately. On the full 1:1024 feed, volume measurement was within about 2% of interface counters. Detection ran on the thinned feed at an effective 1:16384 and still caught every reference host alert except low-rate fragment floods; its peak estimate for a 286 Gbit/s attack was within 8% of the reference system. The 2% figure does not carry over to the 1:16384 data.
  2. Most estimation errors in the field come from configuration and data handling, not statistics: unresolved sampling rates, aggregate interfaces counted twice, interface index formats, direction filters. Every one of them silently produces wrong numbers instead of an error.
  3. Carpet bombing needs an object-level view, either a spread rule that counts many hosts at a fraction of their threshold or a per-object traffic baseline. Cases 3 and 4 were invisible as individual host alerts and obvious at the object level. And as case 5 shows, matching alerts on object and time alone can hide a disagreement about traffic direction.
  4. Thresholds must be set in both packets and bits. Case 2 delivered 35 Mpps at under 19 Gbit/s. A bandwidth-led view would rank it far below its real impact.
  5. Baselines must exclude attack periods and must never detect on an empty or zero baseline. A rolling-percentile baseline adapts to long attacks and then misses them.
  6. At coarse sampling rates, small packet-rate vectors like fragment floods are the weakest point. When a threshold sits near the sampling floor, it should be set with the per-bucket sample count in mind.