AI Tools Security

AI WAF Testing: How Cloudflare Used LLMs to Probe Its Own Defenses

Cloudflare describes using frontier AI models for AI WAF testing, uncovering encoding-based bypasses before patching them.

Abstract shield and network illustration representing AI WAF testing
AI-generated editorial illustration.

A company that runs a web application firewall (WAF) needs to know whether it can withstand attackers who use AI to speed up their work. A WAF is a filter that sits in front of a website or app and blocks malicious requests before they reach the server. Cloudflare, which operates a widely used WAF, describes building its own testing system that uses frontier AI models to hunt for gaps in that filter, then patching what it found.

Cloudflare explains that large language models are especially good at one specific skill relevant to attacking software: rapidly changing an attack payload based on what a server sends back. A model can try a different way of encoding a malicious string, move it to another part of a web request, or abandon one approach for another, all within seconds. Cloudflare built an automated tester that repeats this process at scale against its own WAF, using a technique the company calls dynamic testing, meaning it probes a running system rather than reading source code.

How the Adaptive Testing Loop Works

Cloudflare describes a system that runs two separate calls to an AI model for every attempt. The first call, which Cloudflare calls the proposal step, receives a known attack request, background context, and a short history of earlier results, then suggests one new variation. Code outside the model builds and sends that request. The second call, the review step, receives the response status, selected headers, and body text, and decides what the tester should try next.

Neither model call can see the WAF’s internal rules, rule identifiers, or attack-scoring details, according to Cloudflare. The models also cannot send requests directly. Cloudflare states that its own Python code controls execution at every step: checking the target address against an allowed list, disabling redirects, logging each attempt, and enforcing a maximum number of tries per scenario. Because a compromised or malicious server response could theoretically try to manipulate the AI model reading it, Cloudflare treats all response text as untrusted input before it reaches the next prompt.

Six Attack Categories, One Staging Environment

Cloudflare ran the system against an authorized customer staging environment protected by its WAF, using 45 test scenarios that generated 1,107 individual attempts. Forty-four of those scenarios covered six attack categories: cross-site scripting, SQL injection, command injection, server-side request forgery (SSRF), path traversal, and a vulnerability class known as Log4j. A single additional scenario tested log injection and was reported separately.

The WAF configuration under test combined an AI-driven attack-scoring system set to block low scores, Cloudflare’s managed rule set, and a strict version of an industry-standard rule set called OWASP Core Ruleset. Cloudflare reports that the large majority of the 1,107 attempts were blocked. Requests that were not blocked were treated as leads for human review rather than confirmed successful exploits, and Cloudflare filtered out malformed, duplicate, or out-of-scope observations before drawing conclusions.

A Recorded Example: Bypassing SSRF Detection

Cloudflare’s account includes a detailed walkthrough of one SSRF scenario. SSRF vulnerabilities can trick an application into fetching sensitive internal data, such as temporary cloud credentials, on an attacker’s behalf. The tester repeatedly sent the same internal address that cloud services use to expose those credentials, rewriting it in different numeric formats: standard dotted notation, a decimal integer, and an octal form.

Each of those variations was blocked. At the eighteenth attempt, the model kept the rest of the request unchanged and switched to a trailing-dot version of the same address. Cloudflare reports that this request produced a redirect instead of the WAF’s usual block page, meaning the expected detection did not trigger. Cloudflare notes there was no successful response from the origin server in this case, so the bypass revealed a detection gap without confirming that the underlying application was actually exploitable.

What Reviewers Should Know About This Approach

Cloudflare frames the exercise as one input into hardening its detection rules rather than a full penetration test of any customer’s application. A few points shape how much weight the findings should carry.

  • The results describe the combined behavior of the AI Attack Score, managed rule set, and OWASP rules acting together, not the performance of any single detection layer.
  • A model’s stated reasoning for why it tried a particular encoding is recorded as a hypothesis, and Cloudflare is explicit that this text is not a verified explanation of what the detection engine actually matched.
  • A bypassed WAF request still requires a genuinely vulnerable application behind it to cause harm, which is why Cloudflare pairs this work with a reminder to keep software patched.

Cloudflare states that it used the non-blocked requests it identified to build new detections meant to close the gaps found during testing, and describes the exercise as becoming a recurring part of how it develops its WAF going forward. The company has not published details on how frequently these tests will run or how findings from one customer’s staging environment translate to protections across its broader customer base.

Sources