summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Alfie Cockell Gwinnett2022-10-11 18:05:08 +0100
committerGravatar Nikias Bassen2022-10-12 04:24:05 +0200
commitf8a92587b656a0ef793e9057fafdb67cf00a188d (patch)
tree0fb9244cd35d09a35bd9e98b3315ac05629942aa
parentf6950c2461b28333bcef84a98f2132e93b216faf (diff)
downloadidevicerestore-f8a92587b656a0ef793e9057fafdb67cf00a188d.tar.gz
idevicerestore-f8a92587b656a0ef793e9057fafdb67cf00a188d.tar.bz2
Check if device is limera1n-vulnerable for --pwn option
-rw-r--r--src/idevicerestore.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 62fbc09..186595b 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -482,17 +482,39 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
if (dfu_client_new(client) < 0) {
return -1;
}
- info("exploiting with limera1n...\n");
- // TODO: check for non-limera1n device and fail
- if (limera1n_exploit(client->device, &client->dfu->client) != 0) {
- error("ERROR: limera1n exploit failed\n");
+
+ // Check if device is vulnerable to limera1n
+ unsigned int cpid = 0;
+ dfu_get_cpid(client, &cpid);
+
+ int limera1nDevices[] = {8920, 8922, 8930};
+ int limera1nDevicesLen = sizeof limera1nDevices / sizeof limera1nDevices[0];
+ int limera1nVuln = 0;
+
+ for (int i = 0; i < limera1nDevicesLen; i++) {
+ if (limera1nDevices[i] == cpid) {
+ limera1nVuln = 1;
+ break;
+ }
+ }
+
+ if (limera1nVuln == 1) {
+ info("exploiting with limera1n...\n");
+ if (limera1n_exploit(client->device, &client->dfu->client) != 0) {
+ error("ERROR: limera1n exploit failed\n");
+ dfu_client_free(client);
+ return -1;
+ }
+ dfu_client_free(client);
+ info("Device should be in pwned DFU state now.\n");
+
+ return 0;
+ }
+ else {
dfu_client_free(client);
+ error("ERROR: This device is not supported by the limera1n exploit");
return -1;
}
- dfu_client_free(client);
- info("Device should be in pwned DFU state now.\n");
-
- return 0;
}
if (client->flags & FLAG_LATEST) {