Zum Inhalt springen
Skillpedia
Sicherheit35k · #8065

implementing-jwt-signing-and-verification

Was er macht

Dieses Tool hilft dir, Sicherheits-Tokens namens JWTs zu erstellen und zu prüfen. Sie stellen sicher, dass nur berechtigte Personen auf Informationen in Websites und Apps zugreifen können, und schützen so vor Hackern.

Wann du ihn nutzt

  • ✓Wenn du die Sicherheit für eine Website oder Anwendung einrichtest.
  • ✓Wenn du prüfst, ob Zugriffs-Tokens korrekt sind.
  • ✓Wenn du sensible Daten vor unbefugtem Zugriff schützt.

Link zum Skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-jwt-signing-and-verification/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-jwt-signing-and-verification/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Prüfe dieses JWT-Token, ob es sicher ist und nicht manipuliert wurde.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Das Tool signiert Tokens beim Erstellen mit kryptografischen Verfahren und sichert so ihre Echtheit. Wenn ein Token empfangen wird, prüft das Tool mit derselben Kryptografie, ob es gültig ist und nicht verändert wurde.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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
Häufige Fragen

Was ist ein JWT?

JWT steht für JSON Web Token. Es ist wie ein digitaler Ausweis, der einer Website oder App auf sichere und kompakte Weise zeigt, wer du bist.

Warum gibt es verschiedene Algorithmen wie HS256 oder RS256?

Jeder Algorithmus verwendet eine andere Art von geheimem 'Schlüssel', um Tokens zu signieren und zu prüfen. Manche nutzen einen gemeinsamen geheimen Schlüssel (HS256), andere ein Schlüsselpaar aus öffentlichem und privatem Schlüssel für mehr Sicherheit in größeren Systemen (RS256, ES256, EdDSA).

Was sind Angriffe wie 'Algorithm Confusion' oder der 'None-Algorithmus'?

Das sind Versuche von Hackern, das System zu täuschen. Zum Beispiel soll ein Token so wirken, als wäre es mit einer sicheren Methode signiert, obwohl das nicht stimmt. Oder es wird ein Token ohne Signatur geschickt, um die Sicherheitsprüfung zu umgehen.

Details

Originalbeschreibung des Autors

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.

repo: mukul975/Anthropic-Cybersecurity-Skills

Beliebtheit

GitHub-Sterne
35k
Platz im Ranking
#8065
Lizenz
Apache-2.0
Aktualisiert
31.8.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills