appsec.fyi

JWT — A Practical Guide

A curated AppSec resource library covering XSS, SQLi, SSRF, IDOR, RCE, XXE, OSINT, and more.

JWT: A Practical Guide

Curated and synthesized by . Last updated 2026-08-16. Synthesized from 108 of 108 curated resources. Browse all 108 JWT resources →

Understanding JWTs

JSON Web Tokens (JWTs) are a standardized, compact, and self-contained method for securely transmitting information between parties as a JSON object [1]. They are commonly used in modern web development for authentication and authorization, particularly in stateless architectures like APIs and microservices [1][2]. Unlike traditional session-based authentication that relies on server-side state, JWTs carry user information and permissions directly within the token, which is typically sent in the HTTP Authorization header as a Bearer token [3][2].

A JWT is composed of three parts, separated by dots (.): a header, a payload, and a signature. Each part is Base64Url-encoded [4].

The signature is the critical security component. Without a valid signature, the token's claims cannot be trusted [5]. Various attacks exploit weaknesses in signature validation or the underlying cryptographic algorithms [7][8].

Core Mechanics and Security Implications

The fundamental security of a JWT relies on the integrity of its signature, which is generated using a specific algorithm and a secret or private key [1]. The server validates the JWT by recomputing the signature over the header and payload using its known key and comparing it to the signature provided in the token [5]. If the signature matches, the token is considered valid and untampered.

However, flaws in how JWTs are implemented and validated can introduce significant security risks:

Notable Techniques and Attack Vectors

Numerous techniques exploit JWT weaknesses, often targeting signature validation and algorithm handling. Many of these can be performed offline with specialized tools.

Signature Bypass and Tampering

Algorithm Confusion

Key Confusion and Injection

Other Vulnerabilities

Detection and Prevention

Securing JWT implementations requires a multi-layered approach, focusing on robust validation, secure key management, and adherence to best practices.

Signature Validation and Algorithm Enforcement

Key Management

Token Lifecycle and Claim Validation

Secure Transmission and Storage

Tooling

A variety of tools can assist in identifying and exploiting JWT vulnerabilities:

Recent Developments

The JWT ecosystem continues to evolve, with new vulnerabilities and attack vectors being discovered. Recent CVEs in 2025 and 2026 highlight ongoing issues with algorithm confusion in various JWT libraries and frameworks across different programming languages [14][54]. For instance, CVE-2026-22817 affected Hono for trusting the alg header [12][14], and CVE-2026-23993 impacted HarbourJwt with an unknown algorithm bypass [46][14]. Vulnerabilities related to improper validation of header parameters like kid and jku also remain prevalent [29][25][26]. The IETF continues to update best practices, such as in draft-ietf-oauth-rfc8725bis, reflecting new threats discovered since RFC 8725 [8][68]. Awareness of these evolving threats and library updates is critical for maintaining secure JWT implementations.

Where to Go Deeper

For a comprehensive understanding of JWT security and exploitation, explore the following resources:

