implementing-jwt-signing-and-verification
यह क्या करती है
यह टूल JWT नाम के सिक्योरिटी टोकन बनाने और जांचने में मदद करता है। इनका इस्तेमाल यह सुनिश्चित करने के लिए होता है कि वेबसाइट और ऐप की जानकारी सिर्फ़ अधिकृत लोग ही देख सकें, और इससे हैकर्स से बचाव होता है।
कब इस्तेमाल करें
- ✓किसी वेबसाइट या ऐप की सिक्योरिटी सेट करते समय।
- ✓यह जांचते समय कि एक्सेस टोकन सही हैं या नहीं।
- ✓संवेदनशील डेटा को बिना अनुमति के एक्सेस से बचाते समय।
Skill का लिंक
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-jwt-signing-and-verification/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस JWT टोकन को वेरिफ़ाई करो और देखो कि यह सुरक्षित है और इसमें छेड़छाड़ नहीं हुई है।”
हर हफ़्ते 5 नई skills, 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 क्या है?
JWT का पूरा नाम JSON Web Token है। यह एक डिजिटल पहचान पत्र की तरह है जो सुरक्षित और छोटे रूप में बताता है कि आप कौन हैं, किसी वेबसाइट या ऐप को।
HS256, RS256 जैसे अलग-अलग एल्गोरिदम क्यों इस्तेमाल होते हैं?
हर एल्गोरिदम टोकन पर साइन करने और उसे वेरिफ़ाई करने के लिए अलग तरह की 'key' इस्तेमाल करता है। कुछ एक साझा गुप्त key (HS256) इस्तेमाल करते हैं, जबकि बड़े सिस्टम में ज़्यादा सुरक्षा के लिए key pair (एक public और एक private) इस्तेमाल होती है (RS256, ES256, EdDSA)।
'algorithm confusion' या 'none algorithm' जैसे हमले क्या हैं?
ये हैकर्स की वे कोशिशें हैं जिनसे सिस्टम को धोखा दिया जाता है। जैसे सिस्टम को यह यकीन दिलाना कि टोकन किसी सुरक्षित तरीके से साइन हुआ है, जबकि ऐसा नहीं था, या बिना सिग्नेचर वाला टोकन भेजकर सुरक्षा को पार करने की कोशिश करना।
जानकारी
लेखक का मूल विवरण
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
- अपडेट की गई
- 31/8/2026
कमेंट
- …
इस repository की और skills
abusing-dpapi-for-credential-access
35kआपके AI एजेंट को किसी खास काम के लिए तैयार instructions देता है, ताकि वह उसे बेहतर और तेज़ी से कर सके।
abusing-shadow-credentials-for-privesc
35kआपके AI एजेंट को साफ़ और अच्छी तरह से व्यवस्थित लिखना सिखाता है।
achieving-cmmc-level-2-compliance
35kयह आपके एजेंट को CMMC Level 2 compliance के लिए environment तैयार करने में मदद करता है। यह security requirements लागू करता है और ज़रूरी documentation संभालता है।
acquiring-disk-image-with-dd-and-dcfldd
35kआपके एजेंट को hard drives की exact copies बनाने में मदद करता है। जाँच के दौरान किसी भी जानकारी के खोने या बदलने से बचाने के लिए यह उपयोगी है।
मिलती-जुलती skills
reverse-engineer-anything
422kयह आपके एजेंट को REA टूल से शिप हुई ऐप्स और पैकेज को अंदर से समझने, वर्ज़न की तुलना करने या दोबारा बनाने में मदद करती है।
1password
394kयह आपके एजेंट को 1Password CLI सेट करने, साइन इन करने और सीक्रेट्स की वैल्यू चैट में छापे बिना उन्हें पढ़ने या इस्तेमाल करने में मदद करती है।
healthcheck
394kयह आपके एजेंट को उस कंप्यूटर या सर्वर का सुरक्षा ऑडिट करने देती है जिस पर OpenClaw चलता है, जिसमें SSH, firewall, अपडेट और बैकअप शामिल हैं, और फिर सुरक्षित सुधार सुझाती है।