How to bypass AWS WAF captcha

To bypass an AWS WAF captcha, capture its 3×3 picture grid, send it with the instruction to a captcha solver API, then click the returned tiles in the real widget: AWS WAF stamps its own token, and requests pass until the immunity time runs out. This guide covers the CAPTCHA and Challenge actions, the token, the grid and the two calls to make with ilovecaptcha.

Updated on · Written and maintained by the ilovecaptcha team

Preview: the API described here is in public beta. Endpoint names, fields and codes can still change until the end of the beta, and no API key is distributed yet.

What is AWS WAF Captcha, and how does it differ from the Challenge action?

AWS WAF Captcha is a rule action of Amazon’s web application firewall: the site owner attaches it to a rule, and no form field is involved. When a request matches that rule without a valid token, the firewall withholds the page and serves a puzzle. First released in November 2021, it has been generally available since June 2022. Challenge is its silent counterpart: according to AWS, it “requires the client session to verify that it’s a browser, and not a bot”.

What does the firewall answer when the token is missing?

Response of AWS WAF to a request without a valid token, by rule action
Element CAPTCHA action Challenge action
What the visitor sees A visual or audio puzzle Nothing: a script runs in the background
HTTP status 405 Method Not Allowed 202 Request Accepted
x-amzn-waf-action header captcha challenge
Timestamp written in the token Latest solved CAPTCHA Latest passed silent challenge
Minimum immunity time 60 seconds 300 seconds

In both cases the HTML interstitial is only attached when the request’s Accept header contains text/html. A CAPTCHA rule also runs the silent check: according to AWS, when the client has no token yet, the interstitial “invokes the challenge script first”, then shows its puzzle.

How do the AWS WAF token and its immunity time work?

Solving the puzzle does not produce a value to paste into a form: it updates a token. According to AWS, that token is encrypted, stored in a cookie named aws-waf-token, and carries two timestamps: the latest successful silent challenge and the latest successful CAPTCHA. The script then resubmits the original request. On each later request the firewall subtracts the timestamp from the current time; beyond the configured immunity time, a new puzzle is served.

How long does a solved AWS WAF captcha stay valid?

  • Default: 300 seconds for both immunity times, set on the web ACL.
  • Minimum: 60 seconds for CAPTCHA, 300 seconds for Challenge.
  • Maximum: 259,200 seconds, or three days, for both.
  • A rule can carry its own value; otherwise it inherits the web ACL setting.

Why must the puzzle be solved in the browser that will use the token?

Because the token describes a session, not an answer. AWS states that it “fingerprints the client session” and includes data from “client browser interrogation, such as indications of automation”. A solver API therefore never hands back an AWS WAF token: it tells your browser which tiles to click, and the firewall issues the token to that browser.

What does the AWS WAF 3×3 grid ask the visitor to do?

To pick, among nine pictures, all those that show one named object. The example published by AWS carries the title “Let’s confirm you are human”, the instruction “Choose all the chairs”, a 3×3 grid in which some pictures contain chairs and others beds or windows, and a Confirm button. The instruction is written in the language of the browser, or in English when that language is not supported.

What does a solver have to get right on this grid?

  • The instruction: it names one category of object, in wording that changes with the browser language.
  • The nine tiles: each shows the object or does not, so the answer is a set of tiles, with no order.
  • The whole set: one misread tile is enough for a refusal followed by a new puzzle.
  • The click: a tile is a toggle, so each returned point is clicked once before Confirm.

What can a solver read on an AWS WAF page, and what is out of its reach?

A solver reads the picture grid, and only that. The question is closed: one category, nine pictures, a yes or a no for each, and AWS WAF validates the grid as a whole, so every returned tile matters. According to the AWS documentation, “many puzzles have been solved using machine learning and artificial intelligence”.

The time a person spends on such a grid says little about how it is felt: in a USENIX Security 2023 study in which 1,400 participants solved 14,000 CAPTCHAs, solving time and user preference did not always go together.

What does the grid solver leave out?

  • The silent Challenge action: it shows no image, so there is nothing to send to a solver; a real browser passes it by running the script.
  • The audio puzzle, spoken instructions over background noise and a text to type: the aws-waf task type reads pictures only.
  • The other rules of the firewall, which can still block a request.

What do you send for an AWS WAF task, and what comes back?

