Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Application misuse defense testing examines whether an application has adequate controls to detect and prevent abuse patterns. This includes testing for automated attack detection, unusual behavior monitoring, and defensive measures against brute force, scraping, credential stuffing, and other abuse scenarios. Effective defenses should identify malicious activity patterns and respond appropriately.
What to Check
Defense Mechanisms
Rate limiting implementation
Account lockout policies
CAPTCHA deployment
IP-based blocking
Behavioral analysis
Automated attack detection
Fraud detection systems
Abuse Scenarios
Scenario
Defense Expected
Brute force login
Account lockout, rate limiting
Credential stuffing
IP blocking, CAPTCHA
Web scraping
Rate limiting, bot detection
Price scraping
CAPTCHA, behavior analysis
Enumeration attacks
Generic responses, rate limiting
How to Test
Step 1: Test Rate Limiting
#!/bin/bash# Test rate limiting on various endpoints
ENDPOINTS=(
"/api/login""/api/password-reset""/api/register""/api/search""/api/products"
)
for endpoint in"${ENDPOINTS[@]}"; doecho
count=0
blocked=
i {1..100};
status=$(curl -s -o /dev/null -w \
-X POST \
-H \
-d )
[ == ];
blocked=
count=$((count + ))
[ = ];
"Testing: $endpoint"
false
for
in
do
"%{http_code}"
"https://target.com$endpoint"
"Content-Type: application/json"
'{"test": "data"}'
if
"$status"
"429"
then
echo
"Rate limited after $i requests"
true
break
fi
1
done
if
"$blocked"
false
then
echo
"[WEAK] No rate limiting detected after 100 requests"
fi
echo
"---"
done
Step 2: Test Account Lockout
#!/bin/bash# Test account lockout policy
USERNAME="testuser"
WRONG_PASSWORD="wrongpass"echo"Testing account lockout..."for i in {1..20}; do
response=$(curl -s -X POST "https://target.com/api/login" \
-H "Content-Type: application/json" \
-d "{\"username\": \"$USERNAME\", \"password\": \"$WRONG_PASSWORD$i\"}")
echo"Attempt $i: $response"# Check for lockout indicatorsifecho"$response" | grep -qi "locked\|blocked\|too many"; thenecho"Account locked after $i attempts"breakfidone# Try with correct password after lockoutecho"Trying correct password..."
curl -s -X POST "https://target.com/api/login" \
-H "Content-Type: application/json" \
-d "{\"username\": \"$USERNAME\", \"password\": \"correct_password\"}"
Step 3: Test CAPTCHA Trigger
# Test when CAPTCHA is triggered# Failed loginsfor i in {1..10}; do
response=$(curl -s -X POST "https://target.com/api/login" \
-H "Content-Type: application/json" \
-d '{"username": "test", "password": "wrong"}')
ifecho"$response" | grep -qi "captcha"; thenecho"CAPTCHA triggered after $i failed attempts"breakfidone# Rapid requestsfor i in {1..50}; do
response=$(curl -s "https://target.com/api/search?q=test$i")
ifecho"$response" | grep -qi "captcha\|verify"; thenecho"CAPTCHA triggered after $i requests"breakfidone
Step 4: Test IP-Based Blocking
#!/bin/bash# Test if IP blocking is implemented# Generate many failed login attemptsfor i in {1..50}; do
curl -s -X POST "https://target.com/api/login" \
-H "Content-Type: application/json" \
-d '{"username": "test", "password": "wrong"}' > /dev/null
done# Check if IP is blocked
response=$(curl -s -o /dev/null -w "%{http_code}""https://target.com/")
if [ "$response" == "403" ] || [ "$response" == "429" ]; thenecho"IP appears to be blocked"elseecho"IP not blocked - potential weakness"fi# Test with different user-agent
curl -s "https://target.com/" \
-H "User-Agent: Different Browser"# Test accessing from different path
curl -s "https://target.com/api/public"
# Test unusual access patterns# Rapid sequential page accessfor i in {1..100}; do
curl -s "https://target.com/product/$i" > /dev/null &
donewait# Non-human timing (no delays)
start=$(date +%s)
for i in {1..50}; do
curl -s "https://target.com/api/data" > /dev/null
done
end=$(date +%s)
echo"50 requests in $((end - start)) seconds"# Unusual access sequence (direct to deep pages)
curl -s "https://target.com/admin/settings" \
-H "Authorization: Bearer $TOKEN"
Step 7: Test Credential Stuffing Defense
#!/bin/bash# Test defense against credential stuffing# Simulate credential stuffing pattern# Multiple usernames with same password
passwords=("Password123""123456""qwerty")
for password in"${passwords[@]}"; dofor i in {1..20}; do
response=$(curl -s -X POST "https://target.com/api/login" \
-H "Content-Type: application/json" \
-d "{\"username\": \"user$i@test.com\", \"password\": \"$password\"}")
# Check for detectionifecho"$response" | grep -qi "blocked\|suspicious\|captcha"; thenecho"Credential stuffing detected after $(($i)) attempts"break 2
fidonedone
Tools
Rate Limit Testing
Tool
Description
Usage
wfuzz
Fuzzer
Rate limit testing
ffuf
Fast fuzzer
Parallel request testing
Custom scripts
Bash/Python
Automated testing
Bot Detection Testing
Tool
Description
Puppeteer
Headless Chrome automation
Selenium
Browser automation
Playwright
Cross-browser automation
Example Commands/Payloads
Abuse Defense Tester
#!/usr/bin/env python3import requests
import time
import statistics
from concurrent.futures import ThreadPoolExecutor
classAbuseTester:
def__init__(self, base_url):
self.base_url = base_url
self.results = {}
deftest_rate_limiting(self, endpoint, num_requests=100):
"""Test rate limiting on endpoint"""
blocked_at = Nonefor i inrange(num_requests):
response = requests.get(f"{self.base_url}{endpoint}")
if response.status_code == 429:
blocked_at = i + 1breakself.results["rate_limiting"] = {
"endpoint": endpoint,
"blocked_at": blocked_at,
"protected": blocked_at isnotNoneand blocked_at < num_requests
}
returnself.results["rate_limiting"]
deftest_lockout_policy(self, login_endpoint, username, max_attempts=20):
"""Test account lockout policy"""
locked_at = Nonefor i inrange(max_attempts):
response = requests.post(
f"{self.base_url}{login_endpoint}",
json={"username": username, "password": f"wrong_{i}"}
)
text = response.text.lower()
if"locked"in text or"blocked"in text or"too many"in text:
locked_at = i + 1breakself.results["lockout_policy"] = {
"locked_at": locked_at,
"protected": locked_at isnotNoneand locked_at <= 10
}
returnself.results["lockout_policy"]
deftest_captcha_trigger(self, endpoint, trigger_threshold=10):
"""Test when CAPTCHA is triggered"""
captcha_at = Nonefor i inrange(trigger_threshold * 2):
response = requests.get(f"{self.base_url}{endpoint}")
if"captcha"in response.text.lower():
captcha_at = i + 1breakself.results["captcha_trigger"] = {
"triggered_at": captcha_at,
"protected": captcha_at isnotNone
}
returnself.results["captcha_trigger"]
deftest_bot_detection(self, endpoint):
"""Test bot detection mechanisms"""
tests = [
{"name": "No User-Agent", "headers": {"User-Agent": ""}},
{"name": "Python UA", "headers": {"User-Agent": "python-requests/2.28"}},
{"name": "Curl UA", "headers": {"User-Agent": "curl/7.68.0"}},
{"name": "Headless Chrome", "headers": {"User-Agent": "HeadlessChrome/91"}},
{"name": "No Accept", "headers": {"Accept": ""}},
]
results = []
for test in tests:
response = requests.get(
f"{self.base_url}{endpoint}",
headers=test["headers"]
)
blocked = response.status_code in [403, 429]
results.append({
"test": test["name"],
"blocked": blocked,
"status": response.status_code
})
self.results["bot_detection"] = results
return results
deftest_parallel_requests(self, endpoint, num_requests=50):
"""Test defense against parallel requests"""defmake_request():
return requests.get(f"{self.base_url}{endpoint}").status_code
with ThreadPoolExecutor(max_workers=50) as executor:
results = list(executor.map(lambda _: make_request(), range(num_requests)))
blocked = sum(1for r in results if r == 429)
success = sum(1for r in results if r == 200)
self.results["parallel_requests"] = {
"total": num_requests,
"blocked": blocked,
"success": success,
"protected": blocked > 0
}
returnself.results["parallel_requests"]
defgenerate_report(self):
"""Generate comprehensive report"""print("\n=== APPLICATION ABUSE DEFENSE REPORT ===\n")
for test_name, result inself.results.items():
protected = result.get("protected", False)
status = "[PROTECTED]"if protected else"[WEAK]"print(f"{status}{test_name}")
ifisinstance(result, dict):
for key, value in result.items():
if key != "protected":
print(f" {key}: {value}")
elifisinstance(result, list):
for item in result:
print(f" {item}")
# Usage
tester = AbuseTester("https://target.com")
tester.test_rate_limiting("/api/search")
tester.test_lockout_policy("/api/login", "testuser")
tester.test_captcha_trigger("/api/search")
tester.test_bot_detection("/api/products")
tester.test_parallel_requests("/api/data")
tester.generate_report()
Remediation Guide
1. Implement Comprehensive Rate Limiting
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
limiter = Limiter(
app,
key_func=get_remote_address,
default_limits=["100 per minute"]
)
# Different limits for different endpoints@app.route('/api/login', methods=['POST'])@limiter.limit("5 per minute")deflogin():
pass@app.route('/api/password-reset', methods=['POST'])@limiter.limit("3 per hour")defpassword_reset():
pass@app.route('/api/search')@limiter.limit("30 per minute")defsearch():
pass