Skip to content

Possible Argon2id incorrect derived key #1614

Description

@huven

Posting this as there might be an issue with the Argon2id KDF (currently in beta).

I'm not sure if there is an issue (I might be making a mistake myself) , but if there is I think it is important to get this fixed before this feature leaves beta.

Note: I'm the author of Disk Decipher, iOS app that supports VeraCrypt format, so I think I have a pretty good understanding of how this is supposed to work.

Expected behavior

I expect to be able to derive the key manually and use it to decrypt the header

Observed behavior

Header decryption fails when I derive the key myself.

Steps to reproduce

  1. I created a test container on Win10 (x64) using VeraCrypt Portable 1.26.27.
    To reproduce, you can download it here. The password is 1234. It mounts without issue on the device where it was created as expected. It uses AES cipher and Argon2 KDF.
  2. Next step is to derive the header key, I tried it with two different implementations, both arrive at the same result. Here is a command line version on Linux for easy reproduction:
$ echo -n 1234 | argon2 "$(head -c 64 test_argon2id.hc)" -id -t 6 -k 425984 -p 1 -l 64 -r -v 13
48bf17e760158d23a02b123e31bb2fd78d9b55f7bd530d8be5a5f0c8feea508ce3072386adb5d932701ec2c04a0ebc51a24cbd8d754385fe7f9a44d29f90e12b
  1. I then feed this key to the header-decryption routine, which fails to produce the expected VERA signature. This same routine is used for the other KDF's, it just takes the header and the key as input (has no knowledge how the key was derived).
    I don't have a command line version for this yet, will add when I have one.

I've triple checked all steps, code and also looked at the implementation in VeraCrypt. All looks correct, yet the decryption fails, so there is an issue hidden somewhere. This may well be an error on my side, but could also be an issue in VeraCrypt. The latter is important to fix before people start using this to encrypt their data.

To debug this, it would be great if someone with a Windows x64 build environment loads the test container linked above, and sets a breakpoint at line 482 of Volumes.c (after magic number verification). Please inspect the first 64 bytes of cryptoInfo.ks and cryptoInfo.ks2 to see if they match the (combined) derived key shown above in hex.

If they are different then that would explain why the manual decryption fails, though we still need to find out why they are different.

Screenshots

Your Environment

Please tell us more about your environment

VeraCrypt version: VeraCrypt Portable 1.26.27

Operating system and version: Windows 10 build 19045

System type: x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions