-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
[Security] Use random IV for encryption #204
Comments
Thank you for this submission. A similar issue was reported a while back but this one really breaks it down, so I will keep it open. I may change the title and keep this as a todo for the future. |
Was reported in #177. |
Implementing this means we need some kind of migration for the users files, aswell as a new backup restoring version. |
I did not see the previous issue, but I do agree with the author. If you want to use a better key derivation function than SHA256, you might want to look at this ressource which recommends argon2id like mentioned in the previous issue. You might even want to change your password storage mechanisms to use that. |
**Description:** - Load images as whole bitmap and not as buffered source **Explaination** Loading AES/GCM encrypted files buffered/sampled. Causes the stream to skip bytes which is not allowed in AES/GCM. Since this raises the issue of crashing with very big images again. This is once of the reasons I want to overhaul the encryption some day to not use GCM anymore #204 Fixes #330 - [x] Confirmed working by @prosch88
I have made a concept for a new encryption https://excalidraw.com/#json=nGOvK_cvBiSmj9H2zC_Ms,kfxrwsOVJvm42KVdfAkOmg |
@leonlatsch do you have the current file format specification documented anywhere? I wasn't able to locate anything other than looking through source code. If you have that and a proposal for new format that would make it easier to get feedback before you commit to it. There are a couple of reddit crypto/privacy spaces that can be surprisingly friendly with feedback 😀 |
I started looking into this topic again. The main problem caused by the current implementation was fixed now (#198). What clear is that the hard part will be a migration, but thats step 2. Step 1:I (we) need to decide on a V2 of the apps encryption. Meaning:
Since we need to do a migration in any case, we have full freedom to choose anything we want. Current file format / encryptionAlgorithm: AES/GCM/NoPadding Problems
Step 2: MigrationOnce a new good encryption is implemented we need to find a way to migrate users data. Since were working with potentially very big data, this needs to have a UI aswell. I can imagine that its worth releasing a V2.0.0 and make it a breaking change, but we still need to find a way.
Step 3: Backwards compatibilityEspecially for backups. The app needs to somehow handle old data when you try to restore a old backup. Alternative: After updating the app show a notice that old backups are NOT compatible anymore and offer the user to do a new backup now. |
Description
Files are encrypted using a key and IV derived from the password.
Because this process is entirely deterministic, every file will be encrypted with the same Key/IV pair, which completely breaks the confidentiality offered by the GCM mode of operation. You can find more information about why this is bad here.
Impact
An attacker with access to encrypted files (which might require root privileges) and knowledge of a single photo, can decrypt and view every other photos without knowing the password.
Recommandation
Use a randomly generated IV for each encryption operation.
The text was updated successfully, but these errors were encountered: