wtf( )unctionsystem design, drawn
← all problemsAuthenticationHard

The token that says how to check it

Tokens are signed and verified with a library that reads the algorithm from the token's own header and dispatches accordingly. That is what the format was designed for — it's how you migrate algorithms without breaking old tokens.

It also means an attacker chooses which verification runs. Two classic results: declare there is no signature, or declare a symmetric algorithm so the verifier uses your public key as the shared secret.

Change what decides which algorithm verifies a token.
Components — tap one, then tap a slot on the diagram
!A token declaring its own algorithm was accepted, because the verifier believed it.

Outside every boundary: Verification key, Your service, Incoming token (states its algorithm; FAILED: attacker-controlled), an empty slot for the what picks the algorithm Connections: Incoming token calls what picks the algorithm (step 1) Verification key controls what picks the algorithm — not from the token (step 2) what picks the algorithm calls Your service — only if it matches (step 3)

Verification key
Your service
Incoming tokenstates its algorithmattacker-controlled