Sources cited in this guide

  1. Can Snyk Detect JWT Security Issues? — snyk.io
  2. JWT Security Guide: Best Practices & Implementation (Gupta Deepak) — guptadeepak.com
  3. Insecure JSON Web Tokens (The Hacker Recipes) — thehacker.recipes
  4. JSON Web Token Attacks and Vulnerabilities — Acunetix — acunetix.com
  5. I made a full JWT hacking tutorial + testing suite — hakluke.com
  6. JWT Security Best Practices (Phase Two) — phasetwo.io
  7. Revisiting JWT Token Forgery Attack on Recent Bounty Target — infosecwriteups.com
  8. draft-ietf-oauth-rfc8725bis: JSON Web Token Best Current Practices — datatracker.ietf.org
  9. Detecting JWT Security Issues — snyk.io
  10. Two Ways To Mess Up Your JWT Safety Net In Your Own Lab. — infosecwriteups.com
  11. The Ultimate Guide to JWT Vulnerabilities and Attacks — pentesterlab.com
  12. CVE-2026-22817: JWT Algorithm Confusion in Hono — dev.to
  13. JWT authentication bypass via algorithm confusion (siunam) — siunam321.github.io
  14. JWT Algorithm Confusion Attack: Two Active CVEs in 2026 — tools.pinusx.com
  15. WorkOS: JWT algorithm confusion attacks explained — workos.com
  16. Algorithm confusion attacks | Web Security Academy — portswigger.net
  17. How JWT Libraries Block Algorithm Confusion: Code Review Lessons — pentesterlab.com
  18. JWT Algorithm Confusion: Turning RS256 Tokens into HS256 Disasters — medium.com
  19. Known Exploits and Attacks (jwt_tool Wiki) — github.com
  20. PortSwigger KB: JWT none algorithm supported — portswigger.net
  21. Brute Forcing HS256 is Possible — auth0.com
  22. Vaadata: JWT vulnerabilities, common attacks and security best practices — vaadata.com
  23. brendan-rius/c-jwt-cracker: JWT brute-force cracker in C — github.com
  24. JWT authentication bypass via kid header path traversal (siunam) — siunam321.github.io
  25. JWT Signature Bypass via kid Path Traversal — invicti.com
  26. JWT Signature Bypass via kid SQL injection — invicti.com
  27. tuhin1729 Bug Bounty Methodology: JWT — github.com
  28. JWT Forgery via unvalidated jku parameter (Invicti) — invicti.com
  29. JWT Signature Bypass via unvalidated jku parameter — invicti.com
  30. Lab: JWT authentication bypass via jku header injection — portswigger.net
  31. KathanP19/HowToHunt: JWT — github.com
  32. Top 3 security best practices for handling JWTs — snyk.io
  33. JWT Token Lifecycle: Expiration, Refresh, and Revocation — skycloak.io
  34. JWT Security Best Practices for 2025 (JWT.app) — jwt.app
  35. JWT (Json Web Token) Audience aud versus Client_Id - What's the difference? — stackoverflow.com
  36. Intigriti: Exploiting JWT vulnerabilities — advanced exploitation guide — intigriti.com
  37. OWASP WSTG: Testing JSON Web Tokens — owasp.org
  38. PayloadsAllTheThings: JSON Web Token — github.com
  39. Cracking JWT Keys - Authentication Lab — authlab.digi.ninja
  40. Hacker Tools: JWT_Tool — intigriti.com
  41. ticarpi/jwt_tool: A toolkit for testing, tweaking and cracking JSON Web Tokens — github.com
  42. JWT attacks | Web Security Academy — portswigger.net
  43. dr34mhacks/jwtauditor: JWT Auditor – Analyze, break, and understand your tokens like a pro. — github.com
  44. Python-JOSE Security Risk: CVE-2024-33663 Explained — ethicalhacking.uk
  45. PentesterLab: Another JWT Algorithm Confusion Vulnerability (CVE-2024-54150) — pentesterlab.com
  46. CVE-2026-23993: JWT Authentication Bypass in HarbourJwt via Unknown alg — pentesterlab.com
  47. PortSwigger jwt-editor: Burp Suite extension for editing and signing JWTs — github.com
  48. Proof of Concept for CVE-2026-29000 (pac4j-jwt) — github.com
  49. CVE-2026-29000: Authentication Bypass in pac4j-jwt — arcticwolf.com
  50. HackerOne: Critical vulnerability in JWE Specification — hackerone.com
  51. Understanding JWT Security and Common Vulnerabilities (secops) — secops.group
  52. HackerOne: Argo CD JWT audience claim not verified — hackerone.com
  53. Curity: JWT Security Best Practices — curity.io
  54. JWT Algorithm Confusion Attacks: CVE-2026-22817 Fix Guide — dev.to
  55. RFC 8725: JSON Web Token Best Current Practices — ietf.org
  56. CVE-2024-33663: Python-jose Algorithm Confusion — sentinelone.com
  57. CVE-2025-45768: PyJWT Information Disclosure Vulnerability — sentinelone.com
  58. These are the security issues with JWT — scip.ch
  59. JWTweak v2.1: A Guided, Offline Toolkit for Modern JWT Attacks — infosecwriteups.com
  60. HackTricks: JWT vulnerabilities — book.hacktricks.xyz
  61. jwt_tool Attack Methodology wiki — github.com
  62. jwt-hack: JSON Web Token Hack Toolkit (GitHub) — github.com
  63. DontPanicO/jwtXploiter: A tool to test the security of JSON Web Tokens — github.com
  64. mazen160/jwt-pwn: Security testing scripts for JWT — github.com
  65. Working with JWTs in Burp Suite — portswigger.net
  66. JSON Web Token Attacker Burp extension — portswigger.net
  67. JWT Scanner Burp extension — portswigger.net
  68. RFC 8725 - JSON Web Token Best Current Practices — datatracker.ietf.org
  69. JWT Pentest Checklist (Cyber Frogy) — chintangurjar.com
  70. JWT Pentest Checklist v1.0 (Chintan Gurjar) — chintangurjar.com
📚 This guide is synthesized from the full text of resources curated in the JWT library, and refreshed as new material is added.