1

If I have a Veracrypt container, and I use a key file with a password, if the key file is too simplistic, is it possible to recreate that key file and open the container?

Suppose if I use a .jpg of a simple image, can an attacker open up MS Paint (or a similar program), and recreate the image, and use it with the password to open the container, or would they need direct access to the original image?

3
  • 1
    That depends, can the attacker create the exact same pixels as the original image and save it with the same compression parameters and metadata?
    – user
    Oct 7 '19 at 16:42
  • @user - I guess you would have to look at how editing programs write the image files, I'm not certain myself, this is why I'm asking :D.
    – user219292
    Oct 7 '19 at 16:46
  • It would be very difficult. If an attacker had a photo of a screen with the key image on it or something similar then it might be possible to set up a program to attempt to try various combinations of compression settings and similar images, but just trying to brute force an image (even with something simple like 32x32 RGB image) would take a long time.
    – user
    Oct 7 '19 at 16:49
3

From the Veracrypt documentation, it looks like they are using a hash of the keyfile contents and the password to derive the header key.

Due to the nature of hashes, a change to any single bit of the input will cause a large number of changes to the calculated hash value. This is true for all hash functions by design.

However, they only use the first 1 MB of data from each keyfile. While a person is extremely unlikely to duplicate your image accurately enough to generate the header key (this is virtually impossible), any file with the same 1st MB of content would work. This won't be an issue with JPGs, and I wouldn't expect it to happen under normal circumstances.

So, in summary, it is virtually impossible for them to unlock the volume without that original file---or at least the first MB of it. Be careful where you keep the keyfile, and securely delete it when moving it.

1

if the key file is too simplistic, is it possible to recreate that key file and open the container?

Yes. For the right definition of "simplistic".

VeraCrypt will use up to the first 1 MB (1024 kilobytes) of the file.

For a plaintext file, it is easy to see that the same text could be written, leading to the same keyfile (this would allow you for instance to save a paper backup of your keyfile).

For an image, the definition of simplistic is probably not the same you would use in a casual conversation. Even for an image that was made of a few 'simple' lines, in order to recreate it you (or a computer trying to bruteforce your image) would need the exact same, saved with the same settings, since even a one pixel difference would likely reflect in those 1024 kilobytes (unless it's a large image) and thus be unable to be used for opening the veraCrypt container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy