AWS WAF

Bypass CloudFront: What's Actually Being Evaded

CloudFront caches and routes. AWS WAF decides what gets through.

TL;DR

  • CloudFront isn't the target. In practice, bypassing CloudFront means getting past AWS WAF, the web ACL attached to the distribution. CloudFront itself only caches and routes requests.
  • Configuration gaps matter. Weak signature rules and the 16 KB default body-inspection limit can create blind spots. A publicly reachable origin lets requests avoid WAF inspection entirely.
  • Legitimate clients get challenged. Bot Control can serve a JavaScript challenge or CAPTCHA to a monitoring script or AI agent, and BrowserQL's solve(type: amazonWaf) clears that challenge without touching WAF's rules.

Introduction

Your script pulled the page fine yesterday, and today it hits a challenge screen that has you looking up how to bypass CloudFront. The response is an HTTP 202 with an x-amzn-waf-action: challenge header and a wall of JavaScript where your content should be. None of that came from CloudFront.

AWS WAF did, from a web ACL attached to the distribution. In this guide, you'll learn how attackers evade those WAF rules and how defenders harden them. You'll also see what a legitimate client can do when the challenge lands on it instead.

Bypassing CloudFront really means getting past AWS WAF

CloudFront is a content delivery network (CDN) service that caches your content and routes requests across a global network of edge locations. It doesn't read request bodies or run JavaScript challenges against suspicious visitors.

AWS WAF is the web application firewall that actually inspects traffic, through a web access control list (web ACL) attached to the CloudFront distribution in your AWS account. It checks each request against managed and custom rules, then allows, blocks, challenges, or serves a CAPTCHA.

AWS WAF Bot Control is an optional managed rule group built for bot detection. At its targeted inspection level, Bot Control uses browser interrogation, fingerprinting, and behavior heuristics to decide which clients get a JavaScript challenge or CAPTCHA.

So when you search "bypass CloudFront," the thing in your way is the AWS WAF rule set, and maybe Bot Control, sitting in front of the distribution.

CloudFront caches and routes a request, then AWS WAF inspects it and decides to allow, block, or challenge.

What bypassing WAFs looks like on CloudFront

Only test a WAF you own or have explicit authorization to assess, and stay within any published bug bounty scope. The techniques below give defenders enough detail to recognize and close each gap.

None of them is specific to CloudFront. They're rule-matching and architecture gaps that turn up on any AWS WAF deployment, not a CloudFront vulnerability, and CloudFront is a common place to attach one.

Payload obfuscation against pattern-matching rules

WAF rules often match known attack signatures, including patterns associated with SQL injection and cross-site scripting (XSS). Attackers exploit differences between how a rule normalizes input and how the application interprets it, so defenders need canonicalization before inspection and validation at the application boundary.

Unicode normalization was the basis of the fourth-ranked entry in PortSwigger's Top 10 Web Hacking Techniques of 2025. That result shows why signature rules alone are insufficient when two layers interpret the same input differently.

Inspection-limit evasion

For CloudFront, AWS WAF inspects the first 16 KB of a request body by default, and customers can raise that limit to 64 KB. A web ACL associated directly with an Application Load Balancer, by contrast, caps body inspection at 8 KB. Content beyond the configured limit isn't inspected, so defenders should set oversize handling deliberately and reject bodies the application doesn't need.

Architecture-level routing around the WAF entirely

The third category skips rule evasion. If an origin allows direct access, HTTP traffic can reach it without crossing the WAF-protected CloudFront distribution.

The fix depends on the origin. Origin Access Control restricts S3 origins. For a load balancer or other custom origin, use a VPC origin, or combine CloudFront's managed prefix list with a secret custom header.

A reachable origin also costs money. Requests that skip CloudFront skip its cache, so responses that would have been served from the edge fall back to the origin, adding load and data-transfer cost that CloudFront would otherwise absorb.

Closing the gaps is WAF configuration work

Each gap is closed where it lives, in AWS WAF's rules, its inspection and encoding settings, or the origin infrastructure. AWS keeps its managed rule groups current, but a rule left disabled is its own gap, so hardening a deployment is ongoing work rather than a one-time switch.

When your own automation trips the same rules

Rate-based rules, IP reputation lists, and Bot Control don't care about intent. Rate rules count requests, reputation lists score your IP, and Bot Control checks for the browser signals it expects. Tuned tightly, they block requests from anything that looks automated.

Your own legitimate client can trigger the same alert as the unwanted tooling. Think monitoring scripts, QA crawlers, price trackers, and AI agents that rely on reaching the page for a user.

AWS WAF returns a challenge as HTTP 202 with x-amzn-waf-action: challenge, and a CAPTCHA as HTTP 405 with x-amzn-waf-action: captcha. Either one can stop your automation dead as a false positive.

None of that is rule evasion, and your client isn't trying to inject malicious scripts or dodge inspection. It just needs to complete the check the WAF put in front of it.

Clearing AWS WAF challenges with Browserless

What the AWS WAF solver does

Browserless's BrowserQL (BQL) exposes a solve mutation, and amazonWaf is one of the values in its CaptchaTypes enum. Leave the type out and solve starts by identifying which challenge is on the page itself.

It clears the interactive challenge or CAPTCHA that AWS WAF Bot Control throws at a suspicious session. It won't defeat rule-based detection of malicious input. Clearing a challenge as a legitimate client and evading a security rule are two different things.

solve(type: amazonWaf) clears a Bot Control challenge for a legitimate client, and does not change AWS WAF's payload rules.

A working example

