Headline
CVE-2021-32728: End-to-end encryption device setup did not verify public key
The Nextcloud Desktop Client is a tool to synchronize files from Nextcloud Server with a computer. Clients using the Nextcloud end-to-end encryption feature download the public and private key via an API endpoint. In versions prior to 3.3.0, the Nextcloud Desktop client fails to check if a private key belongs to previously downloaded public certificate. If the Nextcloud instance serves a malicious public key, the data would be encrypted for this key and thus could be accessible to a malicious actor. This issue is fixed in Nextcloud Desktop Client version 3.3.0. There are no known workarounds aside from upgrading.
Impact
Clients using the Nextcloud end-to-end encryption feature download the public and private key via an API endpoint as described in the RFC:
In case a certificate exists already for the user the client has to download the existing private key. This is done the following way:
- Client downloads private key from the /ocs/v2.php/apps/end_to_end_encryption/api/v1/private-key endpoint.
- Client asks the user for the mnemonic and decrypts the private key using AES/GCM/NoPadding as cipher (256 bit key size) and PBKDF2WithHmacSHA1 as key derivation.
- Client checks if private key belongs to previously downloaded public certificate.
- Client checks if their certificate was signed by the server (checking the servers public key from /ocs/v2.php/apps/end_to_end_encryption/api/v1/server-key)
- Client stores the private key in the keychain of the device.
- The mnemonic is stored in the keychain of the device (ideally with spaces so it can be shown more readable).
The Nextcloud Desktop client skipped the third step: “Client checks if private key belongs to previously downloaded public certificate.” - If the Nextcloud instance served a malicious public key, the data would be encrypted for this key and thus could be accessible to a malicious actor.
Patches
It is recommended that the Nextcloud Desktop client is upgraded to 3.3.0.
Workarounds
None.
References
- HackerOne
- Pull Request
For more information
If you have any questions or comments about this advisory:
- Create a post in nextcloud/security-advisories
- Customers: Open a support ticket at support.nextcloud.com