//nefariousplan

Caller Chosen Key

A verifier reads which key, which algorithm, or which trust anchor to check against out of the same artifact it is verifying. The cryptographic step runs correctly, against inputs the caller chose. The signature binds that the caller could produce bytes consistent with a policy they picked, not that they held any credential.

A verifier is asked to confirm that an inbound artifact was signed by a trusted party. The verifier reads the artifact's bytes to answer the question. It also reads the artifact's own metadata to decide which key to verify with, which algorithm to use, or which trust anchor to pin. The caller writes the artifact. The caller writes the metadata. The cryptographic check runs correctly, against inputs the attacker chose, and returns true because the caller wrote both the message and the policy for inspecting it.

The signature binds that the caller could produce bytes consistent with their own policy. It binds no identity, no credential, no prior enrollment with the verifier. Every patch that closes an instance of this class moves one piece of policy out of the artifact and into operator configuration the handler cannot read from the inbound request.

Mechanism

This class spans a spectrum of attacker reach into the verifier's own parameters. At one end, the key material is literally a field on the request. In CVE-2025-9209, RestroPress reads the Authorization header on its JWT issuing endpoint and uses the value as the HMAC key to sign a token; the sibling verifier reads the matching key from x-api-key on the authenticated endpoint. Same caller, two headers, one key. CVE-2026-42238 puts the same shape inside a single endpoint. Nginx-UI's POST /api/restore reads security_token as <base64-aes-key>:<base64-aes-iv> from a form field on the restore request, decrypts the inner backup zips with those bytes, and verifies the manifest's HMAC under a key derived from the same AES bytes. The signature authenticates the backup to itself, not to any issuer.

One layer up, the key does not travel on the request; its location does. CVE-2026-27478 is the asymmetric, network-mediated version. Unity Catalog's token-exchange endpoint reads iss out of the inbound JWT, fetches <iss>/.well-known/openid-configuration, follows the document's jwks_uri field, retrieves a JWKS from that URL, and verifies the token's signature against a key the caller published. The two "issuer matches configuration" and "issuer matches request" checks that bracket the fetch are both caller-vs-caller comparisons. The signature proves the caller could host two JSON documents.

At the TLS handshake, the same shape names the trust anchor rather than the signing key. Incus's VerifyPeerCertificate closure (CVE-2026-40243) constructs a fresh x509.CertPool from the certificate chain the peer sent on the handshake, verifies rawCerts[0] against that pool, and never references the configured clientCAPool the surrounding code parsed, marked IsCA, and kept in scope for twenty-eight months. The cryptographic Verify call succeeds given its inputs. The inputs are the bypass.

At the degenerate end, the caller does not supply key material at all; the caller selects a verification routine that does not look. SimpleHelp's /oidc handler (CVE-2026-48558) reads the alg field out of the inbound JWT header and dispatches to the branch indexed by whatever the caller wrote. alg: none reaches the branch that skips the signature check entirely; the signature segment of the submitted token is literally the ASCII character x. SharePoint's SPJsonWebSecurityTokenHandlerV2.GetSigningKeyIdentifier() (CVE-2026-55040) stacks the two variants: the x5t thumbprint in the attacker-forged inner actortoken tells the verifier which certificate to pull as the signer, while the outer envelope's alg: none tells the verifier to skip the signature check that would have proved the inner actortoken was actually issued by the certificate the thumbprint named.

The class is agnostic to transport (HTTP header, form field, URL claim, TLS handshake), to primitive (HMAC, RSA, X.509 PKIX, OIDC discovery), and to the asymmetry of the scheme. It is specific to one data flow: a field inside the artifact being verified reaches the verifier's decision about how to verify. The patch that closes an instance always moves one piece of policy out of the artifact and into operator configuration the handler cannot read from the inbound request. Unity Catalog added server.allowed-issuers. SimpleHelp narrowed the alg allowlist. Incus made the closure reference clientCAPool. Where the primitive is sound and the inputs are sound, the sign-versus-verify boundary carries real authentication evidence; where the inputs are drawn from the verified artifact, the primitive is running against a self-consistent attacker.

