Add support for non-ASCII passwords#66
Add support for non-ASCII passwords#66kholia wants to merge 1 commit intonelenkov:masterfrom kholia:master
Conversation
|
I got this idea, of only checking the PCKS5 padding to verify the password, while working on openwall/john#3261 (OpenCL support for cracking Android Backups) and related issues. |
|
Hacky indeed :) The proper way to handle non-ascii password is to fix the key derivation, why do you think that checking the padding is enough? Also, why if (pad_byte < 8)? Technically, you could have 1,2, etc. bytes of padding. |
|
I have answered this question at openwall/john#3261 (comment). In short, This implies that padding is always 13 bytes in practice. Good question! |
|
Hi, I get the fixed padding part. However, this format has checksum that allows you to verify if derived key is correct. Why not just use that (aside from the slight performance optimization)? If buildPasswordKey() is called with utf8=true, non-ASCII passwords should work fine. |
|
Yep, the format does have a checksum. However, the process of calculating a checksum is problematic. The program does Also, I could not find a way to port |
|
Hm, checking the checksum is still better than only checking padding. Is the current code broken for non-ASCII passwords? AFAIK, that code was added to handle both v1 and v2 backups (with UTF-8 support) As for porting to C, you'd need to use iconv or similar to get proper unicode support. |
Yes! This is the reason behind this PR.
Checking proper padding of length 8 is quite safe. To make it even safer, I can check for proper padding of length 13. In JtR project, we rely on these padding checks for cracking passwords. We are able to do this without triggering false positives. By removing the hacky checksum checking code, I think we will be able to decrypt a wider variety of encrypted backup files. I am not 100% sure about this last statement though. |
I have tested this with Android 4.4.4, Android 6.0, and Android 8.0 ADB backups.
This patch is somewhat hacky but hopefully the general idea is reusable.