1

Back on Mac OS 10.7, there was an encrypted file called Form Values in the folder /home/Users/${user}/Library/Safari. This encrypted file contained all "auto-fill" form values in Safari. I don't know if this file still exists on current version, but during some analysis of an old mac of mine, I found this encrypted file and wanted to dig into it.

This file seems to be encrypted with a key contained in the user's login.keychain. I have the key (256 bits long) but I was not able to find the correct way to decrypt data.

According to this answer https://apple.stackexchange.com/a/198290/332020 the file is encrypted with AES-128 bits. But none of my implementation did work (AES-128 with first 128 bits as salt, 128 after as key, ECB, CBC, ...). Since Mac OS 10.7 was released in 2011, I also tried 3DES, without luck also.

Does someone know more about the encryption process?

  • Please be more specific about how you tried to decrypt it (with which commands) and how they failed. Also, the answer in the original question points to a tool which claims to be able to decrypt the file. Have you tried it that already? – nohillside May 12 at 15:47
  • @nohillside I will update my question tomorrow with the source code. Also, the tool is not available anymore. – Flo354 May 12 at 16:05
  • Please be aware that "Code-level programming questions (cocoa, LLVM, etc…) are off-topic here. We do encourage AppleScript, Automator, and UNIX shell scripting questions as well as how to use tools like Xcode for non-language specific tasks." Code-level questions can be asked on StackOverflow. – nohillside May 12 at 16:41
  • I understand, but my question is not about the code. I know how to use crypto and the code I use is used on multiple product. My question is about understanding a feature relative to mac (Safari). That's why I didn't asked it on stackoverflow, since what I don't know is the encryption process used by Safari on Mac, and not how to program it. – Flo354 May 12 at 16:44
  • The Windows version of the tool is still available (guidancesoftware.com/app/Safari-Form-Values-Decryptor), as is the original article (web.archive.org/web/20161026122600/http://…) – nohillside May 12 at 16:59
2

So... After hours research, I finally found the encryption process.

The password contained in the keychain is NOT the encryption key! The password has to be derived to obtain the key. The process is as follow: PBKDF2_SHA1(password: passwordFromKeychain, salt: someSalt, iterations: 1000, outputLen: 128)

Then the cipher can be easily decrypted. It is simply AES-CBC-128 with PKCS5Padding and no IV (or IV = [0, ...])

The output will be a binary PLIST which can be read by any program having such capability. Thus, you can know if the decryption process is successful by verifying the first 6 byte are equals to: "bplist".

I wrote a code (JAVA) to do the decryption: https://github.com/Flo354/SafariFormValuesDecryptor

  • 1
    Thanks for coming back and answering your own question! – nohillside May 13 at 18:33
  • Thanks, but I find your description incomplete - and I don't have a clue as for what PBKDF2_SHA1 is, where to find it, and where to get the "someSalt" thing etc. You'll need to be more detailed, and PLEASE also tell how to to the other way - encrypt back the data so Safari can use it. – Motti Shneor Jun 3 at 10:47

You must log in to answer this question.

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