THE TAKEAWAYS

What to take away

  • RFC 8725 explains that many attacks on JWTs came from under-specified mechanisms and from incorrect implementation and usage. Checking the signature alone is not enough.
  • Limit accepted signing algorithms to a list decided in advance by the receiving side. Use each key with exactly one algorithm, and accept "none" only when the token is protected by other means.
  • Human-memorisable passwords must not be used directly as keys for algorithms such as HS256.
  • When a JWT contains an issuer (iss), confirm that the signing key belongs to that issuer. When one issuer issues tokens for several parties, always validate the audience (aud).
  • To avoid confusing different kinds of JWT, declare the type with typ and keep validation rules separate for each kind. Do not trust kid or jku values as received.

FROM PRIMARY SOURCES

Why verifying the signature is not enough

A JWT carries claims, such as who signed in or what an API caller may do, protected by a signature or encryption. RFC 8725 explains that JWTs spread quickly because they put security-relevant information in one easy-to-protect place and are easy to implement with widely available tools. OpenID Connect ID Tokens and OAuth 2.0 access tokens are typical uses.

At the same time, RFC 8725 notes that since the JWT specification was published, several attacks on implementations and deployments have become widely known. The causes it names are under-specified security mechanisms, incomplete implementations and incorrect usage by applications.

In other words, adding a library that verifies signatures does not make a system safe. Which algorithms to accept, who issued the token, whether it is meant for you and what it is for are decisions that the receiving application must make and check.

RFC 8725 also says its content is a floor of minimum recommendations for most scenarios, not a ceiling, and that a security BCP is a point-in-time statement, so readers should look for errata and updates. This article likewise treats RFC 8725 as a starting point and assumes you confirm details in the latest documentation of the frameworks and libraries you use.

RFC 8725 addresses implementers of JWT libraries, implementers of code that uses those libraries, and developers of specifications that rely on JWTs. If you outsource development, agree early which of these roles your contractor plays and how far its responsibility for checks extends; it makes later acceptance checks easier.

Sources: [1]

FROM PRIMARY SOURCES

Decide the accepted signing algorithms as a list

A JWT has an "alg" header that states how it was signed. RFC 8725 explains that this header, combined with design flaws in some libraries and applications, has enabled attacks. An attacker could change the algorithm to "none", and some libraries would treat the JWT as validated without checking any signature. An "RS256" value could be changed to "HS256", and some implementations would then verify with HMAC using the RSA public key as the shared secret.

In response, RFC 8725 says libraries must let the caller specify a supported set of algorithms and must not use any others. Each key must be used with exactly one algorithm, and this must be checked when the cryptographic operation is performed.

For "none", RFC 8725 allows that it can be acceptable when the JWT is protected end to end by other means such as TLS, but says libraries should not generate or consume "none" JWTs unless the caller explicitly requests it. For a receiving application, rejecting "none" by default is the safer setting.

In practice, write the accepted algorithm into each integration's configuration, for example "RS256 only for this integration". The order matters: do not choose the algorithm from the alg value inside the token; reject any token whose algorithm does not match the one configured on the receiving side.

RFC 8725 also says applications must only allow cryptographically current algorithms that meet their security requirements. The list is not fixed once decided: it should be replaceable through configuration so you can remove algorithms found to be weak and move to new ones.

Sources: [1]

FROM PRIMARY SOURCES

Key strength, and never using passwords as keys

Some systems sign with a shared-key algorithm such as HS256 but use a weak key like a human-memorisable password. RFC 8725 explains that once an attacker obtains one token, such keys are exposed to offline brute-force or dictionary attacks.

RFC 8725 therefore says human-memorisable passwords must not be used directly as the key for an algorithm such as HS256. Checking whether an easy-to-remember string sits directly in a settings screen or an environment variable is a good first step.

Both issuer and receiver hold a shared key, so the risk of leakage grows with the number of people and environments involved. When issuer and receiver are different organisations, consider an algorithm verified with a public key so that the receiver never holds the secret key.

Track each key with its creation date, the integrations that use it and its planned replacement. During rotation old and new keys coexist, so a list of which key is bound to which algorithm also makes the "one key, one algorithm" rule easier to keep.

Do not write keys into configuration files or source code; load them from a secrets store so that rotation touches one place. If a contractor needs a key, decide the scope and period of access and plan to rotate it when the work ends.

Sources: [1]

FROM PRIMARY SOURCES

Validate issuer and audience, and reject tokens meant for someone else

RFC 8725 describes attacks in which a JWT issued for one recipient is used at another. For example, a protected resource that legitimately receives an access token might present that same token to a different protected resource to gain access it is not entitled to.

RFC 8725 therefore says that when a JWT contains an issuer (iss) claim, the application must validate that the keys used belong to that issuer and must reject the JWT if they do not. How keys are bound to issuers is application-specific; in OpenID Connect, for example, the issuer URL leads to a metadata document that points to the issuer's key set.

When the same issuer can issue JWTs for more than one relying party or application, RFC 8725 says the JWT must contain an audience (aud) claim. The recipient must validate it and reject the JWT if the audience is missing or not associated with the recipient.

For the subject (sub), the application must confirm that the subject, or the issuer-subject pair, is valid in the application and reject the JWT otherwise. Missing audience checks are easiest to overlook when several internal services share one identity platform, so decide the accepted audience value for each service.

