-
-
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
Decryption corrupted all files — serious file loss #8311
Comments
hi, same here :( we ran our nc instance with enabled server-side encryption since owncloud 7 times and disabled it 3 days ago via Currently we are on nc13, php7. After that we get "OCP\Encryption\Exceptions\GenericEncryptionException: Bad Signature" errors at every file we try to open. Files are still there but inaccessible. pls help log: OCP\Encryption\Exceptions\GenericEncryptionException: Bad Signature |
Hi — |
Has anyone found a solution? Is this being investigated? Now and then I truly believe that priorities are totally screwed up with this project. Sometimes a proper icon placement seems more important than making a basic feature work. |
I am facing the same issue on nextcloud 13.0.1. The problem seems to arises when As a result, you will not be asked for the recovery password before the decryption and none of the files will be decrypted, but marked as such in the database, resulting in aforementioned error. To reproduce the issue I just tested this with a fresh docker-based installation:
Result: File no longer accessible with error above (after leaving maintenance mode). To get access to the file again after the failed decryption it was enough to set the files @schiessle Is there a quick way to detect these files and to fix their DB entries without having to restore backups? |
Interesting find @FlorianFranzen ! Is it possible to simple change the encrypted-column back to 1 for all files (since I guess none of them is accessible at the moment) in one go? Thanks! |
Disclaimer: I am not an nextcloud developer and you should have backups of all your data and database before you start messing with nextcloud's internal structure. @mmaedler Yes, you could. The problem is just, that not all entries in the file cache are files (but dirs, etc.), whose encrypted flag should probably not be set. I am working at a fix at the moment that avoids working on the database directly. I failed to get any help from any actual developers, but given the projects bad reputation that is not surprising at all. It seems that even if the file is not marked encrypted in file cache, the encryption stream wrapper is called somehow (probably based on file content) but then fails because the file cache marks the file as not encrypted. |
Is there a way to decrypt the files via "occ encryption decrypt:all" without entering the maintenance mode to avoid the problem? Thx for your help guys :) |
@AlexCloudDev Yes, some quick test seems to suggest that it is save. |
I tried what you suggested earlier and when running
I guess this is because I ran the decrypt-all command before (and then ended up with this mess of files). Shall I enable encryption again? Thanks, Moritz |
@mmaedler: Just enable encryption for a brief moment, decrypt-all will disable it again anyway. Enabling encryption does only mean, that all new files added will be encrypted. |
@schiessle: This is quite a serious bug, that can be easily replicate in a few steps in a fresh install. Care to take a look or to at least comment on this issue? |
@MorrisJobke @rullzer You seem to be some sort of nextcloud maintainer. I already tried to talk to people on IRC but nobody seems to care. Would anybody care to comment on this issue? |
cc @nextcloud/encryption |
Bump to remove stale label I guess. This is still relevant and can cause serious headaches. I don't get why nothing is done about it. If there is not immediate fix at least the |
@AnianZ can you test it with the Nextcloud 14 beta 3? We added quite some encryption fixes to it, so chance are high that they will also resolve this issue... Thanks! https://nextcloud.com/blog/nextcloud-14-beta-3-is-here-time-for-testing-and-a-chance-to-win-a-t-shirt/ |
Thank God for this advice: update oc_filecache set encrypted = 1 Saved me when the decrypt all did nothing but mark the files decrypted causing all files to show up as corrupt. Changed them to encrypted = 1 in the db and managed to recover them. This is a huge problem and can cause serious loss of data. |
@schiessle It is an easy to reproduce bug, that has been filed with high importance with you for more than half a year and started being reported as early as at least nine month ago. You are the main encryption developer. How about you test your own code for a change? |
@FlorianFranzen I can't thank you enough for figuring this out. Your advice has literally saved 5 years worth of data. ❤️ |
@schiessle : The new version changed nothing in this regards. I am still not able to decrypt my files using occ occ encryption decrypt:all |
Alright, after studying a bit the code, I found out that: Precondition:
Then:
Then the decryption happens and you can read your files in clear text again. This should be documented in the latest documentation, in my opinion. |
@iegtcamnp I'm also running the snap and managed to decrypt my files with a workaround. You've almost got it down, you just need to skip step 2, maintenance mode needs to be disabled when you're decrypting your files. This is because while decrypting the files it checks if the encryption module is active and when the Nextcloud instance is in maintenance mode it returns |
Fix has just been merged into master. 👍 |
just to let you know. this is, in my opinion, a major bug and should be fixed as soon as possible. I am on 16.0.1.1 and have still the problem |
@ybaumy |
Nextcloud 17. |
@kesselb If this comes out in nextcloud 17 latest then do other users a favor and include some information in the documenation that decrypt-all is broken. Or point to a workaround. |
@ybaumy Good point 👍 Pull Requests are always welcome: https://github.com/nextcloud/documentation |
@kesselb well I won't add it to the documentation since I won't use nextcloud much longer. the decrypt-all bug is just one of the annoyances. but I am pretty sure somebody will or not, since you pretty much do not seem to care. |
I see you're frustrated, but don't take it out on me. I'm a user like you and do contributions in my spare time 😞 |
@kesselb Hey man never mind. I am beyond frustration. Dealing with badly documented OSS software and bugs for over 20 years. You spend hours or sometimes days identifying a problem and you have to wait and wait to get a fix for it. It is a completely normal behavior. Even if users lose their data or have to restore 50TB now, like in my case. |
Signed-off-by: Ruben Homs <[email protected]>
Hey, are you sure that the problem has been resolved? After latest upgrade of nextcloud i still have some files not decrypted... I noticed that the files, that are not decrypted, their 'path' in database is still with 'files_encyption/%' Thanks for any help. |
Not sure what situation you're in @Ciangi , but the fix I made for this only makes it impossible to decrypt while you're in maintenance mode. Decrypting when maintenance mode is enabled made the encryption modules be unavailable which caused the corruption in this case. If you already had files in this situation, then upgraded and tried to decrypt again it will not do anything for that. If you need to fix that situation take a look at this comment and my reply below that to fix that issue. |
@ybaumy @Ciangi @iegtcamnp @mmaedler @tessus I don't know if this is still relevant for you but we've written a tool that allows you to decrypt individual files if you still have your Nextcloud data directory and configuration file. It supports master key encrypted files, user key encrypted files (you additionally need the user passwords) and recovery key encrypted files (you additionally need the recovery password): decrypt-file.php |
Hi there, |
I am also here because I also have the problem that not all files are decrypted, too. I also do not know how to save the data. Update to 17.0.1 and to make decrypt again? I'm stinking why it was not documented that the decryption ist buggy. |
update oc_filecache set encrypted = 1 where fileid = <FILE_ID>; |
kwiatekk tell me how to find the fileid of the files that there are not yet decryptet?! |
Do not, yet I'm still fighting with that.
…On Sat, 23 Nov 2019, 22:08 JB1985, ***@***.***> wrote:
kwiatekk tell me how to find the fileid of the files that there are not
yet decryptet?!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#8311?email_source=notifications&email_token=AJDCURBDV44QBQOBX66JS7DQVGLU3A5CNFSM4EQIGEX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE75WHI#issuecomment-557832989>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJDCURDMPEWZLFOJKQE3HC3QVGLU3ANCNFSM4EQIGEXQ>
.
|
There are some files that can not be decrypted. I have try with @yahesh decrypt-file.php but still not work. |
@kwiatekk @JB1985 I wouldn't advise to directly modify the database, but rather restore a backup of your server from before you tried to decrypt all files and just download the files from Nextcloud after the restore. The |
I encountered the same issue in NC 18.0.1 when following the documentation!!! |
If maintenance mode is enabled (like the current documentation recommends to do!), disabling encryption results in a complete loss of data since the encryption module is not loaded in maintenance mode (see nextcloud/server#8311)!!! I added some additional warnings about encryption, too.
If maintenance mode is enabled (like the current documentation recommends to do!), disabling encryption results in a complete loss of data since the encryption module is not loaded in maintenance mode (see nextcloud/server#8311)!!! I added some additional warnings about encryption, too.
If maintenance mode is enabled (like the current documentation recommends to do!), disabling encryption results in a complete loss of data since the encryption module is not loaded in maintenance mode (see nextcloud/server#8311)!!! I added some additional warnings about encryption, too.
Hi, I am facing the same problem here, many of my .jpg and .txt files have become corrupted. And unfortunately I don't have a recent backup. Is there a working solution since? I'm surprised the problem is still happening. @yahesh is it possible and how can I use rescue/decrypt-all-files.php on a shared web hosting? Many thanks in advance, I am in depression! C. |
Steps to reproduce
occ encryption encrypt:all
occ encryption decrypt:all
Expected behaviour
Files should be decrypted and accessible
Actual behaviour
Files are corrupted and cannot be opened anymore. Due to that I have lost important files.
Server configuration
Operating system: Ubuntu 16.04 server
Web server: nginx
Database: mysql
PHP version: 7.0
Nextcloud version: 12.0.4
Updated from an older Nextcloud/ownCloud or fresh install: Updated
Where did you install Nextcloud from:
Signing status:
Signing status
List of activated apps:
App list
Nextcloud configuration:
Config report
The text was updated successfully, but these errors were encountered: