//nefariousplan

Existence Is Authorization

A handler given a caller-supplied identifier checks that the named resource exists and treats the existence check as the authorization decision. The identifier is enumerable; the resource carries no per-call credential. Anyone who can guess or enumerate the identifier becomes the authorized caller.

A handler receives an identifier naming a resource. It runs the lookup the identifier names: a database SELECT, a registry isset, a filesystem readfile, a method-exists check, a certificate subject match. The lookup returns the resource, or returns nothing. The handler branches on that boolean and acts on the resource when the boolean is true. That is the whole authorization step.

The identifier is a name, not a credential. It tells the handler which resource is being asked about. It does not tell the handler that the caller is the party the resource was created for. The row the lookup returns carries no field the handler compares against the caller, because the resource's schema never had such a field, because the writer treated the identifier's own hardness-to-guess as the credential. Anyone who can enumerate, transcribe, or inherit the identifier becomes the authorized caller.

The fix always lands in the resource's schema before it lands in the handler's logic: a column the writer adds, a token the creator emits, an owner field the lookup now returns, a credential the consumer compares against. The existence check stays. It stops being the gate.

Mechanism

A handler accepts an inbound identifier naming a resource. The identifier might arrive as a URL query parameter (n8n's executionId), a path segment (Langflow's flow_id), a POST field (Divi Form Builder's role, Branda's user_login), a raw integer in a wire-format create context (ksmbd's persistent_id), a string in a JSON dispatch field (FunnelKit's action), an absolute filesystem path (OpenEMR's file_path), or the subject line of a PEM blob (Arista VeloCloud's client certificate). The handler runs the lookup the identifier names and reads the lookup's truthiness: row present, method exists, file readable, role registered, certificate subject matches. The handler takes the truthy answer as the authorization decision.

The identifier is reachable to parties outside the resource's intended audience. Database autoincrement primary keys are sequential (n8n scans executionId 1 through 200). Kernel idr_alloc_cyclic handles start at zero and increment by one (ksmbd's PoC defaults --pid-start 0 --pid-end 64). WordPress role names are a globally documented list that every install carries (isset($wp_roles->roles['administrator']) returns true on every WordPress on earth). Class method names are grep-reachable from the dispatcher's own source. Absolute filesystem paths are every Linux administrator's namespace. Non-enumerable identifiers, 122-bit UUIDv4 in Saleor and Langflow, defeat brute-force enumeration and still land in the pattern, because the identifier travels: order confirmation emails to buyers, tracking URLs handed to delivery providers, screenshots in support tickets, server access logs, audit exports. The lookup's answer is "yes, this exists," and the handler reads the yes as "yes, this caller is entitled to act on it."

What is missing from the resource is a per-call credential the caller must additionally present: a token signed with a key the resource's owner keeps, a session identifier bound to a login flow the caller completed, an owner field recorded on the resource at creation that the handler can compare against the authenticated principal. In every exhibit, the fix moves that credential into the resource's own data and then adds the check. n8n's patch switches checkIfExecutionExists (loads the bare row) to findExecution (loads the data field where the fix now stores a resumeToken); the old function could not have gated on a credential because it did not load the field the credential would live in. ksmbd's patch carves out a new struct durable_owner (uid, gid, name) on the file row and adds a ksmbd_vfs_compare_durable_owner call; the owner field did not exist on the row until the patch created it. Divi's patch reads the role from the form's server-side stored configuration keyed by form ID, not from the submission. Branda restores the activation_key check the 3.4.29 refactor deleted. PrestaShop's patch calls the getValidResetPasswordToken() method already present on the Employee model but never invoked from initContent(). Open WebUI's patch adds the per-user resolution the function's sibling branch three lines above was already doing.

The pattern is distinct from classical IDOR because it does not require a second user or a concept of authenticated session. The n8n WebSocket has no logged-in caller by design; the handler was written against a threat model where "the URL contains the credential" was the architecture. Several exhibits have no authenticated caller anywhere in the handler: OpenEMR's AJAX endpoint, Divi's nopriv submit, the Arista certificate validator. The pattern is distinct from nonce-is-not-auth because the identifier is not a server-minted freshness token; it is a name that happens to be reachable. The pattern is distinct from caller-chosen-key because no cryptographic primitive is running correctly or incorrectly; the gate is a boolean on a dictionary, a SELECT, or a filesystem call.

What makes the class recurrent is a composition of two forces. First, lookup functions are small, readable, and honest about what they do. checkIfExecutionExists, isLoadedObject, isset, method_exists, ksmbd_lookup_durable_fd: every one of these answers exactly the question its name promises. The gate is not naming theater. The callers are the surface where the honest answer gets read as an answer to a different question. Second, the resource schema often never carried a per-call credential field at all, because the writer believed the identifier's hardness-to-guess was the credential. Adding the credential requires schema change, not just logic change. That is why the bug recurs across kernels, WordPress plugins, GraphQL APIs, TLS peer-verification closures, and GUI form-builders: in each, "what does the lookup return that proves the caller is the right caller?" has the answer "nothing, but the identifier is hard."

