GHSA-qwx4-wcv4-mpcv: Organization Admin can revoke and delete Owners through an Admin-mintable organization API key
- Published:
- Fetched:
- Updated:
- Affects:
- dani-garcia vaultwarden
https://github.com/dani-garcia/vaultwarden/security/advisories/GHSA-qwx4-wcv4-mpcv ↗
Organization Admin can revoke and delete Owners through an Admin-mintable organization API key ### Summary A confirmed organization Admin can revoke and permanently delete Owners and fellow Admins. The ordinary member removal route refuses exactly this, by name, with "Only Owners can delete Admins or Owners". The Admin instead creates the organization API key, which is guarded at Admin level where upstream requires Owner, and drives the public import endpoint, which applies no caller role check and does not exclude Owners. ### Details Two independent divergences from upstream combine. Either one alone is defensible design. `api_key()` in `src/api/core/organizations.rs` is guarded by `AdminHeaders`. Upstream gates the equivalent default key type on Owner in `HasApiKeyAccessAsync`, and `OrganizationClientProvider` accepts only that key type for the `client_credentials` grant. `ldap_import` in `src/api/core/public.rs` protects only the last confirmed Owner, via `count_confirmed_by_org_and_type(&org_id, MembershipType::Owner, &conn) <= 1`. Upstream excludes Owners from removal entirely, in both removal branches of `ImportOrganizationUsersAndGroupsCommand.cs`. The minted token carries scope `api.organization` and no user identity, so the import endpoint cannot tell which member created the key. ### PoC Organization with confirmed Owners A and C, and confirmed Admins B and D. Step 1. As Admin B, `POST /api/organizations//api-key` with B's master password. Returns 200 with the key. A plain User and a Manager both receive 401. Step 2. As Admin B, remove Owner C through the ordinary member route. Returns 400, "Only Owners can delete Admins or Owners". Step 3. Exchange the key at `POST /identity/connect/token` with `grant_type=client_credentials` and `scope=api.organization`. Step 4. `POST /api/public/organization/import` marking C deleted. Returns 200 and C is revoked. Step 5. The same call with `overwriteExisting` set true, omitting C and D from the member list, deletes both from the organization. Reproduced against a local instance on 1.37.3. The affected code is byte identical on current `main`. ### Impact CWE-863. A confirmed organization Admin gains destructive control over Owners and fellow Admins. The credential is scoped to the organization rather than to the member, so it keeps working after the Admin who created it is removed, and the creation route writes no event log entry. There is no confidentiality impact, because an Admin already exports every organization cipher through a route at the same guard level. The last confirmed Owner is protected, so an organization cannot be fully decapitated. The Admin cannot elevate their own role, and the import creates only ordinary members. A surviving Owner can reverse the removals by re-inviting, and can rotate the key. Affected packages: rust:vaultwarden Patched: vaultwarden 1.37.4