← Lab /Security & privacy

Automated detection of Traefik 404 spikes blocks web-server scanners at Cloudflare edge

Using Elastic Security rules on Traefik access logs can reliably identify and block web server probing traffic at the Cloudflare edge.

Security & privacy Elastic Security Labs 8 May 2026 Defense Prototype evidence

Published as “Detecting Web Server Probing & Fuzzing in Traefik with Automated Cloudflare Response”

Why it matters

Automating edge blocking from proxy logs lets small teams stop scanners before they reach internal services, reducing bandwidth use and alert fatigue.

Summary

The author ingests Traefik access logs into Elastic, adds a missing host.name field via a custom ingest pipeline, and applies an out-of-the-box ES|QL rule that flags a source IP generating many 404/403 responses across many distinct URLs. When the rule fires, an Elastic workflow updates a Cloudflare custom WAF rule to block the offending IP at the edge, then acknowledges the alert. The setup is demonstrated in a homelab using ffuf to generate scanning traffic, showing the IP appears in the Cloudflare blocklist within seconds.

What they found 2

  1. The detection rule triggers when a source IP generates more than 100 errors across more than 50 distinct URLs.

    “I modified the logic to trigger when event_count > 100 and url_original_count_distinct > 50”

  2. By default the rule fires after 500 errors across 250 distinct paths.

    “By default, an alert only triggers if a source IP produces more than 500 errors across 250 distinct URI paths during the polling window.”

Caveats 6

  • Because this workflow concatenates IP addresses using an or statement (or (ip.src eq <IP>) ), be mindful that Cloudflare has a character limit for custom WAF expressions (typically 4096 characters on standard tiers).
  • In highly targeted environments, this string can eventually hit the limit.
  • Cloudflare custom WAF expressions have a 4096-character limit, which may be reached in large-scale attacks.
  • The detection thresholds need tuning for production environments where legitimate traffic may generate many 404s.
  • The custom ingest pipeline is required because the default Traefik integration does not populate host.name.
  • The solution was only tested in a personal homelab, not in a large-scale or multi-tenant deployment.

What’s new here 4

  • Uses an ES|QL statistical rule (event_count > 100 and distinct URLs > 50) to detect probing instead of simple string matching.
  • Adds a custom ingest pipeline to copy agent.name to host.name, ensuring the rule works with the Traefik integration.
  • Implements an Elastic workflow that appends offending IPs to a single Cloudflare WAF rule, avoiding rule-limit exhaustion.
  • Shows end-to-end validation with a fuzzing tool (ffuf) and automatic alert acknowledgement.