Exhibits

CVE-2026-31717: ksmbd's Durable Handle Was Not an Authorization, It Was a Credential. The kernel-layer instance of the pattern. ksmbd's smb2_check_durable_oplock() accepts a caller-supplied 64-bit persistent_id, looks up the orphaned struct ksmbd_file via ksmbd_lookup_durable_fd(), and treats the lookup's success as the authorization decision. The IDs are sequential idr_alloc_cyclic handles starting at zero, globally allocated across every SMB session on the server. The patch had to add a new struct durable_owner (uid, gid, name) onto ksmbd_file before the consumer-side check could be wired in, because the row never carried a per-call credential to begin with. Same structural shape as the n8n exhibit, different stack: where n8n's missing credential was a chat-session token loadable from a row the lookup already touched, ksmbd's missing credential was an identity triple that was never stored at all. The producer-side gap is wider in the kernel case; the consumer-side check is identical.

CVE-2026-24849: OpenEMR's Fax Dispatcher Routes By Method Name. authenticate() Was The Implementer's Choice.. CVE-2026-24849 is the file-system-walked variant of the pattern. OpenEMR's EtherFaxActions::disposeDocument accepts an absolute path string via getRequest('file_path'), hands it to readfile(), and treats the implicit "the file is readable as the web server's user" as the entire authorization check. Where the n8n exhibit's identifier is a sequential execution ID, the ksmbd exhibit's is a persistent_id handle, and the Divi Form Builder exhibit's is a WordPress role name, OpenEMR's is an absolute path: a namespace enumerable by every Linux administrator on earth. The patch in 7.0.4 introduces the missing per-call credential by adding authenticate() and confining the target to the module's own baseDir; the file existence check stays, it just stops being the gate. The wrinkle this exhibit adds is at the producer side, not the consumer: the producer (viewFax) pinned a server-derived path into the session, and the consumer (disposeDocument) read it as getRequest('file_path') ?? getSession('where'), demoting the trusted channel to the operand the null-coalesce never reaches when the caller supplies the request parameter.

CVE-2026-42228: n8n's Chat WebSocket Treated Existence As Authorization. n8n's chat WebSocket handler called a function literally named checkIfExecutionExists and treated its boolean return as the authorization decision. The function did exactly what its name said: a single repository lookup that returned the bare row, with no includeData flag. The patch is not a missing check added in place; it is a switch from checkIfExecutionExists to findExecution, because the original function did not load the data field where a per-call credential could have lived. This exhibit is the clean WebSocket variant of the pattern: a public endpoint, no concept of an authenticated user by design, a caller-supplied sequential ID, and an existence query standing in for an authorization query.

CVE-2026-5118: Divi Form Builder's Role Check Asked Whether the Role Existed. Administrator Existed.. CVE-2026-5118 puts the pattern at the WordPress role layer. Divi Form Builder's FormSubmissionHandler::create_user() reads the role name from the submission's role field and runs one check against it: isset($wp_roles->roles[$role]). The check answers an enumeration question, not an authorization question. WordPress roles are a globally enumerable list per install (defaults plus whatever WooCommerce, BuddyPress, membership, and LMS plugins register at activation), and the role itself carries no per-call credential. The role name is the entire credential. Anyone who can name a registered role becomes a user who holds it. Sibling shape to the n8n and ksmbd exhibits, where the per-call credential the consumer needed was, respectively, a chat-session token loadable from a row the lookup already touched and a struct durable_owner that did not exist on the file row at all. The Divi fix in 5.1.3 introduces the missing credential by reading the role from the form's stored configuration keyed by form ID, not from the submission. The existence check stays; it just stops being the gate.

CVE-2026-45671: Open WebUI's TODO Comment Named the Missing Access Control. The Function Shipped Without It.. Sibling shape to the n8n, ksmbd, and Divi Form Builder exhibits. Open WebUI's Chats.get_shared_chats_by_file_id(file_id) answers an existence question (does any shared chat reference this file?) and the gate treats the boolean as the authorization decision for every access_type, including the 'write' that DELETE /api/v1/files/{id} passes. The wrinkle the Open WebUI case adds is that the existence-as-authorization branch and a per-user, per-permission branch already coexist in the same function: the channels branch three lines above takes the caller's user.id and gates on access_type == 'read'. The author had the correct shape on the screen and wrote a branch that did not match it. The 0.9.0 fix is the missing per-user resolution (AccessGrants.get_accessible_resource_ids(user_id=user.id, ...)) on top of the same existence query.

