0
votes

I have an AES-encrypted string ( out of a user backup of a discontinued App) that I want to decrypt.

What I have:

json file with:

  • Info that key was created with PBKDF2
  • salt
  • encrypted string

I do know the password, with which the backup was created, probably the password also for PBKDF2

Is there a way to find out with what parameters the string was encrypted? i.e, how the key was created

Is there an easy way to decrypt the string?

1
First you need the app to reverse it and extract the parameters like the iteration of PBKDF2 and the used hash algorithm. Without that knowledge it is worse than finding a needle in a hay stack. If the app is no longer available in any store ask around. Usually someone has still a copy of the app stored somewhere. - Robert
reverse engineering the app ist most probably beyond my abilities. - pubgrub
I’m voting to move this question to security.stackexchange.com. - mti2935

1 Answers

0
votes

Fortunately, reverse engineering the encryption method and the way that the ciphertext (and possibly other information necessary for decryption) is stored in the file, is a lot easier than trying to crack the password that was used to derive the encryption key. Being that you know the password that the key was derived from, there may be hope.

Is the encrypted string from the json file encoded using an encoding method that you recognize, such as hexadecimal or base64? If so, then when you decode the encrypted string, is it exactly 128 bits?

If so, then the problem gets significantly simpler, because this means that it's only one block of AES encryption. This means that you don't have to worry about the encryption mode (e.g. CBC, GCM, ECB, CTR, etc), or the IV if it's a block cipher mode such as CBC.

In addition, if there is information in the json file about the inputs to the PBKDF2 function (e.g. number of iterations, and/or hash algorithm), this can be helpful.

In the end, it comes down to trial and error, where different values for the parameters that you don't know are tried, until the correct parameters to the PBKDF2 function are found, which produces the correct key, to decrypt the cipher text. This also requires that you know something about the plaintext, in order to know when the decryption was successful.

Of course, the more parameters that unknown, the more rounds of trial-and-error are necessary. If the number of rounds of trial and error are reasonable given an allotted amount of time and resources, then the process can be automated in a fashion similar to https://security.stackexchange.com/questions/226935/write-a-python-or-c-program-to-guess-the-key/226950#226950.