# What is JSON Web Token Best Current Practices?

> RFC 8725 is the IETF's rulebook for checking JSON Web Tokens safely. It tells token libraries and applications what to check before trusting a token: the algorithm, every signature, the issuer's keys, the audience and the token's kind.

Explainer by Boston Identity, 2026-10-23. 7 min read. https://insights.bostonidentity.com/glossary/rfc8725

- What it is: practice
- Defined by: IETF, RFC 8725 (BCP 225), 2020
- Who it's for: Teams that issue or accept JWTs

## What is JSON Web Token Best Current Practices?

A JSON Web Token (JWT) is a compact security token that carries a set of claims and can be signed, encrypted or both [S1 §1]. One common use is digital identity: OpenID Connect ID tokens and OAuth (Open Authorization) 2.0 access and refresh tokens are often JWTs [S1 §1]. RFC 8725 is a Best Current Practice (BCP 225) from the Internet Engineering Task Force (IETF), published in February 2020, and it updates RFC 7519, the JWT standard [S1].

The authors wrote it because attacks on JWT implementations and deployments kept being published after RFC 7519 came out. They trace those attacks to under-specified security mechanisms, incomplete implementations and applications using JWTs incorrectly [S1 §1]. Section 2 lists nine threats, and section 3 gives twelve practices that answer them [S1 §2] [S1 §3].

The RFC is written for three groups: people who build JWT libraries, people who write code that uses those libraries, and people who write specifications that rely on JWTs [S1 §1.1]. It calls its rules a floor, not a ceiling. It also calls itself a point-in-time statement and tells readers to look for errata and updates [S1 §1].

Think of it like this: Think of a border officer with a passport. The officer decides in advance which passport types are accepted, checks that the stamp is genuine, checks that the issuing country matches the cover, and checks that the visa is for this country and not the next one. The comparison stops at discretion: an officer can make an exception at the desk, while RFC 8725 wants the application to set the accepted algorithms before any token arrives [S1 §3.1].

Not the same as: RFC 8725 is guidance, not a new token format or protocol. It tells implementers how to use the mechanisms and claims that RFC 7519, JSON Web Signature (JWS) and JSON Web Encryption (JWE) already define [S1 §1].

## How does JSON Web Token Best Current Practices work?

We list the checks in the order a recipient meets them; the RFC numbers them as separate practices [S1 §3]. The actors are the issuer that signs the token, the JWT library that does the cryptography, and the application that calls the library and decides whether to trust the result.

[Figure: The checks RFC 8725 asks a JWT recipient to run, in the order the token meets them.]

1. **The application fixes the allowed algorithms.** Before any token arrives, the application tells the library which algorithms it supports. Libraries must make that possible and must not use any other algorithm [S1 §3.1]. The "alg" or "enc" header must name the algorithm actually used. Each key must be used with exactly one algorithm, and the library must check this when it runs the operation [S1 §3.1]. Libraries should not accept tokens marked "none" unless the caller explicitly asks [S1 §3.2].
2. **The application finds the key without trusting the header.** The "kid" (key ID) header tells the application which key to look up. Applications should validate or sanitise that value so the lookup cannot become SQL or LDAP (Lightweight Directory Access Protocol) injection [S1 §3.10]. A "jku" or "x5u" header holds a URL, and blindly following it can lead to server-side request forgery (SSRF). Applications should guard against that, for example by matching the URL to a list of allowed locations and sending no cookies with the request [S1 §3.10].
3. **The library validates every cryptographic operation.** Every signature and decryption in the token must be validated, and the whole token must be rejected if any one fails [S1 §3.3]. In a Nested JWT, such as a signed token inside an encrypted one, both the outer and inner layers must be checked with keys and algorithms the application supplies [S1 §3.3]. Inputs to elliptic curve key agreement, such as curve points, must be validated too, by the token library or the cryptographic library beneath it [S1 §3.4].
4. **The application ties the keys to the issuer.** When the token has an "iss" (issuer) claim, the application must confirm that the signing keys belong to that issuer. If they do not, it must reject the token [S1 §3.8]. How to find an issuer's keys is up to the application. In OpenID Connect, the issuer URL leads to a metadata document whose "jwks_uri" value points to the issuer's published keys [S1 §3.8]. When there is a "sub" (subject) claim, the application must check that it names a valid subject, or a valid issuer-subject pair, and reject the token if not [S1 §3.8].
5. **The application checks the audience.** Some issuers issue JWTs for more than one relying party, the application that accepts the token. Then the token must carry an "aud" (audience) claim [S1 §3.9]. Each relying party must reject a token whose audience is missing or is not its own [S1 §3.9]. This check answers substitution: a service that legitimately received a token presents it to a different service it was not meant for [S1 §2.7].
6. **The application checks the token is the right kind.** When one issuer issues more than one kind of JWT, the validation rules for each kind must be mutually exclusive, so a token of the wrong kind fails [S1 §3.12]. The RFC lists ways to get there: distinct "typ" values, different required claims or headers, different keys, different audiences or different issuers [S1 §3.12]. Explicit typing with the "typ" header is recommended for new uses of JWTs [S1 §3.11].

