Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Forged tokens and stolen signing keys

A stolen session starts from a real sign-in; a forged token starts from none. This lesson looks at the two ways to get a token nobody issued, stealing the key that signs and finding a validator that does not insist on it, and then at keeping signing keys out of reach, noticing a token without a sign-in, and what Cedar does when a signing key is exposed.

A token nobody issued

Cedar's admin console lets IT staff look up and change employees' accounts, and it accepts access tokens from Cedar's identity provider. Before it acts on a token, it checks that a trusted issuer signed it, that it was issued for the console, that it is the right type of token and still within its lifetime, and then that the person it names may do what the request asks. A valid signature proves only that someone holding the issuer's key signed those bytes. It says nothing about whether anyone actually signed in.

A forged token breaks that assumption. It passes the console's checks, but no sign-in produced it. An attacker can get one in two ways: by obtaining the private key the sign-in service signs with, or by finding a validator that accepts tokens without real proof of that key. Either way, every protection that runs at sign-in is skipped. Passwords, passkeys, multi-factor authentication, and rules about devices and networks all apply to a sign-in, and a forger never goes through one.

A token signed with a stolen key passes the signature check, so every check after it still matters. Unsigned tokens and keys supplied by the token are refused outright.

Stolen sessions and replayed tokens, the subject of How sessions and tokens are stolen, start from a real sign-in by the victim, as the relay's copy of Riley's session did. A forgery has no such starting point. That makes it powerful, and it also leaves a gap in the records that defenders can look for.

Stealing the key that signs

With the private key, an attacker can sign any token they like, for any user, audience, role or lifetime. A verifier still applies its own rules, so a token whose audience or lifetime it does not accept fails anyway, but nothing that happens at sign-in applies. SAML has the same weakness. Whoever steals the certificate and private key Cedar's identity provider signs SAML assertions with can sign an assertion for any Cedar employee, and the training service, the expense service and every other service that trusts Cedar's provider will accept it. The technique is known as Golden SAML. MITRE ATT&CK, a public catalog that gives each known attack technique a name and an ID, lists it as T1606.002. It was used in the widely reported 2020 supply-chain intrusion that began with compromised SolarWinds software to reach cloud services as any user the attackers chose.

Signing keys rarely leak through weaknesses in the cryptography. They leak from the places they are kept and used: a key file on a server, a backup or disk image that includes it, a source repository or build log, a crash dump or debugging snapshot taken while the key was in memory, or a test environment that was given a copy of the production key. An attacker with administrative access to the systems behind the sign-in service may simply read the key.

The damage grows with how widely the key is trusted. A key that signs tokens for one API exposes that API. A key that signs ID tokens and access tokens for every application Cedar's staff use, or that a provider hosting many organizations uses for all of them, exposes every one of them at once.

Validation that lets forgeries through

Some forgeries need no key at all, only a validator that does not insist on the right one. Decoding a token and reading its claims is not validating it, as Protecting credentials and messages pointed out, and Digital signatures set out the rule for validation itself: the verifier decides for itself which issuers, keys, and algorithms it accepts, and treats the token's header as a hint. Each common validation mistake breaks that rule in its own way.

  • An unsigned token declares its algorithm as none and carries no signature. A validator that honors the declaration accepts claims anyone can write.
  • Algorithm confusion happens when the token chooses how it is checked. If the service signs with a private key, but a validator can be told that the token uses a shared-secret algorithm instead, it may check the token using the public key as the shared secret. The public key is public, so anyone can produce a matching value.
  • A key supplied by the token, in a header field that embeds a public key or points to an address to fetch one from, lets the attacker sign with their own key and tell the validator to use it. The signature verifies, and proves only that whoever wrote the token signed it.
  • A key ID used as a lookup in the wrong way. The kid header names the key to verify with. A validator that uses it as a file path or inserts it into a database query, instead of looking it up in a fixed set of keys, can be steered to a file whose contents the attacker can predict, or into running a query the attacker wrote.
  • A token of the wrong type. An ID token, a logout token and an access token from the same issuer are all signed JWTs, and each verifies with the same keys. A validator that does not check which kind it was given can accept an ID token where an access token is required. Explicit types, such as at+jwt for access tokens in the typ header, and validation rules that no other kind of token can pass, prevent that confusion.
  • Missing issuer and audience checks let a genuine token from somewhere else through: one issued for a different application, or by another issuer whose keys the validator happens to hold.
  • Accepting another tenant's issuer is the multi-tenant form of the same mistake. Providers that host sign-in for many organizations often sign every tenant's tokens with the same keys, so a token from a tenant the attacker created for themselves verifies perfectly. Only the issuer, which names the tenant, shows that it does not come from the organization the application serves.

