Blog
How to solve AWS (AMAZON) WAF Captcha Token

How to solve AWS (AMAZON) WAF Captcha Token

Logo of Capsolver

CapSolver Blogger

How to use capsolver

12-Jul-2023

How to Solve AWS WAF Captcha

Solve AWS Captcha
aws captcha grid solver

Before we start solving AWS WAF Captcha, there are some requirements and points that we need to be aware of:

🔒 Requirements:

  • CapSolver Key
  • Proxy (Optional)

Proxy is optional, depends on the task type used, will be required / optional.

📒 Points to be aware of:

⚠️When the status code returned by the captcha page is 202, you only need to pass awsChallengeJs.
⚠️ When the status code returned by the captcha page is 405, you need to pass in awsKey, awsIv, awsContext, and awsChallengeJs.

  • Ensure the validity of the website URL
    To verify the authenticity of the website URL, ensure that it returns a 405 status code and the HTML contains elements like iv, key, and context.
  • Triggering the AWS Captcha is necessary to access this URL.
  • The URL should yield an HTML response comprising the key, iv, and context.
    As illustrated in these images, a matching URL will yield a 405 status code, and its HTML will include elements such as key, iv, and context.
    Page with status code 405
    Html of a page with status code 405
    - Save the url of the challenge script, context value, iv value and key value.

To solve AWS WAF Captcha, follow our documentation. For this example, we will only use the required parameters. The task types for AWS WAF Captcha are:

  • AntiAwsWafTaskProxyless: This task type use the proxies from capsolver.
  • AntiAwsWafTask: This task type requires your own proxies.

In this case, the task type that will be used in this blog, will be AntiAwsWafTaskProxyLess.

📤 Step 1: Submit the information to Capsolver

⚠️ When the status code returned by the captcha page is 405, you need to pass awsKey, awsIv, awsContext, and awsChallengeJs.

Status code 405

POST https://api.capsolver.com/createTask
{
 "clientKey":"yourapiKey",
 "task":
 {
 "type":"AntiAwsWafTaskProxyless",
 "websiteURL":"https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
  "awsKey":"key value",
  "awsIv":"iv value",
  "awsContext":"context value",
  "awsChallengeJS":"Url of the js challenge"
 }
}

⚠️When the status code returned by the captcha page is 202, you only need to pass awsChallengeJs.

Status code 202

{
 "clientKey":"yourapiKey",
 "task":
 {
 "type":"AntiAwsWafTaskProxyless",
 "websiteURL":"https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
  "awsKey":"",
  "awsIv":"",
  "awsContext":"",
  "awsChallengeJS":"Url of the js challenge"
 }
}

This will return a response that contains taskId, save this value and submit to the step 2.

🔖 Step 2: Get the results

We will need to retrieve the getTaskResult method until the captcha is solved. Retrieve every 3-5s.

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
{
 "clientKey":"YOUR_API_KEY",
 "taskId": "TASKID OF CREATETASK" //ID created by the createTask method
}

Captcha solution will look like:
AWS CAPTCHA TOKEN SOLUTION

After the captcha has been solved, you need to create the cookie aws-waf-token and add the value that you got from capsolver response.

In conclusion, solving AWS WAF Captcha can be a daunting task, but with the help of capsolver.com, it can be done quickly and efficiently. By following the steps outlined above, you can easily solve AWS WAF Captcha.

More