-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Multikey Encryption Breaks When Upgrading from NC26 to NC27 #45182
Comments
I cannot tell if related but noticed that end_to_end_encryption is listed in app_install_overwrite. E2E and SSE are not compatible and cannot be used at the same time afaik, because they both use the encrypted column in oc_filecache. |
@kesselb when starting the cloud we tried E2EE but then disabled the app (years ago) without having any problems so far. So i guess this is not related. |
Also Looping in @artonge |
I failed to reproduce. |
Sorry for the late response. However we just reproduced it with Sorry we didn't realize that before... I updated the |
I was just able to reproduce the error on a fresh instance with the updated steps @derschiw posted. Moved all default files into a folder on NC26 and shared that. Upgrade to NC27. After moving the folder without editing the files, none of them can be opened anymore. This seems like a serious problem to me... |
I was also able to reproduce this issue with the steps provided by @derschiw. I also moved all the preexisting files in a folder on NC26 and shared it with a user. I then upgraded to NC27 and added another user to that same folder, which then made files in it inacessible to all participants. |
Are there any news on that? Were you able to reproduce it? This bug still keeps breaking all files from our customers and we can't do something against it. So, help would be very much appreciated! |
I was able to reproduce by adding a recipient after the update. @come-nc: When adding a new recipient, we trigger server/apps/encryption/lib/Crypto/Encryption.php Lines 412 to 455 in 5bc8329
Which:
The issue is with n°2 server/lib/private/Encryption/Keys/Storage.php Lines 187 to 191 in 5bc8329
Which will remove the Draft level solutions ideas:
What do you think? |
I think it is on purpose that the fileKey is removed, because it should be embedded in the generated shareKeys once legacy encryption is not used anymore. I remember this was complicated because rewriting header means rewriting the file. |
Bug description
Hi there
We are running a multikey encrypted NC instance with some hundreds of users. Recently we upgraded from NC26 to NC27. From then on multiple users reported, that they coud not open files anymore (console logging "Cannot decrypt this file, probably this is a shared file"). After doing quiet some research, we were able to track down the problem to this cause:
In the following issue openssl_seal and rc4 were removed (https://github.com/nextcloud/server/pull/37243/files). In this PR the so called
fileKey
used for RC4 was removed after re-encrypting a file (server/apps/encryption/lib/Crypto/Encryption.php
Line 395 in 461f6d4
fileKey
gets deleted without re-encrypting the data, which leads to data loss.In particular, we could observe that the
files_encryption/key/files/[PATH]/OC_DEFAULT_MODULE
directory of affected files did contain new[USERNAME].shareKey
files and nofileKey
anymore. We were then able to replace the content of this directory with the old share keys and thefileKey
(that we restored from a backup). By doing this, we could open the file again (in the webbrowser), which leads to the conclusion that the file must have lost its keys without beeing reencrypted.We were though not able to precisely find the precise code that causes the missing reencryption. We believe that the
end
orupdate
method inapps/encryption/lib/Crypto/Encryption.php
get called without re-encrypting the file.Help is very much appreciated, as this currently breaks all of our users data and we can't do something against that problem besides informing our customers. Thanks you very much for your support!
Steps to reproduce
Install NC26 with User Key Encryption
occ encryption:list-modules
to check that the app is enabledocc encryption:disable-master-key
and accept the warningocc encryption:enable
occ encryption:encrypt-all
Create a Folder and Share
files_encryption
directory are two[USERNAME].shareKey
and afileKey
.Update
foo
).foo
).Expected behavior
The files should be re-encrypted before removing the fileKeys.
Installation method
None
Nextcloud Server version
27
Operating system
Debian/Ubuntu
PHP engine version
None
Web server
Nginx
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (26 to 27)
Are you using the Nextcloud Server Encryption module?
Encryption is Enabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
No response
Additional info
No response
The text was updated successfully, but these errors were encountered: