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-01. Synthesized from 109 of 109 curated resources. Browse all 109 JWT resources →

Understanding the JWT Landscape

JSON Web Tokens (JWTs) have become a ubiquitous standard for securely transmitting information between parties, particularly in authentication and authorization contexts within modern web applications and APIs [1][2][3][4][5]. They offer a stateless approach to session management, allowing servers to verify user identity and permissions without maintaining server-side session state [1][5][6]. A JWT is structured into three parts: a header, a payload, and a signature, all Base64URL-encoded and separated by dots [7][1][2][8][9][4][6].

The header typically contains metadata like the token type (typ) and the signing algorithm (alg) [7][2][8][9][4]. The payload, or claims set, holds statements about an entity (usually the user) and other arbitrary data [7][1][2][8][9][4]. Importantly, JWTs are generally not encrypted, meaning sensitive data stored in the payload can be viewed by anyone possessing the token [1][10][5]. The signature's role is to ensure the integrity and authenticity of the token, by cryptographically verifying that the header and payload have not been tampered with since issuance [7][1][2][8][9][5]. This verification process is critical for secure JWT implementation [11][12][13][9][3][14].

Despite their benefits, JWTs are susceptible to various vulnerabilities if not implemented and managed correctly. These vulnerabilities often stem from improper validation of tokens, weak cryptographic practices, insecure storage, and poor secret management [11][15][9][16][17].

Core Mechanics and Structure

A JWT is fundamentally a string composed of three Base64URL-encoded parts separated by dots: HEADER.PAYLOAD.SIGNATURE.

Header

The header is a JSON object typically containing:

Payload

The payload contains claims, which are statements about the entity (typically the user) and other metadata. These can be registered claims (like iss, sub, exp, aud, iat, nbf, jti), public claims, or private claims [7][1][2][8][9][4][5][6].

It's crucial to avoid storing sensitive or confidential data in the payload as JWTs are generally readable [1][10][5][32].

Signature

The signature is generated by combining the Base64URL-encoded header and payload with a secret (for symmetric algorithms like HS256) or a private key (for asymmetric algorithms like RS256), and then applying the algorithm specified in the header [7][1][2][8][9][5]. This signature is appended to the token. A server verifying the token must recalculate the signature using the appropriate key and algorithm and compare it against the provided signature [7][11][12][9][4][5][14][33][6]. Failure to verify the signature or using weak secrets can lead to critical vulnerabilities [11][2][16][34][17][35][5].

Notable Attack Vectors

The flexibility of JWTs, while advantageous, also introduces numerous attack vectors if implementations are not robust. Many attacks exploit flaws in how libraries or applications validate JWTs, particularly concerning the alg header and signature verification [12][36][37][9][16][38][39][40][41][33][42][25][26].

Signature Verification Bypasses

Algorithm Confusion Attacks

These attacks exploit implementations that dynamically select the verification algorithm based on the alg header value from the token itself, rather than enforcing a predefined, trusted algorithm [50][51][37][52][48][53][41][25][26].

Key Management and Injection Vulnerabilities

These attacks target how signing keys are managed, retrieved, or protected.

Other Vulnerabilities

Detection and Prevention Strategies

Securing JWT implementations requires a multi-layered approach focusing on secure library usage, strict validation, robust key management, and secure transmission/storage.

Secure Implementation Practices

Detection Strategies

Tooling for JWT Security

A variety of tools are available to assist in the analysis, exploitation, and auditing of JWT implementations.

Recent Developments and Emerging Threats

The landscape of JWT vulnerabilities is constantly evolving, with new CVEs and attack techniques being discovered regularly. Recent research highlights ongoing issues in popular libraries and frameworks, emphasizing the need for continuous vigilance.

Staying informed about the latest CVEs and best practices, as outlined in documents like RFC 8725bis [12][85][33], is critical for maintaining secure JWT implementations.

Where to Go Deeper

To further enhance understanding and practical skills in JWT security, consult the following resources:

