Skip to main content

Overview

The Sniffer is ML Defender’s high-performance network monitoring component that captures packets using eBPF/XDP technology and performs real-time ransomware detection through a sophisticated 3-layer analysis pipeline.

Performance

  • 2M+ packets processed in 17-hour stability test
  • 82 events/sec peak throughput
  • 4.5 MB memory footprint
  • 147x speedup via lazy evaluation

Detection Layers

  • Layer 0: eBPF/XDP 512-byte payload capture
  • Layer 1.5: Shannon entropy & pattern matching
  • Layer 1: Fast heuristics (10-second window)
  • Layer 2: Deep ML features (30-second aggregation)

Architecture

The Sniffer implements a zero-copy, multi-threaded pipeline that minimizes latency while maximizing detection accuracy:

3-Layer Ransomware Detection

Layer 0: eBPF/XDP Payload Capture

Captures the first 512 bytes of every packet’s L4 payload directly in kernel space with verifier-approved bounds checking.
Coverage: 99.99% of ransomware families detected by analyzing packet sizes. Structure size: 544 bytes (30 + 2 + 512).

Layer 1.5: PayloadAnalyzer

Performs Shannon entropy analysis and pattern matching to detect encrypted content and ransomware signatures.
High entropy (>7.0 bits) indicates encrypted/compressed content typical of ransomware.

Layer 1: FastDetector (10-second window)

Real-time heuristics that trigger immediate alerts on suspicious patterns:

C&C Communication

>10 new external IPs in 10 secondsDetects command-and-control callbacks typical of ransomware check-ins.

Lateral Movement

>5 SMB connections in 10 secondsIdentifies ransomware spreading across network shares.

Port Scanning

>15 unique ports accessedCatches reconnaissance activity before encryption.

Connection Abuse

>30% RST ratioSpots aggressive connection behavior.
Configuration (from config/sniffer.json):

Layer 2: RansomwareFeatureProcessor (30-second aggregation)

Deep behavioral analysis extracting 20 ransomware-specific features: Real-time Output:

Performance & Validation

17-Hour Stability Test (Nov 2-3, 2025)

Test Configuration:
  • 6h 18m synthetic load (ransomware simulation)
  • 10h 48m organic background traffic
  • Mixed protocols: HTTP, HTTPS, DNS, SMB, SSH, ICMP
Results:

Performance Benchmarks


83+ ML Features Extracted

The Sniffer extracts comprehensive network behavior features for downstream ML models:
4 specialized feature sets:
  1. DDoS Features (83): Packet rates, flag patterns, timing analysis
  2. Ransomware Features (20): C&C, lateral movement, encryption indicators
  3. Random Forest Features (23): General attack detection (Level 1)
  4. Internal Traffic Features (4): LAN vs WAN classification

Configuration

Quick Start Config

Edit config/sniffer.json:

Profiles


Deployment

Prerequisites

Build

1

Clone and Navigate

2

Configure with CMake

3

Build

Run

Real-time Output:

Testing

Unit Tests

Test Results:
  • ✅ 25+ unit tests: All passing
  • ✅ Integration tests: All passing
  • ✅ 17h stress test: Passed
  • ✅ 2.08M packets: Processed successfully

Troubleshooting

Expected: 50-100 evt/s (normal)High: >200 evt/s → Consider port filtering
If >80% suspicious payloads detected, adjust entropy threshold:

Project Structure


Next Steps

ML Detector

Configure ML models for real-time inference

Firewall Agent

Set up autonomous blocking based on detections

etcd Server

Deploy distributed configuration management

RAG System

Enable natural language forensic queries