What makes this class recurrent is that the artifact's own metadata, meaning iss, kid, alg, x5t, the peer's certificate chain, reads to the developer as the question's natural parameter. "Which key?" is answered by the token in every JWT library documentation example. The documented behavior is for interoperability between cooperating parties. The attacker is not a cooperating party, and the attacker writes the metadata.

Exhibits

CVE-2026-27478: Unity Catalog's JWT Verifier Asks the Token Where Its Key Lives. Unity Catalog's POST /api/1.0/unity-control/auth/tokens is the asymmetric, network-mediated form of the pattern. The verifier reads the iss claim out of the inbound JWT, follows it to <iss>/.well-known/openid-configuration, parses the document's jwks_uri, fetches a JWKS from that URL, and verifies the JWT's signature against a key in that response. The caller writes iss, hosts the discovery document at iss, fills in the document's issuer and jwks_uri, serves the JWKS, and owns the private key that signs the token. The two "issuer doesn't match configuration" and "issuer doesn't match request" checks the v0.4.0 code does run are caller-vs-caller comparisons. RestroPress put the HMAC key in an HTTP header on the same request; Nginx-UI put the AES key in a form field on the same request; Unity Catalog puts the RSA public key behind a URL the request names. Same pattern, different transport.

CVE-2026-40243: Incus's OVN Verifier Builds Its Root Pool From the Peer It's Verifying. CVE-2026-40243 extends caller-chosen-key from JWT signing into TLS peer verification. The artifact being authenticated is rawCerts[0], the peer's leaf certificate; the trust anchor is whatever rawCerts[1..n] contains, supplied by the same peer on the same handshake. Incus's VerifyPeerCertificate closure constructs a fresh x509.CertPool from the wire-supplied chain, including rawCerts[0] itself, and runs cert.Verify against that pool. The cryptographic operation succeeds correctly given its inputs; the inputs are the bypass. The configured CA pool, clientCAPool, is parsed, marked IsCA = true, marked KeyUsageCertSign, and lives in the captured frame above the closure for the closure's entire twenty-eight-month lifespan; the closure references it zero times. Where Nginx-UI puts the HMAC key in a form field and Unity Catalog hosts the JWKS at a caller-named URL, Incus reads the trust pool from the same TLS callback parameter that carries the certificate it is verifying. The verification binds only that the peer could present bytes on the wire, not that any of those bytes were signed by the configured CA.

CVE-2026-42238: Nginx-UI's Backup Signature Is Signed By Whoever Sends the Backup. CVE-2026-42238 puts caller-chosen-key inside a single endpoint. Nginx-UI's POST /api/restore reads the security_token form field as <base64-aes-key>:<base64-aes-iv>, decrypts the inner backup zips with those bytes, and verifies the manifest signature with HMAC-SHA256(sha256("nginx-ui-backup-signing-v1:" + caller_aes_key), manifest_bytes). Sign and verify on opposite sides of the transport, same caller, one form field, one key. The legacy fallback that uses settings.CryptoSettings.Secret is for backups produced before this scheme existed; an attacker without that secret never reaches it because the AES-key path returns nil first. The v2.3.8 patch closes the route via AuthRequired() and a new install-secret gate; internal/backup/manifest.go is byte-for-byte identical between v2.3.7 and v2.3.8, so the signature still binds a backup only to itself.

CVE-2025-9209: The RestroPress JWT Is Not Forged. The Plugin Signs It For You.. RestroPress 3.0.0 to 3.2.1 ships the pattern in its plainest form. The /wp-json/rp/v1/auth issuer reads Authorization from the request and uses the value as the HMAC key to sign a JWT; the RP_JWT_Verifier reads x-api-key from a later request and uses it as the HMAC key to decode. Same caller, two headers, one key. The only thing that would separate "issuer" from "attacker" is a per-user secret the verifier compares against, and in this plugin that secret is served to anonymous GET requests via register_meta('user', '_rp_api_user_public_key', array('show_in_rest' => true)). The issuer's signature carries zero authentication evidence; the verifier's key-match check is the gate, and the key it checks was public.

Boundaries

Not every verifier that accepts a kid parameter is this pattern. JWKS lookup by kid against a key set whose membership the operator controls, meaning one JWKS URL hardcoded in operator configuration and one key store installed at bootstrap, is standard safe practice; the caller selects from a bounded, operator-authored set. The pattern lands when the kid resolves against a key source the caller controls: a JWKS URL named by the token itself, a certificate chain supplied on the handshake, a key field on the same request.