Sources cited in this guide

  1. Can Snyk Detect JWT Security Issues? — snyk.io
  2. JSON Web Token Attacks and Vulnerabilities — Acunetix — acunetix.com
  3. JWT Security in 2025: Critical Vulnerabilities for B2B SaaS — securityboulevard.com
  4. Detecting JWT Security Issues — snyk.io
  5. Vaadata: JWT vulnerabilities, common attacks and security best practices — vaadata.com
  6. KathanP19/HowToHunt: JWT — github.com
  7. Two Ways To Mess Up Your JWT Safety Net In Your Own Lab. — infosecwriteups.com
  8. JWT Security Guide: Best Practices & Implementation (Gupta Deepak) — guptadeepak.com
  9. Understanding JWT Security and Common Vulnerabilities (secops) — secops.group
  10. JWT Security Best Practices (Phase Two) — phasetwo.io
  11. Top 3 security best practices for handling JWTs — snyk.io
  12. draft-ietf-oauth-rfc8725bis: JSON Web Token Best Current Practices — datatracker.ietf.org
  13. JWT Security Best Practices for 2025 (JWT.app) — jwt.app
  14. Curity: JWT Security Best Practices — curity.io
  15. Analyzing Broken User Authentication Threats to JWTs — Akamai — akamai.com
  16. JWT Vulnerabilities List: 2026 Security Risks & Mitigation Guide (Red Sentry) — redsentry.com
  17. Top 3 security best practices for handling JWTs — snyk.io
  18. JWT authentication bypass via kid header path traversal (siunam) — siunam321.github.io
  19. JWT Header Parameter Injections — medium.com
  20. JWT Signature Bypass via kid Path Traversal — invicti.com
  21. tuhin1729 Bug Bounty Methodology: JWT — github.com
  22. JWT Forgery via unvalidated jku parameter (Invicti) — invicti.com
  23. JWT Signature Bypass via unvalidated jku parameter — invicti.com
  24. Lab: JWT authentication bypass via jku header injection — portswigger.net
  25. Algorithm confusion attacks | Web Security Academy — portswigger.net
  26. JWT attacks | Web Security Academy — portswigger.net
  27. CVE-2024-53861: PyJWT Issuer Field Partial Match — vulert.com
  28. JWT Token Lifecycle: Expiration, Refresh, and Revocation — skycloak.io
  29. HackerOne: Argo CD JWT audience claim not verified — hackerone.com
  30. Golang JWT access restriction bypass vulnerability — snyk.io
  31. JWT (Json Web Token) Audience aud versus Client_Id - What's the difference? — stackoverflow.com
  32. These are the security issues with JWT — scip.ch
  33. RFC 8725: JSON Web Token Best Current Practices — ietf.org
  34. Brute Forcing HS256 is Possible — auth0.com
  35. Lab: JWT authentication bypass via weak signing key — portswigger.net
  36. Known Exploits and Attacks (jwt_tool Wiki) — github.com
  37. JWT Algorithm Confusion Attack: Two Active CVEs in 2026 — tools.pinusx.com
  38. The Ultimate Guide to JWT Vulnerabilities and Attacks — pentesterlab.com
  39. Attacking JWT authentication — sjoerdlangkemper.nl
  40. Intigriti: Exploiting JWT vulnerabilities — advanced exploitation guide — intigriti.com
  41. WorkOS: JWT algorithm confusion attacks explained — workos.com
  42. OWASP WSTG: Testing JSON Web Tokens — owasp.org
  43. PortSwigger KB: JWT none algorithm supported — portswigger.net
  44. PayloadsAllTheThings: JSON Web Token — github.com
  45. jwt_tool Attack Methodology wiki — github.com
  46. Insecure JSON Web Tokens (The Hacker Recipes) — thehacker.recipes
  47. JWT Authentication Bypass Using alg:none - CTF Writeup — medium.com
  48. JWT Algorithm Confusion Attacks: CVE-2026-22817 Fix Guide — dev.to
  49. ticarpi/jwt_tool: A toolkit for testing, tweaking and cracking JSON Web Tokens — github.com
  50. CVE-2026-22817: JWT Algorithm Confusion in Hono — dev.to
  51. JWT authentication bypass via algorithm confusion (siunam) — siunam321.github.io
  52. JWT Algorithm Confusion: Turning RS256 Tokens into HS256 Disasters — medium.com
  53. CVE-2024-33663: Python-jose Algorithm Confusion — sentinelone.com
  54. How JWT Libraries Block Algorithm Confusion: Code Review Lessons — pentesterlab.com
  55. CVE-2026-32597: PyJWT Information Disclosure Vulnerability — sentinelone.com
  56. CVE-2026-23993: JWT Authentication Bypass in HarbourJwt via Unknown alg — pentesterlab.com
  57. Cracking JWT Keys - Authentication Lab — authlab.digi.ninja
  58. brendan-rius/c-jwt-cracker: JWT brute-force cracker in C — github.com
  59. mazen160/jwt-pwn: Security testing scripts for JWT — github.com
  60. dr34mhacks/jwtauditor: JWT Auditor – Analyze, break, and understand your tokens like a pro. — github.com
  61. JSON Web Token Vulnerabilities (0xn3va cheat sheet) — 0xn3va.gitbook.io
  62. JWT Signature Bypass via kid SQL injection — invicti.com
  63. DontPanicO/jwtXploiter: A tool to test the security of JSON Web Tokens — github.com
  64. Authlib Critical JWT Forgery (CVE-2026-27962) — thehackerwire.com
  65. JWT Bomb in Python-JOSE CVE-2024-33664 — vicarius.io
  66. Proof of Concept for CVE-2026-29000 (pac4j-jwt) — github.com
  67. CVE-2026-29000: pac4j-jwt Authentication Bypass — penligent.ai
  68. CVE-2026-29000: Authentication Bypass in pac4j-jwt — arcticwolf.com
  69. Severe Security Flaw Found in jsonwebtoken Library — thehackernews.com
  70. Where to Store the JSON Web Token (JWT)? — medium.com
  71. JWTweak v2.1: A Guided, Offline Toolkit for Modern JWT Attacks — infosecwriteups.com
  72. CVE-2026-34950 fast-jwt: Incomplete Fix for CVE-2023-48223 — endorlabs.com
  73. python-jwt token forgery CVE-2022-39227 — github.com
  74. Python-JOSE Security Risk: CVE-2024-33663 Explained — ethicalhacking.uk
  75. Auth0: Critical vulnerabilities in JSON Web Token libraries — auth0.com
  76. JWT Pentest Book (six2dez) — pentestbook.six2dez.com
  77. jwt-hack: JSON Web Token Hack Toolkit (GitHub) — github.com
  78. Hacker Tools: JWT_Tool — intigriti.com
  79. Working with JWTs in Burp Suite — portswigger.net
  80. JSON Web Token Attacker Burp extension — portswigger.net
  81. JWT Scanner Burp extension — portswigger.net
  82. PortSwigger jwt-editor: Burp Suite extension for editing and signing JWTs — github.com
  83. A Practical Guide to Attacking JWT — redhuntlabs.com
  84. HackTricks: JWT vulnerabilities — book.hacktricks.xyz
  85. RFC 8725 - JSON Web Token Best Current Practices — datatracker.ietf.org
  86. PentesterLab: Another JWT Algorithm Confusion Vulnerability (CVE-2024-54150) — pentesterlab.com
  87. November CTF Challenge: Exploiting JWT vulnerabilities to achieve RCE — intigriti.com
  88. JWT vs PASETO: New Era of Token-Based Authentication — medium.com
  89. All About Attacking JWT — medium.com
  90. JSON Web Tokens Vulnerabilities and Exploitation. — dk9510.medium.com
  91. JWT [JSON WEB TOKENS] [EXPLANATION & EXPLOITATION] (0x02) — medium.com
  92. ctf-jwt-token: Vulnerability in early JWT node.js library (GitHub) — github.com
📚 This guide is synthesized from the full text of resources curated in the JWT library, and refreshed as new material is added.