## Why does JSON Web Token Best Current Practices matter now?

RFC 8725 hardened advice that RFC 7519 had left soft. RFC 7519 made “none” mandatory to implement and left refusing an unwanted algorithm to the application, as a SHOULD [BI-FIND-2015-0012](https://insights.bostonidentity.com/ref/BI-FIND-2015-0012). Under RFC 8725, the caller names the supported algorithms, the library must use no other, and each key must be used with exactly one algorithm [BI-FIND-2020-0011](https://insights.bostonidentity.com/ref/BI-FIND-2020-0011). Those rules answer attacks the RFC cites. In one, a header switched to “none” was accepted by some libraries without any signature check. In another, an RS256 token relabelled HS256 was verified by some libraries with the RSA public key as the shared secret [BI-FIND-2020-0011](https://insights.bostonidentity.com/ref/BI-FIND-2020-0011).

Some of its rules stay soft. The RFC still allows “none” when other means such as TLS (Transport Layer Security) protect the token; libraries only SHOULD NOT accept it unless the caller asks [BI-FIND-2020-0011](https://insights.bostonidentity.com/ref/BI-FIND-2020-0011). Explicit typing is a recommendation, and the authors concede it may not tell a new kind of JWT from existing kinds [BI-FIND-2020-0013](https://insights.bostonidentity.com/ref/BI-FIND-2020-0013).

An IETF draft that would replace RFC 8725 adds fixes for attacks found since [BI-FIND-2026-1063](https://insights.bostonidentity.com/ref/BI-FIND-2026-1063). Two of them are MUSTs. Libraries must let the verifier tell a signed JWT from an encrypted one, and the draft cites CVE-2023-51774 for libraries that cannot tell a successful decryption from a successful signature check [BI-FIND-2026-1063](https://insights.bostonidentity.com/ref/BI-FIND-2026-1063). A token with characters other than letters, numbers, dash, underscore and period must be rejected [BI-FIND-2026-1063](https://insights.bostonidentity.com/ref/BI-FIND-2026-1063). Against an algorithm name like “noNE” slipping past a blocklist, the draft only says libraries SHOULD use allowlists [BI-FIND-2026-1063](https://insights.bostonidentity.com/ref/BI-FIND-2026-1063).

## Where does it fit?

- Compared with JSON Web Signature: JWS (RFC 7515) defines how a token is signed and how the signature is checked. RFC 8725 sits on top of it and quotes its rule that a JWS validated with an algorithm the application does not accept should be treated as invalid [S1 §3.2].
- Compared with JSON Web Encryption: JWE (RFC 7516) is the format for encrypting a token. RFC 8725 warns that some libraries decrypt a JWE and then skip the signature inside it, so it requires both layers of a Nested JWT to be validated [S1 §2.3] [S1 §3.3].
- Compared with JSON Web Key (JWK): A JWK Set (RFC 7517) is one way an issuer's keys are published: in the RFC's example, OpenID Connect fetches an issuer's keys in that form [S1 §3.8]. RFC 8725 leaves the format alone and requires the application to confirm that the keys used on a token belong to its issuer [S1 §3.8].
- Compared with OAuth 2.0 Authorization Server Metadata: RFC 8414 is a metadata standard, and RFC 8725 names it as using the same issuer-to-keys mechanism as OpenID Connect: an https issuer URL, a metadata document and a "jwks_uri" [S1 §3.8]. RFC 8725 leaves the lookup to the application; its rule is that the keys must belong to the issuer [S1 §3.8].

## What goes wrong?

- Weak shared secrets: some applications sign with a keyed message authentication code (MAC) such as HS256 and use a human-memorable password as the key. Anyone who gets hold of one token can then try to guess the key offline [S1 §2.2]. The RFC says such passwords must not be used directly as the key [S1 §3.5].
- Compression before encryption: many encryption algorithms leak the length of the plaintext, and compressing first makes that length depend on the content. The RFC says data should not be compressed before encryption [S1 §2.4] [S1 §3.6].
- Unchecked curve points: several libraries failed to validate inputs to elliptic curve key agreement. An attacker who can send crafted tokens and see the decrypted output can recover the recipient's private key [S1 §2.5].
- Mixed text encodings: older JSON allowed UTF-16 and UTF-32 as well as UTF-8, and a malicious sender could use that ambiguity to slip past a recipient's checks. Implementations must use UTF-8 only [S1 §2.6] [S1 §3.7].

## What should a security leader ask?

1. Have we pinned the accepted algorithms in every service that accepts JWTs, or does any service still trust the token's own "alg" header?
2. Which of our services accept tokens from an issuer that also issues tokens for other applications, and does each one reject a token whose audience is missing or not its own?
3. Where does any service fetch keys from a "jku" or "x5u" URL in a token header, and is that URL checked against an allowed list?
4. Does any service accept tokens marked "none", and who approved that?

## Sources

- [S1] [RFC 8725: JSON Web Token Best Current Practices](https://www.rfc-editor.org/rfc/rfc8725) (IETF, Best Current Practice (BCP 225), February 2020)

## Evidence

- [BI-FIND-2015-0012](https://insights.bostonidentity.com/ref/BI-FIND-2015-0012): RFC 7519 makes "none" mandatory to implement and leaves refusing an unwanted algorithm to the application, as a SHOULD. Section 8 names HS256 and "none" as the only signature and MAC algorithms that conforming JWT implementations MUST implement; RS256 and ES256 are RECOMMENDED. Section 6 says an Unsecured JWT, with "alg" set to "none" and an empty signature, MAY be created when something outside the token secures it. Section 7.2 hands the signature check to the JWS specification, then calls the choice of algorithms "an application decision": a JWT that validates with an algorithm the application does not accept SHOULD be rejected. Our briefing on RFC 8725, the later update, covers the rules that now make libraries let the caller fix the allowed algorithms and refuse the rest. (from "RFC 7519 makes "none" mandatory to implement and leaves refusing an unwanted algorithm as a SHOULD")
- [BI-FIND-2020-0011](https://insights.bostonidentity.com/ref/BI-FIND-2020-0011): Under RFC 8725, the caller decides which algorithms a JWT library will use. Libraries MUST let the caller name a supported set and MUST NOT use any other, the "alg" or "enc" header MUST match the algorithm actually used, and each key MUST be used with exactly one algorithm, checked when the operation runs. These rules answer attacks the RFC cites: a header switched to "none" that some libraries accepted without checking any signature, and an RS256 token relabelled HS256 that some libraries verified with the RSA public key as the HMAC secret. The RFC still allows "none": it says the algorithm "can be perfectly acceptable" when the token is protected by other means such as TLS, and that libraries SHOULD NOT generate or accept it unless the caller explicitly asks. (from "RFC 8725: the caller, not the JWT header, picks the algorithm, and "none" is discouraged, not banned")
- [BI-FIND-2020-0013](https://insights.bostonidentity.com/ref/BI-FIND-2020-0013): RFC 8725's firm rule against one kind of JWT being accepted as another is about validation logic. When one issuer can issue more than one kind of JWT, the validation rules for those kinds MUST be written to be mutually exclusive, rejecting tokens of the wrong kind. Explicit typing with the "typ" header is RECOMMENDED for new uses of JWTs, and the authors concede it "may not achieve disambiguation from existing kinds of JWTs", because the validation rules for existing kinds often ignore "typ". (from "RFC 8725: the caller, not the JWT header, picks the algorithm, and "none" is discouraged, not banned")
- [BI-FIND-2026-1063](https://insights.bostonidentity.com/ref/BI-FIND-2026-1063): Two of the fixes the draft adds for attacks found since RFC 8725 are MUSTs. Libraries must let the verifier tell a signed JWT from an encrypted one; the draft cites CVE-2023-51774 for libraries that do not distinguish a successful decryption from a successful signature validation. And any token with characters other than letters, numbers, dash, underscore and period "is not a JWT and MUST be rejected", the draft's answer to tokens verified in JSON form but read as compact ones. A third fix is softer: against an algorithm name like "noNE" slipping past a blocklist, libraries SHOULD use allowlists. (from "The draft replacing RFC 8725 requires rejecting malformed JWTs but only recommends denial-of-service limits")

---

© 2026 Boston Identity LLC. All rights reserved. Published by Boston Identity LLC.
Quote up to 100 words with the credit "Boston Identity, IAM Insights" and a link to https://insights.bostonidentity.com/glossary/rfc8725 as the source. Claim numbers may be cited freely. Training, fine-tuning and text-and-data-mining use of this page is permitted.
Terms: https://insights.bostonidentity.com/terms · How to cite: https://insights.bostonidentity.com/cite
