Details
<form id="f" method="post" action="https://victim.budibase.app/api/chat-links/app_xxx/linktoken/handoff">
<input name="confirmationToken" value="<leaked-token>">
</form>
<script>document.getElementById('f').submit()</script>
- Victim (a Budibase user in tenant T, e.g. an admin) is lured to the attacker page while logged into Budibase. Their browser sends the POST cross-origin. If the Budibase auth cookie is sent on cross-site requests (
SameSite=Laxby default allows top-level POST navigations, which a form-submit is), the request is authenticated as the victim.
- The victim's `globalUserId` is now bound to the attacker's Slack identity. When the attacker DMs the AI agent from Slack, the agent's operations run as the victim user -> with the victim's permissions on agent operations, knowledge sources, file uploads, and any downstream automation steps keyed off the linked identity.
Mitigating factors:
SameSite=Laxcookies block cross-site POSTs from sub-resources (fetch / XHR) but allow top-level form-POST navigations. A phishing page that submits the form viadocument.form.submit()(a top-level navigation) succeeds. So the CSRF works with the default cookie policy.- The attack is same-tenant only (
session.tenantId !== context.getTenantId()is checked in the sdk). - The attacker must induce the victim to click a link (standard phishing). No silent drive-by.
---
Impact
| Capability | Available |
|---|---|
| Bind an attacker-controlled chat identity to a victim's Budibase account | ✅ |
| Send messages to the AI agent as the victim user (Slack/Discord/MS Teams/Telegram) | ✅ |
| Inherit the victim's permissions on agent operations | ✅ |
| Trigger automations / agent operations that the victim is authorised for | ✅ |
| Read knowledge sources the victim has access to | ✅ |
The severity depends on what the agent can do as the victim. For an admin victim, this is full tenant administration via chat. For a regular user, it is impersonation within the agent subsystem. The bound identity persists until manually unlinked, so the attacker retains ongoing access.
This is a same-tenant, user-interaction-required primitive. It is below the "unauthenticated RCE" threshold but above "hardening" -> it is a real authentication-confusion vulnerability on a sensitive identity-binding operation.
---
Fix
Recommended layered fixes:
- Bind the confirmation token to the requester's Budibase session at preparation time. In
prepareChatIdentityLinkSessionConfirmation, store theglobalUserIdof the requester alongside theconfirmationToken. InconfirmChatLinkSession, verify thatgetCurrentGlobalUserId(ctx)matches the stored requester. This breaks the CSRF / cross-user confusion.
- Add a CSRF token to the confirmation POST. The standard Budibase CSRF synchroniser token (
x-csrf-tokenheader, validated against the session'scsrfToken) should be enforced onPOST /api/chat-links/.../handoff. Move the route out ofpublicRoutesto an authenticated route group so CSRF applies (the GET can remain public for the redirect-to-login flow; the POST should be authenticated + CSRF-protected).
- Add a per-session nonce that is bound to the requester's browser (e.g. a signed cookie set on the GET, validated on the POST) to prevent cross-origin submission even when
SameSite=Laxallows it.
- Require user re-authentication (re-entry of password / step-up auth) for sensitive identity-binding operations, similar to how password change requires re-auth.