VulnWatch by ve1ve2
medium 4.3

GHSA-jq2g-h4xr-4mcr: Cipher Ownership Confusion in Organization Import

Source:
Vaultwarden releases + advisories (GitHub dani-garcia/vaultwarden)
Published:
Fetched:
Updated:
Affects:
dani-garcia vaultwarden

https://github.com/dani-garcia/vaultwarden/security/advisories/GHSA-jq2g-h4xr-4mcr ↗

repo-advisoryrustCWE-863securityrepo:dani-garcia/vaultwarden

Cipher Ownership Confusion in Organization Import ### Summary An improper authorization issue exists in the organization import endpoint (/api/ciphers/import-organization). While the endpoint validates the target organization specified in the URL query, it fails to enforce that each imported cipher is bound to that organization. A user with organization import permissions can set organizationId at the cipher level to null in the request payload. This causes the imported cipher to be saved to their personal vault while remaining linked to the organization's collection, resulting in inconsistent data ownership and collection mappings between organization and personal vaults. ### Details In `src/api/core/organizations.rs`, the `post_org_import` function overly trusts external input: 1. Although the route validates the user's permissions for the target organization via the URL parameter (`query.organization_id`), when iterating through `data.ciphers`, it **does not force `cipher_data.organization_id` to be overwritten with the authenticated `org_id`**. As a result, the system blindly trusts the organization ID provided in the JSON payload. 2. When invoking `update_cipher_from_data(...).await.ok()`, `.ok()` silently suppresses potential business validation errors. 3. Subsequently, the code unconditionally executes `CollectionCipher::save`, forcefully mapping the generated `cipher.uuid` to the target organization's `collection_uuid`. When an attacker sets `organizationId` to `null`, the cipher item is incorrectly saved to the personal vault while simultaneously being mapped to the organization's collection, breaking physical data isolation. ### PoC **Reproduction Steps:** 1. Log in with an account that has import permissions for the target organization (e.g., Org B). 2. Initiate an import request to Org B and intercept the HTTP request: `POST /api/ciphers/import-organization?organizationId=`. 3. Modify the `organizationId` field in the request payload to `null` ``` "body": JSON.stringify({ "ciphers": [ { "type": 1, "encryptedFor": "XXXXXXXXXXXXXXXXXXXXX", "folderId": null, "organizationId": null, ``` 4. **Triggered Result**: * If the payload defines a new collection (only possible for admins and owners), it is created in the target organization. * A new cipher item appears in the user's **personal vault**. Because the cipher item was encrypted by the client using the organization key prior to upload but erroneously assigned to the personal vault server-side, client-side decryption using the personal key fails, resulting in a ghost entry displaying `[error: cannot decrypt]` in the personal account. ### Impact Affected Scope: Vaultwarden instances with organization features enabled. Impact: This can create inconsistent ownership between imported ciphers and organization collections. The same missing binding also allowed setting the per-cipher `organizationId` to a different organization in Affected packages: rust:vaultwarden Patched: vaultwarden 1.37.0

Linked vulnerabilities (1)

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N

Cipher Ownership Confusion in Organization Import

CWE: CWE-863