Boundaries

Not every identifier-keyed lookup is this pattern. A handler that reads a path parameter and queries the database by it is correct if the SELECT also binds the row to the authenticated session (WHERE id = ? AND owner_id = ?), or if a signed token accompanies the ID and is verified against row state before the handler acts. The pattern lands specifically when the lookup's truthiness is the handler's only branch and no second credential ever enters the comparison. Two gates, correctly composed, is the design; one gate reading a yes the function was honest about answering is the bug.

Not nonce-is-not-auth. In nonce-is-not-auth, the caller holds a server-minted CSRF freshness token confirming their session fetched a page recently, and the handler misreads freshness as identity. In existence-is-authorization, the caller holds nothing the server issued; they hold a resource identifier that happens to be reachable. The two patterns stack in some WordPress plugin CVEs: the handler checks a nonce (wrong gate for identity) and then does a lookup by ID (wrong gate for per-resource authorization). When they stack, name which gap the specific fix closes. Divi Form Builder's 5.1.3 patch, for example, closes the existence-is-authorization half (role read from server-side configuration rather than from submission) without touching the nonce-is-not-auth half (the handler remains callable from wp_ajax_nopriv_).

Not pure IDOR with an authenticated caller. Classical IDOR has user A reading user B's data because the handler trusts a resource ID from the request over the user_id on the session. Existence-is-authorization is wider: it also covers handlers with no authenticated caller anywhere in the request (n8n's public chat WebSocket, OpenEMR's AJAX endpoint, Divi's nopriv submit, ksmbd's SMB2 reconnect), where no session identity exists to compare the resource against. IDOR is one instance of the pattern, the instance with a session the handler fails to consult; the pattern as a whole is the mechanism of reading lookup success as caller authorization, with or without a session present.

Not naming-was-the-check. In naming-was-the-check, a function asserts a cryptographic or authorization step through its name and its body does not call the primitive at all; the check is theater. In existence-is-authorization, the lookup function is honest about what it does. checkIfExecutionExists does check whether the execution exists. isset($wp_roles->roles[$role]) does report whether the role is in the registry. ksmbd_lookup_durable_fd does return the file if the handle resolves. The failure is one call frame up, where the caller reads the honest yes as the answer to a question the callee never claimed to answer. The two patterns meet at the edge where a dispatcher routes by method_exists on a name the dispatcher also chose to treat as the authorization: naming-was-the-check if the per-method capability check never runs, existence-is-authorization if the dispatcher's existence test is the whole gate.

Non-enumerable identifiers (122-bit UUIDv4, long random tokens) reduce exposure but do not close the class. Saleor and Langflow both ship UUIDv4 primary keys, both defeat brute-force enumeration, and both still land here because the identifier travels through channels outside the "only the legitimate counterparty can read this" boundary the design assumed: order confirmation emails, delivery-provider tracking URLs, screenshots, support exports, server access logs. If the handler's authorization decision is "did the caller present the correct UUID," then every surface that touches the UUID is a surface that grants authorization. High-entropy identifier is not a fix; it is a severity reduction while the pattern is live.

Defender playbook

Audit every handler that takes a caller-supplied identifier and performs a lookup. Trace what the lookup returns. If the handler's only branch on the result is if (result) proceed, open the resource's schema: is there a column that could bind this resource to a specific caller (owner_id, created_by, resume_token, durable_owner, a signed approval)? If no such column exists on the row, the fix is not logic; it is a schema change followed by a credential-presentation protocol. n8n's patch, ksmbd's patch, and Branda's refactor-reversal all had to add the field before they could add the check. The question to ask of any lookup is: "what does the row return that proves the caller is the right caller?" If the answer is "nothing, but the identifier is hard," you are one enumerable allocator away from the CVE.

Enumerate the identifier space against your own handler. Scan sequential integers against every /path/:id endpoint, default role names against every registration form, class method names against every JSON dispatcher that routes by name. If the response distinguishes "exists" from "does not exist" in any observable way (status code, response text, timing, Content-Length), the handler also ships an information-disclosure oracle that scales the pattern from one-guess to full keyspace enumeration. n8n's handler emitted Execution with id "<id>" does not exist on misses and nothing on hits; the PoC's scanner uses that exact substring as its enumeration signal. The patch added the credential AND collapsed both rejection branches to one generic "Connection rejected" string. The CVE record names only the first fix. Close both.

For non-enumerable identifiers (122-bit UUIDv4, cryptographic tokens, PEM subject strings), do not stop auditing when the entropy clears a brute-force threshold. Map every surface the identifier travels across: confirmation emails, SMS, partner webhooks, delivery-provider tracking URLs, screenshots in support tickets, access logs, audit exports. Each surface is a party whose possession of the identifier becomes "authorized caller" under the pattern. Saleor and Langflow both ship 122-bit UUIDv4 and both land in this class because the identifier travels; Saleor's GraphQL schema description is the most candid version, documenting bearer-credential authorization as a feature on a field named userEmail. If the design intent is that every holder is authorized, say so in the handler's name and docs; if not, add the per-call credential the UUID was coincidentally standing in for.

