AWS WAF Captcha Image Solving
Solve Amazon Web Services WAF (Web Application Firewall) captcha challenges. AWS WAF can require grid selection, coordinate clicking, or text OCR verification for bot detection and DDoS protection.
Amazon Web Services Web Application Firewall (AWS WAF) provides advanced protection against web exploits and bots. AWS WAF captcha challenges can require users to identify specific objects, click target coordinates, or read distorted text from images to prove they are human. Our API processes these challenges automatically and returns the required verification responses.
Captcha Type
Use the following captcha type identifier in your API requests:
"type": "AWSWAF_IMAGE"
Request Format
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
captcha.type |
string | required | Must be "AWSWAF_IMAGE" |
captcha.metadata.siteUrl |
string | required | URL where AWS WAF captcha appears |
captcha.payload.images |
array | required | Array of base64-encoded images (grid: typically 6, coordinate/text: typically 1) |
captcha.payload.questionType |
string | required | Captcha type: "grid", "coordinate", or "text" |
captcha.payload.question |
string | optional | Challenge question text (required for questionType: "grid") |
captcha.payload.onlyNumbers |
boolean | optional | Used with questionType: "text". Set true for numeric-only OCR (default: false) |
captcha.payload.maxLength |
number | optional | Used with questionType: "text". Maximum expected OCR length (default: 0 = no limit) |
questionType Valuesgrid: Select matching images in AWS WAF grid challengescoordinate: Return click coordinates for canvas-style AWS WAF challengestext: OCR mode for AWS WAF text-image challenges
Example Request
const response = await fetch('https://solver-api.mydisct.com/createTask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({
auth: { token: 'YOUR_API_KEY' },
context: { source: 'api', version: '1.0.0' },
captcha: {
type: 'AWSWAF_IMAGE',
metadata: {
siteUrl: 'https://example.com'
},
payload: {
images: [
'image_1_base64',
'image_2_base64',
'image_3_base64',
'image_4_base64',
'image_5_base64',
'image_6_base64'
],
questionType: 'grid',
question: 'Select all images containing a cat'
}
}
})
});
Example Request (Text OCR)
const response = await fetch('https://solver-api.mydisct.com/createTask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({
auth: { token: 'YOUR_API_KEY' },
context: { source: 'api', version: '1.0.0' },
captcha: {
type: 'AWSWAF_IMAGE',
metadata: {
siteUrl: 'https://example.com'
},
payload: {
images: ['aws_text_captcha_base64'],
questionType: 'text',
onlyNumbers: false,
maxLength: 6
}
}
})
});
Response Format
Create Task Response
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha is being processed",
"task": {
"id": "MyDisctSolver_abc123",
"status": "processing"
}
}
Fetch Result Response (Processing)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha is being processed",
"task": {
"id": "MyDisctSolver_abc123",
"status": "processing"
}
}
Fetch Result Response (Completed)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha solved successfully",
"task": {
"id": "MyDisctSolver_abc123",
"status": "completed",
"result": {
"answers": [0, 2, 5],
"timestamp": "2025-11-05T12:34:56.789Z"
}
}
}
Fetch Result Response (Completed - Text OCR)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha solved successfully",
"task": {
"id": "MyDisctSolver_abc123",
"status": "completed",
"result": {
"answers": "A7B9C",
"timestamp": "2025-11-05T12:34:56.789Z"
}
}
}
Python Example
import requests
import time
def solve_aws_waf(images, site_url, api_key, question_type='grid', question=None, only_numbers=False, max_length=0):
payload = {
'images': images,
'questionType': question_type
}
if question_type == 'text':
payload['onlyNumbers'] = only_numbers
if max_length:
payload['maxLength'] = max_length
elif question is not None:
payload['question'] = question
create_response = requests.post(
'https://solver-api.mydisct.com/createTask',
headers={'Content-Type': 'application/json', 'apikey': api_key},
json={
'auth': {'token': api_key},
'context': {'source': 'api', 'version': '1.0.0'},
'captcha': {
'type': 'AWSWAF_IMAGE',
'metadata': {'siteUrl': site_url},
'payload': payload
}
}
)
create_data = create_response.json()
if not create_data['success']:
raise Exception(create_data['error']['message'])
task_id = create_data['task']['id']
while True:
time.sleep(3)
result_response = requests.post(
'https://solver-api.mydisct.com/fetchResult',
headers={'Content-Type': 'application/json', 'apikey': api_key},
json={'taskId': task_id}
)
result_data = result_response.json()
if result_data['task']['status'] == 'completed':
return result_data['task']['result']['answers']
elif result_data['task']['status'] == 'failed':
raise Exception('Captcha solving failed')
grid_solution = solve_aws_waf(
images=['img1', 'img2', 'img3', 'img4', 'img5', 'img6'],
site_url='https://example.com',
api_key='YOUR_API_KEY',
question_type='grid',
question='Select all images containing a cat'
)
print(f'AWS WAF grid result: {grid_solution}')
text_solution = solve_aws_waf(
images=['aws_text_captcha_base64'],
site_url='https://example.com',
api_key='YOUR_API_KEY',
question_type='text',
only_numbers=False,
max_length=6
)
print(f'AWS WAF text result: {text_solution}')
Implementation Guide
Step 1: Extract AWS WAF Images
AWS WAF captchas appear when accessing protected resources. Extract the images from the challenge:
// Extract AWS WAF captcha data
function extractAWSWAFData() {
const imageElements = document.querySelectorAll('.aws-waf-captcha-image img') ||
document.querySelectorAll('[data-testid*="captcha"] img');
const images = [];
const question = document.querySelector('.aws-waf-captcha-question')?.textContent ||
document.querySelector('.captcha-instruction')?.textContent || '';
let questionType = 'grid'; // default
const hasTextInput = document.querySelector('.aws-waf-text-captcha') ||
document.querySelector('input[type="text"][name*="captcha"]');
if (hasTextInput) {
questionType = 'text'; // OCR style AWS WAF challenge
} else if (document.querySelector('canvas') && !document.querySelectorAll('button').length) {
questionType = 'coordinate'; // Toycarcity style captcha
}
for (const img of imageElements) {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
ctx.drawImage(img, 0, 0);
const base64 = canvas.toDataURL('image/png').split(',')[1];
images.push(base64);
}
return { question, questionType, images };
}
Step 2: Submit to API
async function solveAWSWAF(siteUrl) {
const { question, questionType, images } = extractAWSWAFData();
const payload = {
images: images,
questionType: questionType
};
if (questionType === 'text') {
payload.onlyNumbers = false;
payload.maxLength = 0;
} else if (questionType === 'grid') {
payload.question = question;
}
const response = await fetch('https://solver-api.mydisct.com/createTask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({
auth: { token: 'YOUR_API_KEY' },
context: { source: 'api', version: '1.0.0' },
captcha: {
type: 'AWSWAF_IMAGE',
metadata: { siteUrl },
payload: payload
}
})
});
const data = await response.json();
if (!data.success) {
throw new Error(data.error.message);
}
const taskId = data.task.id;
while (true) {
await new Promise(resolve => setTimeout(resolve, 3000));
const resultResponse = await fetch('https://solver-api.mydisct.com/fetchResult', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({ taskId })
});
const resultData = await resultResponse.json();
if (resultData.task.status === 'completed') {
return resultData.task.result.answers;
} else if (resultData.task.status === 'failed') {
throw new Error('AWS WAF solving failed');
}
}
}
const solution = await solveAWSWAF('https://protected-site.com');
console.log('Selected indices:', solution);
Best Practices
- Specify questionType as "grid", "coordinate", or "text" based on challenge type
- Typically 6 images in grid challenges, 1 image in coordinate/text challenges
- Include exact question text for
questionType: "grid" - For text OCR, use
onlyNumbersandmaxLengthwhen you have format hints - AWS WAF has special format requirements
Common Issues
Solution: Ensure images are properly base64-encoded and in the correct order. AWS WAF typically shows 6 images in a grid.
Solution: AWS WAF may block requests from certain IPs or regions. Consider using proxies or different IP addresses.
Solution: Ensure you use "grid" for grid selection, "coordinate" for canvas clicking,
and "text" for OCR text-image challenges. For text mode, include onlyNumbers/maxLength
when known.
Solution: AWS WAF interface may change. Monitor for updates in CSS selectors and DOM structure.