Issuer and audience checks are not an optional extra after the signature passes. The point of this section is to treat rejecting a correctly signed token meant for someone else, or from an untrusted issuer, with the same weight as signature verification.

Sources: [1]

FROM PRIMARY SOURCES

Separate token types and do not trust header values as received

Because JWTs serve many purposes, a token issued for one purpose may be misused for another. RFC 8725 says that where a JWT could be confused with other kinds, mitigations must be employed to prevent such substitution.

One mitigation is explicit typing with the "typ" header, which RFC 8725 recommends for new uses of JWTs. If one issuer issues several kinds of JWT, their validation rules must be mutually exclusive so that JWTs of the wrong kind are rejected; strategies include different required claims, keys, audiences or issuers for each kind.

Header values also need care. The "kid" (key ID) is used for key lookup, so applications should validate or sanitise it to avoid SQL or LDAP injection. Blindly following "jku" or "x5u" URLs could lead to server-side request forgery (SSRF), so RFC 8725 suggests protections such as matching the URL against an allow-list of locations.

RFC 8725 also requires UTF-8 for the JSON in header parameters and claims. Before using any value from a token as a lookup condition or a destination, the receiving side should decide how to handle it, just as it would for any other input.

Sources: [1]

EDITORIAL PRACTICE

Editorial recommendation: put the receiving-side checks on one page

From here on, these are our editorial recommendations based on RFC 8725. First, for each system that receives JWTs, summarise what it checks in a one-page table. As integrations grow, it becomes hard to tell which service checks what.

For each integration, record the accepted algorithm, where keys come from and when they rotate, the expected issuer, the expected audience, the token type and how expiry is checked. The table below is an example.

The table reveals what has been left to library defaults, such as an empty audience setting or no explicit algorithm list. Make those items explicit in configuration or add checks in the application.

Review the table whenever libraries are updated or integrations are added. As RFC 8725 says, recommendations are point-in-time, so also follow your libraries' release notes and security advisories.

Also decide who owns the table. Even when development is outsourced, which issuers and audiences are accepted reflects business decisions about who you integrate with. Rather than leaving it entirely to the contractor, have the commissioning side review the table and update it whenever an integration is added or ended.

Example JWT acceptance checklist (fictional example; values are for illustration and do not belong to any real service)
What to checkExample of what to decideExample of when to reject
Signing algorithmAccept only RS256 for this integrationAn algorithm not on the list, or none
KeyFetch from the issuer's key set and fix one algorithm per keyNot the issuer's key, or algorithm mismatch
Issuer (iss)The partner identity platform's URLMissing or different
Audience (aud)A value dedicated to this serviceMissing or not associated with this service
Type (typ)The access-token typeDifferent or missing
kid / jkukid in a fixed format only; jku from allowed locations onlyWrong format, or a location not allowed

Sources: [1]

EDITORIAL PRACTICE

Editorial recommendation: run acceptance checks with tokens that must be rejected

When a contractor implements JWT acceptance, acceptance checks should confirm not only that valid tokens pass but also that tokens that must be rejected are rejected. Testing only valid tokens will not reveal the gaps described above.

Prepare test tokens with alg set to none, signed with an algorithm that is not accepted, signed with another issuer's key, addressed to another service, with no audience, of the wrong type, and expired. Create all of them with test-environment keys, never production keys.

Make these tests part of the automated suite that runs on every change, rather than a one-off. That way each release confirms that a library update or configuration change has not let a token through that should be rejected.

Record the conditions of each test token, the expected result and the actual response. Also check that rejection responses and logs do not contain the token or key itself, because tokens left in logs are themselves a source of leaks.

Writing items such as "specify the accepted algorithm list in configuration", "validate audience and issuer" and "pass the rejection tests" into the contract or acceptance criteria makes the scope of checks clear.

Sources: [1]

EDITORIAL PRACTICE

Editorial recommendation: key rotation and what to monitor in operation

A JWT setup is not finished once built. Review the checklist and the tests whenever keys rotate, integrations are added or libraries are updated.

For key rotation, plan the order: publish the new key first, have the issuer start signing with it, and remove the old key only after tokens signed with it have expired. Throughout, confirm that each key is bound to exactly one algorithm.

In operation, counting rejected tokens and their reasons helps you notice configuration errors and signs of attack. A sudden rise in rejections for audience mismatch, for example, may point to a partner's configuration change or an attempt to reuse tokens.

Finally, RFC 8725 is a minimum. The specifications you rely on, such as OpenID Connect or OAuth 2.0, may set stricter rules; RFC 8725 itself asks implementers to follow those stricter requirements.

Sources: [1]

WITH OPERUN.

Delegate everyday AI management.

Adding a library that verifies signatures does not by itself make JWTs safe. RFC 8725 asks you to decide accepted algorithms as a list, use each key with one algorithm, never use passwords as keys, validate issuer and audience, separate token types to prevent confusion and not trust header values as received. Summarise the checks for each integration on one page, confirm in acceptance checks with your contractor that tokens which must be rejected are rejected, and review everything when keys rotate or software changes. Then JWTs are accepted on evidence the receiving side controls, not simply because a signature is present.

Discuss your product and AI work

Primary sources

Sources checked on 24 November 2026. The workflows and checklists are editorial proposals.

  1. [1]

Share this insight