Kunzisoft / KeePassDX

Lightweight vault and password manager for Android, KeePassDX allows editing encrypted data in a single file in KeePass format and fill in the forms in a secure way.
https://www.keepassdx.com/
GNU General Public License v3.0
4.32k stars 261 forks source link

New attachments are empty in KeePass2 but not in KeePassXC #715

Closed J-Jamet closed 3 years ago

J-Jamet commented 3 years ago

This problem is very weird, because it seems that the attachments are attached correctly in the header but they are not correctly decrypted by KeePass2 but clearly visible by KeePassXC. (Note: Also correctly visible in KeePassDX)

Only with KBDX 4.0 databases, KDBX 3.1 uses attachments in the XML and not in the header.

J-Jamet commented 3 years ago

demoErrorKDBX4.zip password : secret

In this example, the entry My Computer / SSH Key contains two attachments: _"idrsa" and _"idrsa.pub". In KeePass2, _"idrsa" has the contents of _"idrsa.pub" and _"idrsa.pub" is an empty file. In KeePassXC, both attachments are read correctly. In both cases, the history is correct.

J-Jamet commented 3 years ago

I did a lot of testing, checked the data formatting but still don't understand the problem. If anyone has any advice on empty attachments in KeePass2, this might help.

mlunax commented 3 years ago

~I don't know what makes this but I want to notice, the otp fields or have the otp url or is empty. Trying to use this fields in DX clears the otp url.~

J-Jamet commented 3 years ago

~@mlunax It's another bug, will be fixed in version 2.9.2~

J-Jamet commented 3 years ago

(from Dominik) In your demoErrorKDBX4.kdbx file, the third and the fourth binary content in the inner header are identical. As KeePass assumes that a deduplication has been performed, the fourth binary content is ignored and the indices are interpreted differently from this point on. I guess it's more likely that an application doesn't perform a deduplication than accidently storing a binary content multiple times in the inner header. Therefore, I've now added support for loading duplicate binary contents for the next KeePass release. With this, your demoErrorKDBX4.kdbx file can now be loaded with KeePass.

It is therefore necessary to remove file duplication in binaries.

Vstory commented 3 years ago

This problem is solved, great!