Summary
Any user with member:create permission (including all admin-role members by default) can create an invitation with role: "owner", granting the invited account full owner privileges upon acceptance. The server does not validate that the inviter's role is sufficient to delegate the target role. Once the invitation is accepted, the new owner cannot be demoted, resulting in a permanent organization takeover.
Details
The organization.inviteMember tRPC procedure (apps/dokploy/server/api/routers/organization.ts:250-353) is gated by withPermission("member", "create"), which controls the ability to invite but does not restrict the role value in the request body. The input schema accepts any of owner, admin, or member (or a valid custom role string), and the invitation row is persisted with the attacker-chosen role at line 321.
When the invitee accepts via authClient.organization.acceptInvitation, better-auth's organization plugin reads the stored invitation.role and inserts a member row with that role. The updateMemberRole handler (line 431) explicitly prevents any changes to or from the owner role, meaning the legitimate owner cannot demote the attacker-created owner.
A related issue exists in user.createUserWithCredentials (packages/server/src/services/user.ts:399-484), which allows an admin/owner on self-hosted instances to create a user with an arbitrary role string (including owner) without going through the invitation flow or requiring email verification.
PoC
Prerequisites: A Dokploy instance with an admin-level account (or any custom role with member:create permission).
Step 1 — Create owner-level invitation from an admin session:
POST /api/trpc/organization.inviteMember?batch=1 HTTP/1.1
Host: <target>
Content-Type: application/json
Cookie: better-auth.session_token=<ADMIN_SESSION>
{"0":{"json":{"email":"[email protected]","role":"owner"}}}
Response (HTTP 200):
{
"result": {
"data": {
"json": {
"id": "<invitation_id>",
"organizationId": "<org_id>",
"email": "[email protected]",
"role": "owner",
"status": "pending",
"expiresAt": "2026-05-14T14:17:01.612Z"
}
}
}
}
Step 2 — Register and accept the invitation:
Navigate to /invitation?token=<invitation_id>, register an account with the matching email, and accept the invitation. The attacker is now an owner member of the organization.
Step 3 — Verify permanence:
The legitimate owner cannot demote the attacker via updateMemberRole — the handler rejects any role change involving owner.
Impact
Any admin-level user (or any user granted member:create via a custom role) can escalate to full organization owner. This grants unrestricted access to all organization resources, the ability to remove other members (including the original owner's admin access), and control over organization settings and deletion. The escalation is permanent and cannot be reversed through the application's role management interface.
Summary
Any user with
member:createpermission (including all admin-role members by default) can create an invitation withrole: "owner", granting the invited account full owner privileges upon acceptance. The server does not validate that the inviter's role is sufficient to delegate the target role. Once the invitation is accepted, the new owner cannot be demoted, resulting in a permanent organization takeover.Details
The
organization.inviteMembertRPC procedure (apps/dokploy/server/api/routers/organization.ts:250-353) is gated bywithPermission("member", "create"), which controls the ability to invite but does not restrict therolevalue in the request body. The input schema accepts any ofowner,admin, ormember(or a valid custom role string), and the invitation row is persisted with the attacker-chosen role at line 321.When the invitee accepts via
authClient.organization.acceptInvitation, better-auth's organization plugin reads the storedinvitation.roleand inserts amemberrow with that role. TheupdateMemberRolehandler (line 431) explicitly prevents any changes to or from theownerrole, meaning the legitimate owner cannot demote the attacker-created owner.A related issue exists in
user.createUserWithCredentials(packages/server/src/services/user.ts:399-484), which allows an admin/owner on self-hosted instances to create a user with an arbitrary role string (includingowner) without going through the invitation flow or requiring email verification.PoC
Prerequisites: A Dokploy instance with an admin-level account (or any custom role with
member:createpermission).Step 1 — Create owner-level invitation from an admin session:
Response (HTTP 200):
{ "result": { "data": { "json": { "id": "<invitation_id>", "organizationId": "<org_id>", "email": "[email protected]", "role": "owner", "status": "pending", "expiresAt": "2026-05-14T14:17:01.612Z" } } } }Step 2 — Register and accept the invitation:
Navigate to
/invitation?token=<invitation_id>, register an account with the matching email, and accept the invitation. The attacker is now anownermember of the organization.Step 3 — Verify permanence:
The legitimate owner cannot demote the attacker via
updateMemberRole— the handler rejects any role change involvingowner.Impact
Any admin-level user (or any user granted
member:createvia a custom role) can escalate to full organization owner. This grants unrestricted access to all organization resources, the ability to remove other members (including the original owner's admin access), and control over organization settings and deletion. The escalation is permanent and cannot be reversed through the application's role management interface.