RFC 8725, the JSON Web Token best current practices, describes each of these. The fix for all of them is the same. Configure the validator with the issuer it expects, the audience that identifies this application, the algorithms it allows, and where to fetch the issuer's keys, and reject anything outside that configuration. Maintained libraries do this when they are given explicit settings rather than left to their defaults. Validating an ID token and Issuer, audience, and authorized party apply these checks to ID tokens.

Each token below has one flaw. Choose the check that rejects it.

Which check catches it?

Simulation. These decoded tokens are made up, and answering sends nothing. Suppose Cedar signs in through a hosted identity provider that serves many organizations, where Cedar is tenant t-4821. Each token is sent to the expense service's business API, which expects the issuer https://idp.example.test/t-4821/, the audience https://api.expenses.example, and an ES256 signature from a key in that provider's published key set. Each token arrives at 10:20 UTC on 2 October 2026, and its exp of 1790937000 is 10:30 UTC that day.

Which check rejects this token? 1 of 4
Header
{ "alg": "none", "typ": "JWT" }

Payload
{
  "iss": "https://idp.example.test/t-4821/",
  "aud": "https://api.expenses.example",
  "sub": "u-30562",
  "role": "account-admin",
  "exp": 1790937000
}

Signature
(empty)

Enable JavaScript to check an answer here, or open the explanation below.

Show the answer and why

Requiring a valid signature made with ES256 The API allows ES256 only. A token that declares none and carries no signature must be rejected before any claim is trusted.

Which check rejects this token? 2 of 4
Header
{
  "alg": "ES256",
  "typ": "JWT",
  "jwk": { "kty": "EC", "crv": "P-256", "x": "mT3vQ8kX0aLp...", "y": "Wd2Lq7nZ4cR8..." }
}

Payload
{
  "iss": "https://idp.example.test/t-4821/",
  "aud": "https://api.expenses.example",
  "sub": "u-30562",
  "role": "account-admin",
  "exp": 1790937000
}

Signature
verifies with the key in the header

Enable JavaScript to check an answer here, or open the explanation below.

Show the answer and why

Using only keys from the published key set The attacker signed with their own key and put it in the header. A validator that ignores keys supplied by the token finds no trusted key that matches, and rejects it.

Which check rejects this token? 3 of 4
Header
{ "alg": "ES256", "kid": "idp-2026-08", "typ": "JWT" }

Payload
{
  "iss": "https://idp.example.test/t-9930/",
  "aud": "https://api.expenses.example",
  "sub": "u-20417",
  "exp": 1790937000
}

Signature
verifies with key idp-2026-08 from the provider's published key set

Enable JavaScript to check an answer here, or open the explanation below.

Show the answer and why

Checking that the issuer is tenant t-4821 The token is genuine, but it comes from tenant t-9930, which anyone can create at the provider. Only the issuer shows that it is not from Cedar, the organization the API serves here.

Which check rejects this token? 4 of 4
Header
{ "alg": "ES256", "kid": "idp-2026-08", "typ": "JWT" }

Payload
{
  "iss": "https://idp.example.test/t-4821/",
  "aud": "https://reports.example.test",
  "sub": "u-30562",
  "exp": 1790937000
}

Signature
verifies with key idp-2026-08 from the provider's published key set

Enable JavaScript to check an answer here, or open the explanation below.

Show the answer and why