Not every alg-aware verifier is this pattern. A JWT verifier that reads alg out of the header to select HS256 versus RS256 can be safe if the two branches draw from disjoint operator-pinned key stores and the branch choice cannot cross those key spaces. The pattern lands when one alg branch is none, when the two branches share the same key material (the classic HS256-with-the-RS256-public-key confusion), or when the branch the attacker selects changes which trust decision runs at all.

Not every unauthenticated mint endpoint is this pattern. RestroPress's /wp-json/rp/v1/auth also had a missing capability check, which is nonce-is-not-auth at the issuing side. The caller-chosen-key shape is a separate layer on top: an endpoint that correctly authenticates its caller before signing is still caller-chosen-key if the key it signs with comes from the caller rather than from a server-side store keyed by the authenticated identity.

Defender playbook

Audit each signature or trust-verification call for its inputs. For every verify(signature, key) or equivalent in your codebase, trace the key argument backwards. Does it come from operator-provided configuration loaded at startup, from an enrollment record keyed by a session-bound identifier, or from a field on the same request that carries the signature? Only the first two bindings carry authentication evidence. A key read from the inbound artifact's claims, headers, URLs it names, or chained peer certificates is caller-chosen regardless of how many lookup indirections separate the field from the verify call.

Force verification policy to live out-of-band in operator configuration. The verifier must name its expected issuer, its algorithm set, and its trust anchor from startup flags or persistent configuration the handler does not read from the request. Where a verifier accepts multiple issuers, the allowed-issuer list must be an explicit allowlist installed by the operator. "Whatever iss resolves to over HTTP" is not an allowlist; it is a key-selection surface the caller controls end-to-end. Unity Catalog's v0.4.1 fix is the canonical shape: server.allowed-issuers defaults empty, and the endpoint fails closed when it is empty.

Pin algorithm and key by handler, not by artifact. Every signature-check call site must hardcode the expected primitive: HS256 only, RS256 only, X.509 against one named pool. The library convenience method that selects based on the inbound alg, kid, or peer chain is the caller-chosen-key API surface. Replace it with the call that takes the algorithm as a function argument your handler binds from configuration, not as a field your parser reads from the token. If your library offers no such call, the library is the bug.

Prove the bypass. For any verifier you own, send it an artifact signed with a key you generated and shipped on the same request. Submit a JWT with your own iss, your own JWKS URL, or a leaf certificate chained to a CA you built that morning. If the verifier returns success, the class is live in your code regardless of how the key reached the verifier. The test takes under five minutes to write per endpoint and catches the full spectrum of this pattern, from Authorization-header HMAC to attacker-hosted JWKS to peer-supplied trust pool, before the CVE finds you.

Kinship

Nonce Is Not Auth. Sibling pattern at the cryptographic layer. Nonce-is-not-auth covers the case of a CSRF freshness token misread as identity: the caller presents something they could acquire, and the handler reads acquisition as authentication. Caller-chosen-key is the same structural gap one layer up, inside the signature primitive itself: the caller presents something cryptographically valid under a key or policy they chose, and the verifier reads valid-under-chosen-policy as authentication. The published nonce-is-not-auth page already names this kinship on its RestroPress exhibit gloss.

Host Header As Self. Same structural gap on the verifier's self-identity axis. Host-header-as-self covers servers that derive their own URL from client-supplied request headers, so the "intended for me" check in a signed message becomes "intended for whatever the client claims I am." Caller-chosen-key covers servers that derive their verification key, algorithm, or trust anchor from the request. Both collapse an authenticating comparison into caller-against-self.

Trust Inversion. Umbrella relationship. Trust inversion is the general shape where the primitive that is supposed to authorize the caller is actually in the caller's hands. Caller-chosen-key is the subset where the primitive is cryptographic verification and the caller's control is specifically over the verification parameters (key material, key location, algorithm, trust anchor). The verification still runs correctly; the inputs are the inversion.

The verifier ran. The signature checked. The key, the algorithm, and the trust anchor were all on the attacker's shelf.