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
Encrypted libraries leak lots of information #350
Comments
|
Thanks for your suggestions. Encrypting file and directory entries has been discussed for some time. It'll be added in the future. But it takes a lot of effort so we don't have time to work on it currently. If file and directory entries are encrypted, we have to decrypt them when browsing the files from the web. That requires a lot of changes. I don't quite understand why using a single IV for the whole library is vulnerable to known-plaintext attacks. The IV is derived from the password with salt. It's deterministic, but not so predictable. If it's so bad to use this method to produce an IV, it's bad to derive the key from password too. I know it's better to use different IV and key for each file/block. But that would greatly increase complexity. |
|
It's bad for the same reason that ECB mode is bad: patterns in the data remain visible as patterns in the ciphertext. The only difference is that in this case we're talking about patterns of chunks instead of patterns of cipher blocks. I think it's possible to guess with good probability whether a repo contains certain files, just based on the statistical patterns of blocks with shared common prefixes. An attacker can often guess that a repo might contain some well-known file. But combined with the plaintext file & directory metadata, I don't even need to guess. For example, if I see a file containing 35684 bytes named "seafile/common/processors/blocktx-common-impl-v2.h" in your encrypted repo, it wouldn't take much guessing for me to know exactly what the plaintext of that file must be. Then I can run the chunking algorithm over it, and I learn what the first 16 bytes of each block always encrypts to (because the IV never changes). I can then search for other blocks that start with those same patterns, and now I know some of the plaintext of your other files, too. Repeat over and over for every known or guessable plaintext, and an accurate statistical picture of some of your private data can emerge. Or even worse, maybe I can send you some chosen plaintext (like a specially crafted PDF) and get you to stick it in your repo. That opens up even better attacks, because I can choose the chunking, tag my chunks with common shared prefixes of various lengths, and then accurately sample how the rest of each chunk encrypts. Anyway, I'm just an amateur interested in improving open source security. Maybe try to engage some dedicated crypto discussion groups -- I bet you'll get an earful about potential risks. Then you can decide if those risks matter to your threat model. Thanks for Seafile, if I didn't think it was useful I wouldn't spend time looking for security bugs. :-) |
|
I second the need to encrypt all file and directory entries within encrypted libraries. |
|
Having the same IV every chunk is the same as having no IV. You are not using the protocol in the way it was designed, so you are vulnerable to the attacks the protocol was designed to defend against. Using the HMAC of each chunk as an IV is better, but it introduces a relation between the IV and the data that was not researched by the designers of the protocol so it might introduce a weakness too. Intuitively the relation is faint and deliberately obfuscated, but a true cryptographer must judge whether that is good enough, and then other cryptographer should critique that judgement. |
|
Any news on this? Filenames (and the other mentioned issues) leaking information is a major problem. And unless it's clearly mentioned when creating an encrypted library may give people a false sense of security. |
|
Your page states:
But as @ef4 points out above SeaFile really isn't ready to be used with sensitive material yet. Your response is totally understandable:
BUT you need to need to state on your site that SeaFile is beta software and only rudimentary secure right now instead of making it look like it is fully secure. Thanks! |
|
kudos! @patrickwolf |
|
Is there any update on this topic? Would be glad to have your insight on this. |
|
Agreed with @patrickwolf, the documentation is currently misleading regarding what to expect from Seafile on the security/privacy side. A fair move would be to add a "Limitations" notice to the documentation. @killing: Any update on this? |
|
Another albeit not security limitation, auto upload of photos/videos on Android is not supported for encrypted libraries haiwen/seadroid#201 To my knowledge Seafile is still the best Open Source file syncing solution that has integrated encryption and thus no need to fiddle around with third party encryption tools, which is especially annoying on mobile. |
|
For the time being, the only thing we plan to improve is use a different salt for each encrypted library. The current version still use a static salt for all encrypted libraries.
We'll make these limitations clear in our documentation. The users can make their own choice. |
|
It's much worse to have bad encryption than no encryption...and don't even try to implement security or distributed code if you are not an expert in the field. |
Wait, are histories decrypted and stored or something? The content in the history should be encrypted as well, right? |
|
look at the first post. Don't think anything changed so far. If you think your data is so important/confidential that it is not enough to keep it on your own hardware, don't think anyone will stop you from implementing this or hirering one to do so. |
|
Yes, file contents in the history are encrypted. 2015-02-25 4:52 GMT+08:00 Aaron Hastings notifications@github.com:
|
|
@patrickwolf I agree. |
|
Holy shit. This needs to be advertised loudly in the manual and the UI. I was about to send data to S3 and decided to look into how exactly Seafile is encrypting my library contents. This is security theater. I love Seafile, but people need to know to not use this functionality if they want something secure. |
|
Any news on this topic? |
|
@ef4 - Just wanted to say I appreciate the in-depth explanation you have given; very insightful to read! |
|
@kantorkel We'll update the encryption algorithm to use separate salt for each library in version 5.1 or 5.2. Other improvements proposed in this thread are not planned, as I said before. We'll make the limitation clear in our documentation. |
|
Where is the limitation section in the documentation? I cannot find it here: http://manual.seafile.com/security/security_features.html |
|
Which limitation? Are you talking about the metadata? In the manual it says the following in bold characters.
|
|
This ticket seems to be a blocker for Seafile adoption in Freedombox https://wiki.debian.org/FreedomBox/LeavingTheCloud |
|
So what is the status on this? The issue remains Open, but @killing has stated that there are no plans for other improvements... I sincerely hope that the issue related to the re-use of IVs is not going to stay unfixed forever, in fact IMO moving to at least using unique IV per file/block should be one of your highest priorities, if you are serious about Seafile being used for anything other than hobby file servers. If there's not going to be any further improvements, then this issue should be closed, so that those of us who are hoping for an improvement can look for a product which better meets our needs. If there is any intention to improve the current implementation of encrypted libraries, then it would be good to get some kind of definitive time line on when we can expect it. |
|
Shall this ticket not be split into two (or more) separate issues: the single IV vulnerability and the unencrypted metadata/history? The first one really is a bug that should be fixed, while the second one is more of a design choice. On the long term, I agree with other comments that even the metadata of the "filesystem" should be encrypted. If you want to claim without small prints that "Seafile uses encryption", I think some effort should be put into having full encryption of the libraries. |
|
More than 4 years? Any news @killing ? Wasn't aware of this and, as much as I like Seafile, that makes me want to stop using it… |
|
Will this issue ever be resolved ? I mean it's a serious problem and it's been 4 years . |
|
If an issue takes 4.5 years to solve, sadly, I'd say it's not a priority @RichardRMatthews . When security isn't a priority, I find it hard to put much faith in the project to protect secure data. |
Did you ever update the encryption algorithm like you intended? |
|
If we do not address this situation, the Seafile client will never be officially packaged for Debian (and thus, Ubuntu), Gentoo and probably all other distributions that care about CVEs. |
|
We'll fix the salt issue recently and include it in 7.0 version of Seafile server. Also a new version of client is needed to work with the new encrypted libraries. |
|
IMO, there is some misunderstanding in the CVE. Seafile doesn't use the same IV for every library. The IV is calculated from the library password and the salt. Even though the salt is reused in all libraries, the passwords are usually different. What @ef4 originally stated is that the IV is reused for all the files in the same library. |
|
@moschlar Yes chunk is more accurate description for that. |
|
Glad to hear! |
|
@killing said:
This might be only semi-relevant: The Ubuntu 18.04 LTS version of the Seafile client is frozen, not updated for a while when updates to the client are available for Windows and OSX. I'm not sure what the (technical) reason is behind this, but if a client update is mandatory to support the server, will this mean that it is best not to update the server while some clients are still on Ubuntu 18.04? This might annoy to some degree, because 18.04 LTS has 10 years of support and some LTS folks are perpetually reluctant to update their system. |
|
The official PPA linked at https://help.seafile.com/en/syncing_client/install_linux_client.html should deliver the most recent version of the client. |
|
@shoeper I just double-checked, and indeed the version from the PPA was updated last year, it is not actually the most recent version. So it does get updated sometimes. Do the Linux- and Windows binary have alternating versions?
|
|
Normally not, but I don't know. Looking at the changelog (https://manual.seafile.com/changelog/client-changelog.html) it looks like the most recent changes were not worth an update for linux. |
|
We've been working on to use different salt for each library. Currently there is a PR available: haiwen/seafile-server#221 |
|
This feature is included in version 7.0. To enable using new encrypted libraries with different salt for different libraries, you need to add the following configuration to seahub_setting.py Currently the mobile clients and desktop clients does not supported new version of encrypted library yet. After we upgrade the clients, we will make the setting as default. |
|
Thank you for the update @freeplant |
|
Hello, |
|
No |
|
@Raph33 Use different salt for each library makes it harder for an attacker to crack the password or contents of the files in the encrypted libraries. But the metadata (e.g. file names, folder names, file sizes) are still stored unencrypted. |
|
Update: desktop clients 7.0 already support the new encrypted library format. |
Now with the new encrypted library format, salt is different for each file. This mitigates problems with the password possibly being the same for different libraries. But the IV is still calculated from the library password and the salt. So the IV will be the same for all files/chunks in each the library? My understanding of AES CBC is that the IV should never be reused - there should be a unique IV for each file. I may be misunderstanding the challenges but it seems like the IV should just be a random string stored in plain text in some kind of mapping from chunk to IV. The IV itself does not need to be kept secret if I understand correctly. It does not (should not?) need to be generated from the password/salt. I wonder if the authors have considered libsodium / NACL - which takes away the need to worry about IVs and salts and whether you're doing it properly. There are a range of browser libraries available too. @Raph33 the way I see it, this doesn't change much, the attacks described above still apply, but just for files within the same library. Edit: I've reread the original issue and understand that random IVs might not be possible with the current sync/dedup algorithm and that using a HMAC was recommended. And I get that this would mean changes in the frontend like the inclusion of a crypto library. |
|
@killing Is there a way to force the Seafile client to only use the new encryption format? |
|
Seafile 7 can use both? How can I see what version/format my libraries use? |
@killing any update about mobile clients? |
|
Hi, |
|
@killing The changelog for version 8.0 mentions the release of a new version of Seafile's encrypted library format. Can you please elaborate on what the differences between v3 and v4 are? |
|
The only change we made in v4 is changing from AES128 to AES256 for data encryption. Due to a mistake in the code, AES128 was chosen (only) in v3 as the encryption algorithm, which is less secure than AES256. |
|
Almost a decade... has passed... and this issue is still open. Hard to believe. |
Hard to believe that it's almost as long from when this issue opened to when I commented, as it is from my comment until now! |
In the developers' defense, they answered seven years ago, and repeated from time to time that no further improvements are planned. We may not like this, but we can´t be surprised they don´t have a different answer each time we ask. I assume this issue is intentionally left open in case anyone finds it important enough to pick it up themselves. Currently, file contents are encrypted but metadata is not. This is similar to ecryptfs as used in Linux Mint or password protected zip files. Apparently they believe this content encryption is good enough to run on your own hardware, and rather work on different projects like SeaTable. One frequently used solution for private clouds is to use ZFS storage with native encryption for your data, so when your hardware is stolen, no one can read the storage contents because the key to mount ZFS is on a different machine. If you still think your metadata is so confidential that you can't trust it on your own hardware, you may want to search for a different file hosting implementation, although you may find that nothing beats Seafile in terms of speed. It's a trade-off you may be willing to make. Keep in mind that there aren't many (FOSS) mature solutions out there. NC has a disclaimer too:
NC does have a bigger team with larger resources, so you can be confident that any progress on beta features will be faster there than with Seafile. To summarize some of your options:
I don't think further "reminders" will yield different results. |
If you don't want to do it server side, you can also consider something client side like cryptomator (but it add another layer of complexity, because is another software that have to be installed client side) |
I spent some time auditing the crypto constructs for Seafile's encrypted repos, because I'd like to help make Seafile more secure and trustworthy. I found some significant problems.
An attacker who obtains a copy of the encrypted library without the key can:
Furthermore, since the same initialization vector is reused for all chunks, the library is vulnerable to watermarking and known-plaintext attacks.
The first problem is straightforward to solve: encrypt all file and directory entries, not just the content chunks.
The second problem (predictable IVs) is not as easy to fix. To maintain seafile's existing deduplication and synchronization capabilities, you want deterministic encryption. But maintaining semantic secrecy with deterministic encryption is probably not possible.
As a practical improvement, you could use an HMAC of each chunk as its IV. This is still deterministic, but it would at least prevent chunks with the same prefix from sharing the same ciphertext prefix.
To achieve strong secrecy, Seafile would need to give up deterministic encryption. This can still provide reasonable reduplication and efficient sync, but it would require clients to maintain their own cached mapping from chunk sha1 sums to their encrypted identities. You may want to look at how the Tarsnap client does something similar.
The text was updated successfully, but these errors were encountered: