2

I created an answer file using Windows System Image Manager (SIM). I stored the password and set it to hidden, resulting in some form of hashed password.

Does anyone know what format this takes? I am hoping to be able to generate the password in a batch script and replace the value, filling it in at install time to a currently set password, but that depends on it being possible to generate.

1 Answer 1

3

The password stored in the Sysprep XML file is not hashed. The string you see there is simply the unicode string encoded in Base64 and can easily be decoded using any web page or Powershell.

http://blog.compower.org/2013/08/05/recover-the-non-plain-password-from-your-unattend-xml/

(Example copied from page referenced above)

Copy the string after and past it in a file (pwd.txt) for example and copy it to your local machine with full Windows and Powershell. Then you can recover the password by doing the following:

PS>$encryptedpwd = get-content C:\temp\pwd.txt
PS>$encryptedpwd
VABoAGkAcwAgAG4AbwB0ACAAbQB5ACAAcgBlAGEAbAAgAFAAYQBzAHMAdwAwAHIAZAA=
PS>[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($encryptedpwd))
This not my real Passw0rd

The following page (again from the prior link) provides further details on working with Base64 string using powershell, and could be used as a starting point to figure out how to directly encode said passwords yourself:

http://tfl09.blogspot.nl/2013/02/working-with-base64-strings-in.html

That said, as it's not hashed or encrypted in any way, there's no real security benefit to doing so.

3
  • I'm really only concerned with generating the password rather than decoding so that I don't have to leave it in cleartext, but the lack of security gain from encoding it is a bit disappointing, it's almost just as well to leave it cleartext but for the fact that some wouldn't know how easy it is to decode.
    – Centimane
    Aug 13, 2015 at 15:41
  • @Dave and how exactly would you propose this be done otherwise? In order to have it encrypted there needs to be a secret, which is the only way of decrypting the cipher. Which in other words means that the computer attempting to decrypt the cipher needs to have access to the secret, so you'd have to find a way of passing the secret to the computer processing the unattend.xml file. However when the unattend.xml file is processed the computer has no access to network, meaning the secret has to already be on the computer in a non-encrypted state so ... chicken and egg situation
    – cogumel0
    Jul 10, 2016 at 11:43
  • Well actually in my case the machine does have network when booting because the winPE is loaded over the network, and then it does some scripting to determine the correct unattended.xml to use (basically PXE boot windows). I was looking for something akin to in Linux KS files that allow you to use SHA encryption for the password, something a little harder to decrypt than unicode.
    – Centimane
    Jul 11, 2016 at 13:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .