Menu

Permanently decrypted twice, and lost all data?

2022-10-09
2022-11-04
  • Alex Langhart

    Alex Langhart - 2022-10-09

    I assumed that veracrypt was smart enough to only decrypt blocks of data
    that were actually encrypted, but apparently it IS NOT.

    Here's my timeline:

    • Windows system drive was encrypted, working fine for months
    • Changed password on the drive
    • Rebooted, the boot loader rejects old password as expected, accepts new
      password as expected, but then Windows says a required device is not
      present and it can't boot
    • After some troubleshooting I decide to permanently decrypt the drive. I'm
      then able to view the file contents from a live OS that mounts the drive
    • The boot loader still prompts for the password, still accepts the new
      password and rejects anything else. Still get errors about Windows not
      finding the device.
    • Using the recovery USB, removing the veracrypt boot loader doesn't do
      anything. No confirmation or anything, it just shows the menu again.
      Nothing I do from the USB or BIOS/UEFI settings will remove the prompt.
    • At some point it somehow decides to boot the Windows OS successfully,
      though after rebooting it went back to the password prompt and boot loader
      error.
    • On some forum someone mentioned doing the decryption twice; the first
      time it decrypts and the second time it removes the boot loader.
    • I run the "(d) Decrypt OS" again. I assume it's going through the disk
      looking for any still-encrypted segments that need to be decrypted.
    • No. It's "decrypting" unencrypted data, essentially shredding it into
      random bytes.

    So now as far as I can tell my entire drive is gone. Unless there's some
    way to make veracrypt do a "reverse decryption". Simply encrypting the
    drive again using the normal guided process wouldn't work because that
    collects entropy for salts, which wouldn't match the original encryption.

    Am I screwed? (Yes I know I should've backed it up, but I didn't have an
    extra drive large enough, and I figured this was routine enough that the
    happy path would be mostly bug-free)

    I don't understand why veracrypt wouldn't maintain some sort of
    validation/checksum on each segment that it could use to know whether it's
    actually decrypting or just mangling data.

    Looking through the code
    https://github.com/veracrypt/VeraCrypt-DCS/blob/16fbd56d97193329966b66ead660fd23b66919b4/DcsCfg/DcsCfgMain.c#L215-L217,
    running dcscfgcmd -osdecrypt is how the recovery drive performed the
    decryption. I don't see a corresponding -osencrypt that could do the
    exact reverse, but I'm wondering if that could be added? Hoping someone
    more familiar with the algorithm would know if that could feasibly recover
    the data.

    I'm willing to do it myself if I can get some instructions on
    building/running it (though I don't currently have a working Windows system
    to build on, so if someone else could build for me I would greatly
    appreciate it).

     
    • Alex Langhart

      Alex Langhart - 2022-10-10

      I have a branch that attempts to add this. I’ll open a PR for feedback

       

      Last edit: Alex Langhart 2022-10-10
  • Enigma2Illusion

    Enigma2Illusion - 2022-10-10

    FYI for future reference, if you have system decrypted using the Windows VeraCrypt GUI (not using the VeraCrypt Rescue disk) and still get the VeraCrypt bootloader, press the ESC key to by-pass the VeraCrypt bootloader to continue to boot Windows OS since the OS partition is decrypted.

    Using the Windows VeraCrypt GUI (not using VeraCrypt Rescue disk), decrypt again to remove the VeraCrypt bootloader.

    EDIT
    Since you were unable to boot into Windows, use the following procedures:

    1. Use the VeraCrypt Rescue disk to decrypt the system encryption. Do not interrupt the decryption process.
    2. When finished, if you get the VeraCrypt bootloader, press the ESC key to by-pass the Veracrypt bootloader since the OS has been decrypted.
    3. Once Windows has repaired itself, boot back into Windows to use the VeraCrypt GUI (not using VeraCrypt Rescue disk) to decrypt the system encryption which should remove the VeraCrypt bootloader.

    End EDIT

    Your only chance to undue the double decryption using the Rescue Disk is to attempt to use the utility the developer created called VeraRescue.

    https://sourceforge.net/projects/veracrypt/files/Contributions/

    https://sourceforge.net/p/veracrypt/discussion/technical/thread/d24e6e89f9/?limit=25#8f47

    https://sourceforge.net/p/veracrypt/discussion/general/thread/3253a43678/?limit=25#7c0e

     

    Last edit: Enigma2Illusion 2022-10-10
  • Alex Langhart

    Alex Langhart - 2022-10-10

    I opened a PR that attempts to modify the OS rescue tool: https://github.com/veracrypt/VeraCrypt-DCS/pull/36

    I'll take a look at the links @enigma2illusion mentioned, but it looks like they have to run from a running Windows instance on the machine, which I don't currently have.

     
  • Alex Langhart

    Alex Langhart - 2022-10-11

    I got a new windows installation set up, and I'm trying to use VeraRescue, but having issues with the ISO file. I don't have the original zip/iso file for my recovery disk, but I do have the USB drive I made with it and its EFI directory. I tried adding that to a zip file and an ISO but it rejects both, saying "The selected iso file is not a valid VeraCrypt Rescue Disk". Any advice on how to get around that @enigma2illusion?

     
    • Enigma2Illusion

      Enigma2Illusion - 2022-10-11

      Sorry. I have no additional solutions to offer regarding your problems.

       
    • RealTehreal

      RealTehreal - 2022-10-14

      I've not tested any of it, but maybe this will help you, create an ISO from your USB key:
      https://www.tecmint.com/create-an-iso-from-a-bootable-usb-in-linux/

      Greets

       
  • Alex Langhart

    Alex Langhart - 2022-11-04

    Update: I made a janky python script to un-decrypt my drive and was able to get all my data back! It confirms that the drive was indeed decrypted twice.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.