Kuboid
Open Luck·Kuboid.in
Black Hat2023
Open in YouTube ↗

Leveraging Streaming-Based Outlier Detection and SliceLine to Stop Heavily Distributed Bot Attacks

Black Hat824 views39:39over 2 years ago

This talk demonstrates a methodology for detecting and mitigating highly distributed bot attacks by combining streaming-based outlier detection with the SliceLine algorithm. The approach identifies anomalous traffic patterns across various dimensions, such as user agents, IP addresses, and autonomous systems, without requiring prior knowledge of specific attack signatures. By encoding traffic features into binary matrices, the technique enables the automated generation of blocking rules that can be applied in real-time. The presenters also released an open-source Python implementation of the SliceLine algorithm to facilitate its adoption in security operations.

Beyond Rate Limiting: Detecting Distributed Bot Attacks with SliceLine

TLDR: Traditional rate limiting is failing against modern, highly distributed botnets that rotate through thousands of residential proxies to mimic human traffic. This research introduces a methodology using streaming-based outlier detection and the SliceLine algorithm to automatically identify and block these sophisticated attacks in real-time. By encoding traffic features into binary matrices, security teams can generate precise, dynamic blocking rules without needing prior knowledge of specific attack signatures.

Modern bot operators have moved far beyond simple script-kiddie volumetric attacks. Today, a single credential stuffing campaign might involve over 180,000 distinct IP addresses, effectively bypassing any IP-based rate limiting or reputation-based filtering. When attackers leverage residential proxy networks, they blend their traffic with legitimate user activity, making traditional threshold-based detection look like a blunt instrument. If you are still relying on static rules to stop account takeovers, you are likely missing the vast majority of the traffic that matters.

The Mechanics of Distributed Evasion

Attackers currently use a combination of automated browser frameworks like Puppeteer, Selenium, and Playwright to execute JavaScript natively. These tools are often augmented with "stealth" plugins or specialized drivers like undetected-chromedriver to strip away the tell-tale signs of automation. By rotating through residential proxies, these bots gain the reputation of real ISPs, rendering IP-based blacklists useless.

When a botnet hits an e-commerce or gaming platform, the traffic volume might not even trigger an alert. The attack is "low and slow," distributed across a massive surface area. The challenge for researchers and defenders is to find the needle in the haystack: the specific subset of traffic that, when viewed in aggregate, reveals the underlying malicious intent.

Automating Detection with SliceLine

The core of this research lies in shifting from individual session analysis to aggregate traffic analysis. By monitoring features like User-Agents, Autonomous Systems (AS), and geographic origin, we can build time-series data that highlights anomalies. When a traffic spike occurs, we don't just look at the volume; we look at the distribution of these features.

The SliceLine algorithm, originally designed for debugging machine learning models, is the secret sauce here. It identifies "slices" of data—subsets defined by a conjunction of conditions—where the error rate is significantly higher than the baseline. In a security context, we treat "malicious traffic" as our error state.

To implement this, we encode traffic features into binary matrices. For example, if we have a categorical feature like "Country," we use one-hot encoding to create binary columns. A rule like Country == 'DE' AND User-Agent == 'Chrome' becomes a vector of ones and zeros. This allows us to use matrix multiplication to evaluate thousands of potential rules simultaneously.

# Example of instantiating the SliceFinder class
sf = SliceFinder(alpha=0.05, k=4)
sf.fit(df.drop('group', axis=1), df['group'])

By applying this to a streaming architecture like Apache Flink, we can compute these aggregates in real-time. The algorithm identifies the specific combination of attributes that characterizes the attack traffic, allowing us to generate a rule that blocks only that specific segment of traffic, leaving legitimate users untouched.

Practical Application for Pentesters

For those of us performing red team engagements or bug bounty hunting, this research highlights why "bypassing" a WAF is often just a matter of understanding its detection logic. If you are testing a target that uses behavioral analysis, you need to understand the dimensions they are monitoring. If they are using aggregate statistics, your distributed attack will be caught if your traffic shares a common, anomalous attribute—even if your IPs are clean.

During an engagement, you can test the robustness of these systems by varying your traffic dimensions. If you rotate your User-Agents but keep your AS or geographic origin constant, you might still trigger an anomaly if the defender is using a slice-based detection model. The impact of these automated detection systems is that they force attackers to be more precise. You can no longer just "spray and pray" with a tool like OpenBullet 2; you have to carefully curate your traffic to stay within the "normal" distribution of the target's user base.

The Defensive Shift

Defenders should stop viewing WAFs as simple rule-matching engines. The future of bot mitigation is in identifying the "slices" of traffic that deviate from the norm. By implementing streaming-based outlier detection, blue teams can move from reactive, manual rule creation to proactive, automated defense. The key is to maintain a baseline of "human" traffic and treat any significant deviation in the distribution of traffic features as a potential indicator of compromise.

This approach is not a silver bullet. It requires high-quality data and a solid understanding of what "normal" looks like for your specific application. However, it is a significant step forward from the cat-and-mouse game of IP blacklisting. As botnets become more distributed, our detection strategies must become more multidimensional. If you are building or testing these systems, start by looking at your traffic not as a stream of individual requests, but as a multidimensional dataset waiting to be sliced.

Talk Type
research presentation
Difficulty
advanced
Has Demo Has Code Tool Released


Black Hat Asia 2023

45 talks · 2023
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in