Checking that the audience is the business API The token was issued for a reporting service, not the business API. Accepting it would let any application that receives a token from Cedar's tenant reuse it here.

Keeping signing keys out of reach

The strongest protection is a key nobody can copy. When the sign-in service's key is generated as non-exportable inside a hardware security module, a device built to hold keys and sign with them without ever releasing them, or a cloud key management service, as Storing and using keys described, an attacker who takes over the sign-in server can request signatures while they have that access but cannot take the key away. Removing their access ends their ability to sign anything new. Tokens they signed in the meantime remain a problem until they expire or the key is replaced, but the incident has an end.

Separate keys for separate purposes limit what one leak exposes: different keys for ID tokens, access tokens, and SAML assertions, for each environment, and, at a provider serving many organizations, for each organization where that is practical. A development key should never be trusted in production.

Access to signing configuration deserves the same care as the keys. Few people and services need permission to manage, export, or replace a key, and every use of that permission should be recorded. Changes to the published key set, to the list of trusted issuers, or to the keys an application accepts are rare, so an alert on each one costs little. An attacker who cannot steal a key may try to add one of their own instead, which Abusing federation and account linking examines.

Noticing a token without a sign-in

Every genuine token has a history at the issuer: a sign-in, a refresh or a client's own grant that produced it. A forged token has none. Comparing the tokens that applications accepted with the tokens the issuer recorded issuing can show that gap, as long as both sides keep the right records.

Finding that gap depends on the applications and APIs recording which tokens they accepted, by identifier rather than by value, and on someone comparing those records with the issuer's. The comparison can surface tokens with:

  • an identifier the issuer has no record of issuing;
  • a user who had no sign-in or refresh around the time the token says it was issued;
  • a lifetime longer than the issuer ever grants, or an issue time in the future;
  • a combination of audience, scopes, or roles the issuer never produces;
  • more tokens carrying a key's identifier than the key service recorded signatures for.

Each of these is a lead, not a verdict. Records expire before anyone looks, not every token carries an identifier such as jti, refreshes and client grants leave different traces from sign-ins, and clocks drift. A forger can also copy a genuine identifier into a token. So each innocent explanation is ruled out before anyone concludes that a token was forged. What remains is a useful distinction: a stolen token always traces back to a genuine issuance somewhere, and a forged one never does.

When a signing key is exposed

A planned key rotation overlaps the old and new keys so that nothing breaks, as Storing and using keys described. An exposed key cannot wait for that overlap. Cedar generates a new key, publishes it, starts signing with it, and removes the exposed key from its published key set at once.

Removing the key ends trust in everything it ever signed, genuine and forged alike, because a signature cannot tell them apart. Staff holding tokens signed with it are signed out or have to refresh. Applications that cached the old key set keep accepting forgeries until they fetch the new one, so they need to be told to refresh. The training and expense services, which installed Cedar's SAML signing certificate by hand, have to install the new one before Cedar's staff can sign in to them again. An organization that already rotates keys routinely, and knows every verifier and partner that holds its public key, gets through this far faster than one doing it for the first time.

Replacing the key stops future forgeries. It does not undo what earlier ones did. The investigation uses the issuance records to find what the forged tokens were used for, then revokes the sessions and grants they created, reverses the changes they made, and finds out how the key escaped so that the new one does not follow it. Rotating credentials and keys after exposure follows that process in more depth.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Cedar signs its access tokens with ES256. A validator lets each token's header choose the algorithm, and a forged token names a shared-secret algorithm instead. Why might the forgery pass? 1 of 4

Choose one answer.

Cedar's admin console logs show tokens for an administrator, but the sign-in service has no matching sign-in, refresh, or issued token identifier. What does that suggest? 2 of 4

Choose one answer.

Cedar's signing key is generated as non-exportable in a key management service. An attacker controls the sign-in server for two hours before being removed. What can the attacker still do afterwards? 3 of 4

Choose one answer.

An application built for one organization accepts tokens from a provider that hosts many organizations and signs every tenant's tokens with the same keys. An attacker sends a token from a tenant they created for themselves. Which check rejects it? 4 of 4

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity