Menu

Be aware of CommandLine usage (Security Hole?)

WRVC2016
2016-02-09
2016-02-12
  • WRVC2016

    WRVC2016 - 2016-02-09

    Both TrueCrypt and VeraCrypt:

    If you use commandline usage with password, keyfiles, and PIM, there is a way to grab that information after a successful mount. I won't show how to do it on here. If a VeraCrypt Developer would like to contact me on this, please feel free.

    Of course the concern of this is when there is a successful mount and someone has temporary access to your computer (such as desktop supporter), he/she can use this method to grab all commandline information (including password, keyfiles, PIM, etc...) This does not happen when using the regular User Interface mounting.

    Is this known and deliberate?


    I also have read the Security Model on page 88 of the user guide. It may fall in this section (VeraCrypt does not):

    Secure any data on a computer if an attacker has physical access to the computer between
    the time when VeraCrypt is shut down and the time when the entire contents of all volatile
    memory modules connected to the computer (including memory modules in peripheral
    devices) have been permanently and irreversibly erased/lost.


     
  • Enigma2Illusion

    Enigma2Illusion - 2016-02-09

    Unless you have found a method to see previous session’s commands, you can only see the previous commands of the current session until the user closes or exits the command line window since Windows OS stores the previous command line information in the computer's memory.

    Even closing the command line window may not mean that the computer's memory has been securely wiped of the previous session commands. If the memory is not securely wiped by the OS, then only a shutdown of the machine with certain duration to allow the memory to decay its current state will wipe the commands.

    https://veracrypt.codeplex.com/wikipage?title=Unencrypted%20Data%20in%20RAM

     

    Last edit: Enigma2Illusion 2016-02-09
  • WRVC2016

    WRVC2016 - 2016-02-09

    Even when the command line window closes, I can still obtain all previous command line information for VeraCrypt.

    This means that those who use commands through the CMD.exe or Scripts (to launch VeraCrypt/TrueCrypt), there is a risk. Again, the information is NOT obtainable when using the graphical user interface.

    HOWEVER, with the link that you provided, maybe it is not an issue to worry about since the RAM is not encrypted anyway. It stated that the password is stored unencrypted in RAM. What about keyfiles and PIM?

    Are you a Developer working with Mounir IDRASSI? If yes, how can I private message you on here?

    Thanks

     
  • Enigma2Illusion

    Enigma2Illusion - 2016-02-09

    I am a user of TrueCrypt and now use only VeraCrypt. I volunteer my time by helping users on the forums to reduce Mounir's workload.

    My understanding is whatever sensitive information you entered on the Windows command line to mount the VeraCrypt volume would be stored in the memory by Windows OS for the command line history.

    You can email Mounir via the forum by clicking on his name in one of his posts and CC yourself. You will see a Send Message button in the top right corner.

    Can you access the previous session commands after a reboot of the PC? If yes, then this would indicate that Windows is storing the previous commands to a file on the C drive. I hope that is not the case. :-)

    I am running Win 7 Pro 64-bit system. What version of Windows are you using? I am curious if the issue you are reporting is unique to a certain version of Windows.

    Kind Regards.

     
  • WRVC2016

    WRVC2016 - 2016-02-09

    Hi Enigma,

    Thank you for introducing yourself and the instruction. Also, thank you for your time and helping others.

    I am in the same boat with you and in the process to change everything from TrueCrypt to VeraCrypt. VeraCrypt PIM is an extra step but it does provide a much better security. No complaint here.

    I am running Windows 7 Ultimate 64bit. No, I cannot access the previous session commands after a reboot. Once VeraCrypt executables are close, everything is inaccessible because I also have it on wipe cache and password.

    I will email you and Mounir the code later today.

    Recreation Steps: Try mounting VC object through command line (or through script) and then run the code that I will provide. Then you will see the Password, KeyFiles, PIM, HASH are exposed. I think exposing this information defeats the purpose of a masked field. Again, this does not happen when using Graphical User Interface.

     
  • Mounir IDRASSI

    Mounir IDRASSI - 2016-02-09

    The documentation is clear about the thread model.
    It is a chicken-egg problem: you encrypt you data with a key that must be used for decryption on-demand but how to protect the key? If we use another key, how to protect this new key? etc...
    There is no solution to this unless you have a dedicated hardware the perform all the encryption/decryption operations outside the operating system. Another solution is to use an operating system that creates "RAM firewall" so that even a user with administrative privileges can't access kernel RAM where keys are stored.

    Some people would jump and say that using a TPM would protect against this but this is not true. A TPM can not perform on-the-fly encryption/decryption which is done solely by CPU so the key must be extracted from TPM and copied to RAM in order for encryption/decryption to proceed.

    Going back to password/PIM/keyfile: VeraCrypt do all what is possible to clear sensitive information from memory after it is not longer in use. Specifically, when processing password/PIM/keyfile, they are copied in non-pages memory that, in theory, is never copied to disk/swap memory. And after the processing is finished (mount done), all sensitive information are erased from memory and only the master key is kept in the driver non-pages memory to allow of on-the-fly encryption/decryption operations.

    As Enigma2Illusion explained, after a Windows session is closed, normally it should be impossible to retrieve command line arguments used in it. Of course, obtaining command line arguments from the same session is easy and it has the same attack surface as for keylogging, so it is out of scope of VeraCrypt protection perimiter.

    In VeraCrypt, we try to limit the attack surface to the minimum possible. In this context, every possible protection to reduce/eliminate leaks will be implemented. So, please feel free to contact me as Enigma2Illusion explained. You can also send an encrypted email to veracrypt [at] idrix dot fr using the official VeraCrypt PGP key.

     
  • Mounir IDRASSI

    Mounir IDRASSI - 2016-02-10

    Thank you WRVC2016 for privately sending me the code to extract the command line information.

    My tests show that Enigma2Illusion statement is correct: after the session is closed, the command line parameter can not be retrieved.
    So, we are left with an attack that runs on the current user session.

    Unfortunately, I don't think we can do anything to fix this since it is a Windows "feature"

    On potential solution would be to implement a kind of pipe support when sensitive parameter would be passed by script through a pipe instead of the command line.
    This has already been request as a feature more than a year ago: https://veracrypt.codeplex.com/workitem/68
    Nothing has been so far on this and this could a good milestone for the 1.18 version alongside the implementation of secure desktop on Windows for password entry (https://veracrypt.codeplex.com/workitem/231).

     
  • WRVC2016

    WRVC2016 - 2016-02-12

    Thank you Mounir!

    "So, we are left with an attack that runs on the current user session."

    Correct and your previous analogy of "It is a chicken-egg problem" explains it all. It would be a good milestone to meet this.

    Otherwise, the usage of mask password fields only hinders the inexperience hackers. With that being said, I will avoid using commandline to launch VeraCrypt. I will use the User Interface since the code that I provided to you cannot siphon the information from the commandline when using direct User Interface. That leaves the only other option is an attack on the RAM to extract vital information which I have good faith in you and your Developers to secure this down the road. No rush because this was inherited from the TrueCrypt days.

    Thanks

     

    Last edit: WRVC2016 2016-02-12

Log in to post a comment.