AWS WAF and other CAPTCHAs
How to find the AWS WAF CAPTCHA parameters
An AWS WAF task needs only the page URL, but the puzzle page also prints three values that tie your task to the exact challenge you received. Here is where to find them in the browser and in code.
The short answer
Open the blocked URL, look at the HTML of the puzzle page, and find an inline script that assigns window.gokuProps. That object holds three strings: key, iv and context. They go into the task as awsKey, awsIv and awsContext. The page URL goes into websiteURL, which is the only required field.
| On the page | Task field | Required | Notes |
|---|---|---|---|
| Address bar URL | websiteURL | Yes | The URL that returned the puzzle, with path and query. |
| gokuProps.key | awsKey | No | A long base64 style string tied to the site's configuration. |
| gokuProps.iv | awsIv | No | A short value used with the key. |
| gokuProps.context | awsContext | No | Changes on every load; read it fresh. |
The names above describe the page as it looks at the time of writing. AWS can change its integration code, so treat this as a map to check against what you see, not a fixed contract.
Confirm you are looking at AWS WAF
Before hunting for values, make sure the block really comes from AWS WAF and not from another vendor. Three signs are typical:
- The status code. In the Network panel of DevTools, the document request shows 405 for the CAPTCHA action. A silent Challenge action, which only runs a background check, shows 202.
- The integration script. The page loads a JavaScript file from a host that ends in
awswaf.com, commonly withchallenge.jsorcaptcha.jsin the path. Its full URL is a reliable fingerprint of AWS WAF. - The cookie name. After you solve the puzzle by hand, the Application panel lists a cookie called
aws-waf-tokenfor the site.
If instead you see cf_clearance, datadome or a reCAPTCHA iframe, you are dealing with something else; our overview of CAPTCHA types compared helps you tell them apart.
Read the values in the browser
The quickest manual method takes under a minute:
- Open DevTools, go to the Network panel and tick "Preserve log" so the puzzle response is not lost on reload.
- Load the blocked URL. Click the first document request, the one with status 405.
- Open its Response tab and search for
gokuProps. The object sits in an inline<script>near the top of the page. - Alternatively, switch to the Console and type
window.gokuProps. The browser prints the object with all three properties.
While you are in the Response tab, note the src of the script tag that points at awswaf.com. You do not send it in the task, but it is useful in logs: if a site moves to a different integration, the script URL is usually the first thing that changes.
Read the values in code
For automation you want the same values without DevTools. The puzzle page is plain HTML, so one regular expression is enough. This small JavaScript function works in Node.js on a response body fetched with fetch; a Python version is in the Python guide.
export function readGoku(html) {
const hit = /gokuProps\s*=\s*(\{[\s\S]*?\})\s*;?/.exec(html);
if (!hit) return {};
let obj;
try { obj = JSON.parse(hit[1]); } catch { return {}; }
const fields = { awsKey: obj.key, awsIv: obj.iv, awsContext: obj.context };
return Object.fromEntries(Object.entries(fields).filter(([, v]) => v));
}
const page = await fetch('https://portal.example.org/members/directory');
const awsFields = page.status === 405 ? readGoku(await page.text()) : null;
console.log(page.status, awsFields);
When the page is open in a browser automation tool, skip the regex and read the object directly: await page.evaluate(() => window.gokuProps) in Playwright or Puppeteer, or driver.execute_script("return window.gokuProps") in Selenium.
Why the context value must be fresh
The context string belongs to one puzzle instance. Each new load of the 405 page produces a different one, and a cookie earned for an old context may not satisfy the firewall for the current request. Read the three values from the same response you are about to answer, create the task right away, and do not cache them across runs. key and iv tend to change less often, but treating all three as fresh costs nothing.
Pages that render the puzzle themselves
Some sites do not rely on the 405 page. They embed the AWS WAF CAPTCHA inside their own form using the JavaScript API, often through a script named jsapi.js and a call similar to AwsWafCaptcha.renderCaptcha(container, options), where the options include an API key for the integration. In that case:
- There may be no
gokuPropson the page. Send the task withwebsiteURLonly. - The page's own code reads the resulting token after the puzzle and attaches it to its request. Watch the Network panel while solving by hand to see which request carries it, then reproduce that request with the cookie from your task.
- If you drive a browser, the image puzzle itself can also be answered tile by tile; the guide on AWS WAF image puzzles explains when that route makes sense.
Putting the values into a task
With the values in hand, the task object inside your createTask request (next to clientKey) looks like this:
"task": {
"type": "AntiAwsWafTaskProxyLess",
"websiteURL": "https://portal.example.org/members/directory",
"awsKey": "AQIDAHjcYu/GjX+QlghicBgQ...",
"awsIv": "CgAHbCe2GgAAAAAA",
"awsContext": "rGXmJ1VrDcPyTU3eCbn8..."
}
The values in this sample are shortened placeholders. Paste the full strings exactly as the page shows them; trimming or re-encoding them is a common cause of ERROR_INVALID_TASK_DATA or of a cookie the site ignores. The answer arrives in solution.cookie, and you set it as aws-waf-token for the site. The AWS WAF solver page lists the price, currently $1.40 per 1,000 solved tasks.
Common mistakes
- Sending the home page URL instead of the URL that returned 405.
- Mixing values from two different loads of the puzzle page.
- Forgetting to send the same proxy in an
AntiAwsWafTaskwhen the site checks that the solving IP matches yours. - Parsing the object from a cached copy of the page saved hours earlier.
Common questions
Can I solve AWS WAF with only the page URL?
Yes. websiteURL is the only required field. The three gokuProps values are optional and help tie the task to your exact challenge.
Where is the challenge.js URL used?
It identifies the AWS WAF integration on the page and is handy in logs. The task itself does not take it as a field.
Does the key value change between visits?
It changes less often than context, but read all three from the response you are answering rather than storing them.
What if window.gokuProps is undefined?
The site probably renders the puzzle through the JavaScript API. Send websiteURL alone and watch which request carries the resulting token.
Which status code does the silent challenge use?
At the time of writing it is 202, while the visible CAPTCHA action uses 405. Either one ends with an aws-waf-token cookie in the browser.
Keep reading
- AWS WAF solver$1.40 per 1,000 tasks, answers under 3 seconds.
- AWS WAF CAPTCHAThe CAPTCHA and Challenge actions in Amazon's web firewall, the aws-waf-token cookie, and the page values a solve can use.
- Solve AWS WAF CAPTCHA in PythonDetect the AWS WAF 405 page in a requests session, send an AntiAwsWafTask and store the returned aws-waf-token cookie for the retry.
- AWS WAF image puzzles explainedWhen to answer the AWS WAF picture grid tile by tile with AwsWafClassification, and when a token task is simpler.