For handlers with no authenticated caller at all (public submission endpoints, pre-login flows, WebSocket upgrades exempt from middleware, kernel protocol handlers), the fix cannot be current_user_can() or its equivalent. The identifier must bind to a per-call credential the attacker cannot replay. Store the credential on the resource at creation, emit it only to the legitimate counterparty, and verify it on the handler with a constant-time compare. n8n's resumeToken is the canonical shape at the HTTP layer; ksmbd's durable_owner struct is the equivalent at the SMB protocol layer. Treat "the handler has no user" as a design decision that moves authentication into the request body, not as permission to remove authentication.

For dispatcher-shaped handlers (method_exists, class_exists, action-name lookup, __call routers), replace the existence check with an explicit allowlist of the actions the dispatcher is expected to route. FunnelKit's method_exists(__CLASS__, $action) surfaced eighteen methods on the class; five were the intended routes and eleven were reachable public-callable administrative methods. OpenEMR's fax dispatcher routed on method name and exposed twenty-three un-authenticated methods on a class that carried one authenticate() helper none of the twenty-three called. The diff that fixes the class is the allowlist and an in-method capability check, not better defensive code inside each of the collateral targets. "Which methods exist on this class" is the compiler's question. "Which methods is this caller authorized to dispatch" is the application's question. The two do not share an answer.

Kinship

Nonce Is Not Auth. Sibling pattern at the "the artifact proves less than the handler thinks" axis. Nonce-is-not-auth names the case where a server-minted CSRF freshness token is read as identity: the caller presents something the server issued, and the handler reads issuance as authentication. Existence-is-authorization names the case where a caller-supplied identifier naming a resource is read as caller-authorization: the caller presents something the server did not issue, and the handler reads the resource's existence as proof of the caller's relationship to it. Different artifacts, same structural error of confusing what the check actually verifies. In WordPress plugin CVEs the two patterns frequently stack; name which gap each specific fix closes.

Caller Chosen Key. Sibling at the cryptographic layer. Caller-chosen-key covers verifiers where the cryptographic primitive runs correctly against key material, algorithms, or trust anchors the caller supplied in the artifact being verified; the signature binds that the caller could produce bytes consistent with their own policy. Existence-is-authorization covers the same confusion one layer below the primitive: no cryptography runs, the gate is a boolean on a lookup, and the identifier the caller supplied is enough to trip the gate. Both collapse "the caller could produce this input" into "the caller is the entity the input stands for." The published caller-chosen-key page lists nonce-is-not-auth as the identifier-layer sibling; this pattern sits adjacent, between the two, at the lookup layer.

Trust Inversion. Umbrella relationship. Trust-inversion names the general shape where the artifact the handler trusts for authorization is actually in the attacker's hands. Existence-is-authorization is the subset where the artifact is a resource identifier, the trust is in the lookup's truthiness, and the attacker's work is enumeration or transcription rather than forgery. The handler trusts that only the right caller could name this resource; the attacker names the resource anyway.

Middleware Outside The Hijacker. Co-occurrence at the WebSocket-upgrade boundary. Middleware-outside-the-hijacker names the architectural shape where request-scoped auth middleware is wrapped around a handler that upgrades the request into a long-lived connection; the middleware authenticates the handshake, then never sees the streams. n8n's chat WebSocket exhibit of existence-is-authorization also carries the middleware shape: the upgrade handler fires before Express middleware can run, so the honest existence check inside startSession is literally the only gate the connection ever passes. The two patterns describe different layers of the same n8n CVE; a closed instance of middleware-outside-the-hijacker still ships the existence-is-authorization bug inside, and vice versa.

Internal Only By Convention. Adjacent at the form-builder and framework layers. Internal-only-by-convention names the case where a field the framework defines for one producer is read on inbound network input with security-relevant authority; the "only our code writes this" contract is documentation, not enforcement. Divi Form Builder's role field is both patterns stacked: the plugin's renderer writes df_hidden_user_role into HTML on every form render (the convention), and the submission handler then reads role from the request and existence-checks it against $wp_roles->roles[$role]. Closing internal-only-by-convention (read the role from stored form configuration instead of from the submission) also closes the existence-is-authorization half, because the identifier never reaches the lookup. Where only the lookup half fits (ksmbd, n8n, Saleor), the internal-only pattern does not apply.

The lookup answered the question its function name promised. The handler was asking a different question, and reading the lookup's yes as the answer.