CBOR Web Tokens: make cnf validation a proof test, not a claim lookup
A confirmation claim can look deceptively simple. The issuer places a cnf key in a CBOR Web Token (CWT), and the receiver is supposed to know that the presenter has a particular key. RFC 8747 defines this proof-of-possession pattern for CWTs, while RFC 8392 defines the base token format. Parsing both specifications correctly is only the beginning of enforcement.
The receiver must first validate the CWT signature, issuer, audience, expiration, and intended use. It should then read cnf as a CBOR map with the expected member types. The confirmation method determines what has to happen next. A key identifier might be used to locate a public key, but a key identifier does not prove possession. The receiver still needs a signed request, challenge, or other fresh proof tied to the current transaction. A bare kid comparison is an equality check, not authentication.
CBOR adds useful pitfalls that JSON-only teams may not expect. Map keys can be integers or text, and two encodings that decode to similar values are not necessarily the same wire representation. Implementers should use a mature COSE library, reject unexpected confirmation members, and enforce a strict type and length policy. Do not accept a cnf field copied from the protected header or from a nested untrusted object. The claim must come from the signed payload and must be checked against the actual proof message.
Audience binding also matters. A presenter can possess a legitimate key for one service and try to use the token at another. The verifier should bind the proof to its own origin, method, path, and request body where the profile allows. A signature over a generic body without a service audience can be replayed to a different endpoint. Freshness controls such as nonce, timestamp, or a server-issued challenge should remain separate from the CWT expiration time.
There is a second failure mode after cryptographic success: the application may look up permissions from the sub claim without noticing that the presenter is now using a different confirmation key. The safest model is to resolve the authorization subject from the validated token and the validated presenter proof together. If key rotation is in progress, accept only keys that belong to the token issuer's current policy and record which key was used.
Operational checks should cover more than the happy path. Test a token with a missing cnf, a cnf of the wrong CBOR type, a token whose proof is signed by a different key, and a valid proof replayed to another audience. Inspect logs to ensure the raw CWT and proof are not written in full. Metrics can track proof failures by reason, but they should not expose key identifiers to broad log consumers.
The implementation record should state which confirmation methods are supported, which proof formats are accepted, and how clock skew and nonce replay are handled. A CWT library that parses cnf is useful, yet the security decision lives in the service that knows what the key is allowed to prove. Keep that decision explicit.
Top comments (0)