implementing-jwt-signing-and-verification
하는 일
이 도구는 JWT라는 보안 토큰을 만들고 확인하도록 돕습니다. 웹사이트와 앱에서 승인된 사람만 정보에 접근하도록 하여 해커로부터 보호하는 데 사용됩니다.
사용하는 경우
- ✓웹사이트나 애플리케이션의 보안을 설정할 때.
- ✓접근 토큰이 올바른지 확인할 때.
- ✓승인되지 않은 접근으로부터 민감한 데이터를 보호하는 경우.
스킬 링크
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-jwt-signing-and-verification/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 JWT 토큰이 안전하고 변조되지 않았는지 검증해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 도구는 토큰이 만들어질 때 암호화 방법으로 서명해 진위를 보장합니다. 토큰을 받으면 같은 암호화 방법으로 유효하고 변경되지 않았는지 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Implementing JWT Signing and Verification
Overview
JSON Web Tokens (JWT) defined in RFC 7519 are compact, URL-safe tokens used for authentication and authorization in web applications. This skill covers implementing secure JWT signing with HMAC-SHA256, RSA-PSS, and EdDSA algorithms, along with verification, token expiration, claims validation, and defense against common JWT attacks (algorithm confusion, none algorithm, key injection).
When to Use
- When deploying or configuring implementing jwt signing and verification capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- Familiarity with cryptography concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Objectives
- Implement JWT signing with HS256, RS256, ES256, and EdDSA
- Verify JWT signatures and validate standard claims
- Implement token expiration, not-before, and audience validation
- Defend against algorithm confusion and none algorithm attacks
- Implement JWT key rotation with JWK Sets
- Build a complete authentication middleware
Key Concepts
JWT Algorithms
| Algorithm | Type | Key | Security Level |
|---|---|---|---|
| HS256 | Symmetric (HMAC) | Shared secret | 128-bit |
| RS256 | Asymmetric (RSA) | RSA key pair | 112-bit |
| ES256 | Asymmetric (ECDSA) | P-256 key pair | 128-bit |
| EdDSA | Asymmetric (Ed25519) | Ed25519 pair | 128-bit |
Common JWT Attacks
- Algorithm confusion: Switching from RS256 to HS256, using public key as HMAC secret
- None algorithm: Setting alg=none to bypass signature verification
- Key injection: Embedding key in JWK header
- Weak secrets: Brute-forcing short HMAC secrets
- Token replay: Reusing valid tokens without expiration
Security Considerations
- Always validate the algorithm header against an allowlist
- Never accept alg=none in production
- Use asymmetric algorithms (RS256, ES256) for distributed systems
- Set short expiration times (15 min for access tokens)
- Implement token refresh mechanism
- Store secrets securely (not in source code)
Validation Criteria
- JWT signing produces valid tokens for all algorithms
- Signature verification rejects tampered tokens
- Expired tokens are rejected
- Algorithm confusion attack is prevented
- None algorithm is rejected
- JWK key rotation works correctly
- Claims validation enforces all required claims
자주 묻는 질문
JWT란 무엇인가요?
JSON Web Token의 약자입니다. 안전하고 간결한 방식으로 웹사이트나 앱에 사용자가 누구인지 증명하는 디지털 신분증과 같습니다.
HS256, RS256 같은 다른 알고리즘을 쓰는 이유는 무엇인가요?
각 알고리즘은 서명과 검증에 서로 다른 종류의 비밀 키를 사용합니다. 어떤 것은 공유 비밀 키(HS256)를 사용하고, 다른 것은 더 강한 보안을 위해 키 쌍(공개 키와 개인 키)을 사용합니다(RS256, ES256, EdDSA).
‘알고리즘 혼동’이나 ‘none 알고리즘’ 공격은 무엇인가요?
해커가 시스템을 속이려는 시도입니다. 예를 들어 실제로는 안전한 방식으로 서명되지 않은 토큰을 안전하다고 믿게 하거나, 서명 없이 토큰을 보내 보안을 우회하려는 것입니다.
상세 정보
작성자의 원본 설명
Implements secure JWT (RFC 7519) signing and verification using HMAC-SHA256, RSA-PSS, ES256, and EdDSA, including token expiration, claims validation, and defenses against algorithm-confusion, none-algorithm, and key-injection attacks. Use when adding or hardening JWT-based authentication/authorization, or when auditing token verification code for common JWT vulnerabilities.
인기도
- GitHub 스타
- 35k
- 순위
- #8065
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 8. 31.
댓글
- …
이 저장소의 다른 스킬
abusing-dpapi-for-credential-access
35kAI 에이전트에게 특정 작업을 위한 준비된 지침을 제공해, 더 잘하고 더 빠르게 처리하도록 합니다.
abusing-shadow-credentials-for-privesc
35kAI 에이전트가 명확하고 잘 구성된 텍스트를 쓰도록 가르칩니다.
achieving-cmmc-level-2-compliance
35kCMMC Level 2 규정 준수를 위한 환경을 준비하도록 돕습니다. 보안 요구 사항을 구현하고 필요한 문서를 관리합니다.
acquiring-disk-image-with-dd-and-dcfldd
35k에이전트가 하드 드라이브의 정확한 복사본을 만들도록 돕습니다. 조사 중 정보가 손실되거나 변경되지 않도록 하는 데 유용합니다.