Here's the full flow as one authorized session, start to finish. The Node 18+ script sends a single BrowserQL mutation to the stealth BrowserQL endpoint, which adds fingerprint mitigations before the request is sent, routes through a residential proxy with the default sticky behavior, opens the page, calls solve(type: amazonWaf), and reads the title and text back so you can check them against content you expect on the real page.

The script needs two environment variables, which keeps the setup straightforward. Set BROWSERLESS_TOKEN and TARGET_URL, then point TARGET_URL at a CloudFront-fronted page you're authorized to test, such as one on a domain you control. Optionally set EXPECTED_TEXT to a phrase that only appears on the real page, so a block page that still has a title and text can't pass as success.

// Node 18+. Needs BROWSERLESS_TOKEN and TARGET_URL; EXPECTED_TEXT is optional.
const { BROWSERLESS_TOKEN, TARGET_URL, EXPECTED_TEXT } = process.env;
if (!BROWSERLESS_TOKEN || !TARGET_URL) {
  throw new Error("Set BROWSERLESS_TOKEN and TARGET_URL before running.");
}

// timeout is the session lifetime (default 60s). 120s fits every plan, including Free.
const endpoint = `https://production-sfo.browserless.io/stealth/bql?token=${encodeURIComponent(BROWSERLESS_TOKEN)}&timeout=120000`;
const query = `
  mutation CloudFrontSession($url: String!) {
    proxy(url: ["*"], network: residential) { time }
    goto(url: $url, waitUntil: networkIdle, timeout: 45000) { status }
    solve(type: amazonWaf, timeout: 30000) {
      found
      solved
      time
      token
      error
    }
    waitForTimeout(time: 8000) { time }
    title { title }
    text { text }
  }
`;

const response = await fetch(endpoint, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ query, variables: { url: TARGET_URL } }),
  signal: AbortSignal.timeout(130_000),
});

if (!response.ok) {
  throw new Error(
    `Browserless returned HTTP ${response.status}: ${await response.text()}`,
  );
}

const { data, errors } = await response.json();
if (errors?.length) {
  throw new Error(`BrowserQL error: ${errors.map((e) => e.message).join("; ")}`);
}
if (data.solve.found && !data.solve.solved) {
  throw new Error(`AWS WAF challenge found but not solved: ${data.solve.error}`);
}

const pageText = data.text.text.trim();
if (!data.title.title && !pageText) {
  throw new Error("The target returned no readable page content.");
}
// A WAF block page has a title and text too, so check for content
// that only the real page has before calling it a success.
if (EXPECTED_TEXT && !pageText.includes(EXPECTED_TEXT)) {
  throw new Error("Expected text not found; the page may still be blocked.");
}

console.log("First response status:", data.goto.status);
console.log("Challenge result:", data.solve);
console.log("Final title:", data.title.title || "(empty)");
console.log("Page text:", pageText.slice(0, 200));

Save the file as cloudfront-session.mjs, then run node cloudfront-session.mjs. A challenge-free page should return found: false. On an authorized AWS WAF target, found: true and solved: true show the challenge was cleared. That alone doesn't prove access, because AWS WAF keeps evaluating its other rules after it accepts the token, so a later rule can still block the request. EXPECTED_TEXT matching the page text is what confirms the real page loaded.

If solve returns found: false on a page you know is challenged, the challenge hadn't rendered yet, so add a waitForSelector before solve. If you'd rather not hand-write GraphQL, Browserless's Browser Automation Protocol (BAP) SDK wraps BrowserQL in a Puppeteer-style API for TypeScript and Python, and its page.solve({ type: 'amazonWaf' }) runs the same solver.

When this isn't enough

Solving a Bot Control challenge has limitations. It won't fix a WAF rule or rate limit that blocks requests outright, and when that's what you're hitting, the automation owner and the team running the server need to adjust the configuration. If a challenge still won't clear, hybrid automation lets a human complete the check in the same session. AWS also keeps changing its managed rules and Bot Control signals, so verification stays an ongoing process.

Conclusion

Traffic that avoids inspection and automation that gets challenged are two different problems with two different owners. The first is a rule or origin gap for the site owner to close, and it lives in AWS WAF and the origin, not in CloudFront. The second is a browser problem, and it's the one you can fix today.

Browserless handles that second case in one authorized session. It runs a real browser behind a sticky residential proxy and clears the AWS WAF Bot Control challenge with solve(type: amazonWaf). Then it reads the title and text back so you can check them against content only the real page has, all without touching a single WAF rule. Point it at a target you're authorized to test and sign up for a free Browserless trial.

Bypass CloudFront FAQs

Is CloudFront itself vulnerable, or is it the WAF?

The WAF, not CloudFront. CloudFront caches and routes traffic at the edge and doesn't inspect payloads or run challenges. AWS WAF, attached to the distribution as a web ACL, enforces the rules and decides what gets through.

Does AWS WAF Bot Control block or just challenge suspicious traffic?

Both actions exist, and they behave differently. A block stops the request outright. A challenge, a JavaScript check or CAPTCHA at Bot Control's targeted inspection level, gives a real browser a way through while still filtering out traffic that can't complete it.

Can Browserless bypass AWS WAF's security rules?

No. solve(type: amazonWaf) clears Bot Control's challenge action for a legitimate automated client. It doesn't defeat AWS WAF's rule-based detection of malicious payloads, and nothing in this guide should be read as a way to do that.

How often do CloudFront WAF bypass techniques stop working?

There's no fixed schedule. AWS updates its managed rule groups on an ongoing basis, as most WAFs do, specifically to close known obfuscation and evasion patterns, which is why techniques documented in older writeups often don't hold up against a current deployment.