You send one image, the 3×3 grid of the puzzle encoded in base64, with the task type aws-waf and the sentence shown above the grid in the instruction field. The API answers with points: one pair of coordinates per tile to select, in pixels of the image you sent. No site key is involved, since AWS WAF issues its token to your browser.

The AWS WAF Captcha task at a glance
Item Value
Publisher Amazon Web Services
Challenge family Image grid
Task type aws-waf
You send Challenge image (base64 or URL)
You get back Coordinates to click or drop
Vendor documentation AWS documentation

How do you bypass AWS WAF captcha with the ilovecaptcha API?

In five steps, inside the automated browser that will keep the cookie. The API reads the nine pictures; the browser clicks.

  1. Reach the puzzle. Load the protected page over HTTPS and start the puzzle if a start button is shown.
  2. Capture the grid. Screenshot the 3×3 picture, note its displayed width and read the instruction.
  3. Create the task. POST createTask with the type aws-waf, the image in base64 and the instruction.
  4. Poll the result. Call getTaskResult every 1 to 2 seconds until status is ready.
  5. Click the tiles. Divide each point by the capture scale, click every tile once, then press Confirm.

AWS WAF then updates the aws-waf-token cookie and the original request is sent again.

What does an AWS WAF request look like?

The request below submits a grid captured as a 320×320 square. The response lists five points, one per tile showing a chair: each is the centre of a tile about 107 pixels wide, in pixels of the submitted image. The order does not matter. With a capture taken at twice the displayed size, divide each value by 2 before clicking.

POST /createTask
Content-Type: application/json

{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "aws-waf",
    "image": "iVBORw0KGgoAAAANSUhEUg…",
    "instruction": "Choose all the chairs"
  }
}

→ 200 { "errorId": 0, "taskId": "tsk_8f3a1c2e", "status": "processing" }

POST /getTaskResult
Content-Type: application/json

{ "clientKey": "YOUR_API_KEY", "taskId": "tsk_8f3a1c2e" }

→ 200 { "errorId": 0, "status": "ready", "solution": { "points": [[160, 53], [267, 53], [53, 160], [160, 267], [267, 267]] } }
A createTask request for a AWS WAF Captcha task, then the getTaskResult answer once the task is ready (preview format).

AWS WAF captcha bypass: frequently asked questions

Can you bypass AWS WAF captcha without a browser?

Not entirely. The call to the solver needs none: it is plain HTTPS with a JSON body. The puzzle and the token, however, live in a browser: according to AWS, CAPTCHA puzzles and silent challenges only run when browsers access HTTPS endpoints. Something must therefore display the widget, capture the grid and click the tiles, which Selenium, Puppeteer and Playwright all do.

Why does my request get a 405 with x-amzn-waf-action: captcha?

It is the documented answer of AWS WAF to a request that matches a CAPTCHA rule without a valid token: status 405 Method Not Allowed and the header x-amzn-waf-action set to captcha. A 202 with the value challenge signals the silent action. The puzzle page is only attached when the request accepts text/html, so a script calling a JSON endpoint receives the status and nothing to solve. Pass the puzzle on an HTML page of the site first, in the browser.

How long does the aws-waf-token last once the puzzle is solved?

What expires is the CAPTCHA timestamp stored inside the token, after the immunity time chosen by the site owner. AWS documents a default of 300 seconds, a minimum of 60 seconds and a maximum of 259,200 seconds, or three days. The setting cannot be read from the outside: only the return of the puzzle reveals it. On a default configuration, plan for a new grid after five minutes.

Does the ilovecaptcha browser extension handle AWS WAF captcha?

Yes. AWS WAF is one of the captchas the extension handles, in Chrome 116 or newer and Firefox 140 or newer. It spots the 3×3 grid, sends only the image and its instruction to the solver, then clicks the right cells in automatic mode or highlights them. It is installed from a folder, as a developer extension: it is not published on the browser stores, and the current build talks to a local gateway, not to the public API.

Who may automate an AWS WAF captcha, and for what purpose?

The puzzle was placed there by the owner of the firewall, so the first legitimate user is that owner: testing a web ACL before deployment, monitoring a protected sign-up flow, running QA or accessibility automation. Availability checks, academic research and the collection of public data are acceptable within the target site’s terms and the applicable law. AWS designed the puzzle against credential stuffing and spam, which OWASP files under OAT-009, CAPTCHA Defeat: those uses, like payment fraud, are outside what ilovecaptcha supports.

Sources

The facts and figures quoted on this page come from these sources.