jku (JWK Set URL) Header Parameter in a JWT
jku is a URL where the signing key can supposedly be found. Because the token supplies the URL, a verifier that fetches it is letting the sender choose both the key that will validate the token and the destination of an outbound request.
At a glance
- Parameter
- jku (JWK Set URL)
- Defined in
- RFC 7515 section 4.1.2
- Value type
- URI referring to a JWK Set resource, as defined in RFC 7517
- Required
- Optional, and rarely appropriate in a closed deployment
- Transport requirement
- RFC 7515 requires a protocol providing integrity protection, and TLS with server authentication.
- In the decoder
- Displayed as text in the header JSON. The tool never fetches the URL; verification uses a key you paste.
In detail
The intended use is a federation where the verifier already knows and trusts a set of issuer hosts, and needs to be pointed at the right key set among several. Even then RFC 7515 requires the fetch to happen over a protocol with integrity protection and server authentication, meaning TLS with a validated certificate, because a key set retrieved over an unauthenticated channel is worth nothing.
Fetching whatever URL the token names hands over the entire trust decision. An attacker signs a token with their own key, publishes the matching public key on a host they control, points jku at it, and the verifier obligingly downloads the key that makes the forgery valid. Every claim in the token, including who the subject is, is then whatever the attacker wrote.
The second problem is server side request forgery. The verifier is often a backend service with network access nobody outside is meant to have, and jku makes it issue a request to a URL an outsider chose. Cloud metadata endpoints, internal admin interfaces and anything else reachable from that host become targets, and the response may even come back in an error message.
The safe handling is an allowlist of exact URLs, or of exact hosts with a fixed path, decided in configuration, plus a strict scheme check, no redirect following, a timeout and a cache. In most deployments the honest answer is simpler: ignore jku entirely and configure the key set location yourself. The decoder takes that position by never dereferencing anything from a header, and asking you to paste the PEM public key instead.
Examples
// Legitimate: a host the verifier already trusts
{ "alg": "RS256", "kid": "2024-06-key",
"jku": "https://auth.example.com/.well-known/jwks.json" }
// Forgery: attacker controlled key set
{ "alg": "RS256", "kid": "attacker-key",
"jku": "https://evil.example.net/jwks.json" }
// SSRF probe against the verifier itself
{ "alg": "RS256", "jku": "http://169.254.169.254/latest/meta-data/" }Things that catch people out
- Allowlisting by hostname substring. A check for auth.example.com matches auth.example.com.evil.net, so compare the parsed host exactly.
- Following redirects on the fetch. An allowed URL that redirects elsewhere defeats the allowlist entirely.
- Treating jku as required for federation. Most verifiers only ever talk to issuers they already know, and can hold the key set URL in configuration.
Try it: JWT Decoder
Paste a token to decode the header and payload, read the claims and expiry, and verify the signature in your browser. Nothing is uploaded.
JWT Decoder
LOCAL · Browser-OnlyDecode and inspect JSON Web Tokens without sending them to a server
Related JWT claims and algorithms
All jwt claims and algorithms →jwk (JSON Web Key) Header Parameter in a JWT
The jwk header embeds the public key in the token itself. Why trusting it verifies nothing, where it is legitimate, and how the decoder treats it.
x5u (X.509 URL) Header Parameter in a JWT
The x5u header points at an X.509 certificate chain for the signing key. The SSRF and trust risks, and what a verifier has to validate.
kid (Key ID) Header Parameter in a JWT
The kid header says which key signed a token. How rotation depends on it, why the value must be a lookup and never a path, and decoder behaviour.
x5c (X.509 Certificate Chain) Header Parameter
The x5c header embeds the X.509 certificate chain in the token. Why it uses standard Base64 rather than Base64URL, and how a verifier must treat it.
x5t (X.509 Certificate SHA-1 Thumbprint) Header
The x5t header holds a SHA-1 thumbprint of the signing certificate. How it selects a certificate, why SHA-1 here is not the usual problem, and what to prefer.
x5t#S256 (X.509 SHA-256 Thumbprint) Header
The x5t#S256 header holds a SHA-256 thumbprint of the signing certificate. How it is computed, where mTLS bound tokens reuse the value, and what to check.
Tools for this
- JWT Decoder Free online JWT decoder - decode and inspect JSON Web Tokens without sending them to a server