How DDoS attacks became routine for us and how ML helps repel them

Nikita (Habr: zakhmatov)21 Mar 2024

Problem

A service under L7 DDoS attack gets floods of GET/POST requests that overload the backend. Yandex saw 761 such attacks in 2022 (about two a day) and 989 in 2023 (two to three a day), and attackers keep changing parameters, headers and IP addresses. Hand-written heuristic rules go stale quickly. The classifier must also keep false positives near zero for human traffic that arrives at the same time.

Example from the article: a 2023 average attack was 200,000 RPS, and the strongest 2022 attack reached 13,400,000 RPS.

Solution in brief

Antirobot is a two-part scoring service at the L7 balancer. A fast part runs a light CatBoost on about a thousand per-request features. A smart part computes tens of thousands of features with time and entity aggregations, runs a heavier CatBoost, and puts bad IPs into a robotset that the fast part reads. Every attack is reviewed by an on-call analyst and fed back into training.

Questions this case answers
  • How to separate malicious from legitimate requests in real time under a strict latency budget when attack volume can multiply the load
  • How to keep a classifier effective against an adversary who keeps changing behavior, when a model trained once goes stale
  • How to stop L7 DDoS traffic without blocking real users?
  • How to run an ML model on every request when attack traffic multiplies the load?

Tools and methods

  • CatBoost — light model on the fast path, heavier one on the smart path
  • Per-request and aggregated features — headers, target, IP, time and entity aggregations
  • Robotset — list of bad entities handed from the smart part to the fast part
  • Challenge routing — good request passes, suspicious gets a captcha, malicious gets a 403
  • On-call attack review — a ticket per attack, new features and labels for training
Continue reading — it's free

Google or a one-time email code. No password.