Improving the WAF with Machine Learning
Mar 15, 2022Daniele Molteni

Summary
Introduces a new machine learning model for WAF detection that scores every request for SQLi and XSS attacks. The model is trained on existing WAF-classified traffic and augmented data. It provides three scores: a total score (`cf.waf.ml.score`), and specific scores for SQLi (`cf.waf.ml.score.sqli`) and XSS (`cf.waf.ml.score.xss`), ranging from 1 (malicious) to 99 (valid). These scores can be used in custom WAF/Firewall rules for mitigation. The system aims to identify bypasses and anomalies proactively and runs on all traffic with negligible latency. The post details the challenges in building a reliable dataset, scalable data labeling, model selection, and high-throughput execution.
More from the Website Security & Threat Management trail
- We tested our own WAF with frontier AI models. Here’s what we found
- When scanners miss the attack: how Cloudflare Client-Side Security protects storefronts
- Introducing automatic remediation policies with Cloudflare CASB
- Introducing context-aware vulnerability discovery and remediation with Cloudflare Managed Defense and OpenAI Daybreak Models
- Introducing Adaptive Intelligence: undermining the economics of every bot attack