-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCL support for cracking Android Backups #3261
Conversation
The nelenkov/android-backup-extractor#57 (add support "MIUI BACKUP" magic header) idea looks interesting as a future enhancement. However, I don't have a Xiaomi device and |
The following patch should do the trick for diff --git a/run/androidbackup2john.py b/run/androidbackup2john.py
index 2e30bd6a7..8bebefe08 100755
--- a/run/androidbackup2john.py
+++ b/run/androidbackup2john.py
@@ -46,6 +46,15 @@ def process_file(filename):
"""
with open(filename, "rb") as f:
magic = f.readline()
+
+ # Untested hack for "Xiaomi-MIUI backup"
+ while True:
+ line = f.readline()
+ if not line:
+ break
+ if line == BACKUP_FILE_HEADER_MAGIC:
+ magic = line
+ break
if magic != BACKUP_FILE_HEADER_MAGIC:
sys.stderr.write("[!] Magic missing from file, is this an Android Backup?\n")
return Update: A modified version of this patch is committed now. |
On
This OpenCL runtime reports GPU utilisation just fine. |
It should just work (under Linux) provided device is supported (nvidia or AMD). I have no means of maintaining the AMD stuff - if they changed something from the ADL we're using, we're not supporting it. Windows support should be easy to fix, although I refuse to touch that shite so someone else has to. Unfortunately macOS doesn't seem to support any sensor queries. |
@magnumripper Ah, I see. Thanks! Yeah, I was running macOS for the first set of benchmarks. |
pad_byte = out[length - 1]; | ||
if (pad_byte > 8) | ||
return 1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this will not result in false negatives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have the if (check_pkcs_pad(out, length, 16) < 0)
call above it.
I believe that with these two checks we have ensured that last 9 padding bytes of the decrypted text should be the same. This should be good enough, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant is: Are you sure there can't be a valid padding of 8 or less? Why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I missed reading the false negatives word correctly.
I have added the following comment to the code regarding this.
// The structure of masteykey_blob is fixed:
// + masteykey_blob -> length_1 (byte) + IV (16 bytes) + length_2 + masteykey (32 bytes) + length_3 + checksum (32 bytes) => total of 83 bytes
// + padding -> this data blob of 83 bytes gets 13 bytes of padding making the masteykey_blob_length = 96 bytes always
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implies that padding is always 13 bytes in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
src/opencl_androidbackup_fmt_plug.c
Outdated
* be chosen for a kernel duration of not more than 200 ms | ||
*/ | ||
#define HASH_LOOPS 1024 | ||
#define ITERATIONS 4098 /* Just for auto tune */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Just" for autotune? An incorrect figure here will result in suboptimal autotune. Since all of your test vectors seem to use 10000 I'm guessing that figure should be here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. Fixing now.
Current speed,
@magnumripper Hey, how do I get the format to emit GPU utilisation figures automatically?