fix: USB re-enum on retry, Path B iRecovery rewrite, DFU diagnostic, tests
Path A (checkm8): - Re-enumerate USB handle between exploit retries; prior code reused the stale handle after the device reset on a failed attempt, causing LIBUSB_ERROR_NO_DEVICE on attempts 2 and 3 - Add USB_RECONNECT_DELAY_USEC (2 s) constant; allocate exploit_ctx_t fresh per attempt so cleanup is symmetric with init Path B (A12+ bypass): - Replace broken SET_DESCRIPTOR serial write with libirecovery setenv; Apple A12+ BootROM always STALLs SET_DESCRIPTOR (LIBUSB_ERROR_PIPE) - Add step_reboot_to_recovery(): DFU_ABORT -> poll for PID 0x1281 - Add step_reboot_to_normal(): irecv reboot -> poll idevice_get_device_list - step_session_handshake() now runs after normal-mode reconnect so dev->handle is valid; previously called with NULL handle (DFU mode) - Expand path_b_execute() from 9 to 10 steps Device / DFU: - usb_dfu_read_info(): emit specific diagnostic when serial is the bare Apple DFU string (CPID=0); includes per-model button-sequence guidance start.sh: - DFU branch: derive support status from binary output instead of hardcoding SUPPORTED; gate_support() now reachable from DFU path - parse_device_info(): guard against empty output (binary crash / no lockdownd); print actionable advice, set DEV_STATUS=UNSUPPORTED - WSL: detect missing usbipd and print passthrough guidance after first poll timeout - Arch Linux: replace exit-1 with AUR install instructions Tests / build: - Add tests/test_sections.c: DFU serial parsing, chip DB lookup, bypass probe logic, retry/reconnect constants (26 tests, no hardware) - Add `make test` target; test build excludes USB/lockdown modules Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ee4e7c56fd
commit
5b758931ac
13 changed files with 1388 additions and 178 deletions
|
|
@ -11,8 +11,9 @@
|
|||
* 4. deviceActivation (offline/online) -> activation record
|
||||
* 5. HandleActivationInfoWithSessionRequest -> finalize
|
||||
*
|
||||
* This tool uses OFFLINE mode (design decision D2): stages 2 and 4
|
||||
* construct responses locally instead of calling albert.apple.com.
|
||||
* Offline mode: stages 2 and 4 construct responses locally (requires
|
||||
* patched mobileactivationd -- Path A jailbreak only).
|
||||
* Online mode: stages 2 and 4 contact albert.apple.com directly.
|
||||
*/
|
||||
|
||||
#ifndef SESSION_H
|
||||
|
|
@ -62,4 +63,40 @@ int session_create_activation_info(device_info_t *dev,
|
|||
int session_activate(device_info_t *dev, plist_t activation_record,
|
||||
plist_t handshake_response);
|
||||
|
||||
/*
|
||||
* session_drm_handshake_online -- Online stage 2: POST to Albert.
|
||||
* Serializes session_info to binary plist and POSTs to
|
||||
* albert.apple.com/deviceservices/drmHandshake. Parses the response
|
||||
* with libplist (handles both XML and binary formats).
|
||||
* On success, *handshake_response is a new plist. Caller frees.
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
int session_drm_handshake_online(device_info_t *dev, plist_t session_info,
|
||||
plist_t *handshake_response);
|
||||
|
||||
/*
|
||||
* session_device_activation_online -- Online stage 4: POST to Albert.
|
||||
* URL-encodes activation_info as XML plist and POSTs to
|
||||
* albert.apple.com/deviceservices/deviceActivation.
|
||||
* On success, *activation_record is a new plist. Caller frees.
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
int session_device_activation_online(device_info_t *dev,
|
||||
plist_t activation_info,
|
||||
plist_t *activation_record);
|
||||
|
||||
/*
|
||||
* session_probe_albert -- Diagnostic probe: dump CollectionBlob IngestBody
|
||||
* fields and run only the drmHandshake stage against Albert.
|
||||
*
|
||||
* Prints every key found in the signed IngestBody JSON so the caller can
|
||||
* confirm which fields (including iOS version) are inside vs. outside the
|
||||
* ECDSA signature boundary. Then POSTs to drmHandshake and reports the
|
||||
* HTTP status and top-level keys of the response — without proceeding to
|
||||
* deviceActivation (which would trigger FMiP rejection on locked devices).
|
||||
*
|
||||
* Returns 0 on success (drmHandshake HTTP 200), -1 on error.
|
||||
*/
|
||||
int session_probe_albert(device_info_t *dev, plist_t session_info);
|
||||
|
||||
#endif /* SESSION_H */
|
||||
|
|
|
|||
|
|
@ -33,10 +33,18 @@ int path_b_read_serial(device_info_t *dev, char *buf, size_t len);
|
|||
|
||||
/*
|
||||
* path_b_write_serial -- Write a modified serial descriptor to the device.
|
||||
* Sends a USB control transfer to overwrite the serial string descriptor
|
||||
* in the DFU interface.
|
||||
* Routes through path_b_write_serial_irecovery() which uses libirecovery
|
||||
* setenv commands from recovery mode (SET_DESCRIPTOR is rejected by A12+ BootROM).
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
int path_b_write_serial(device_info_t *dev, const char *new_serial);
|
||||
|
||||
/*
|
||||
* path_b_write_serial_irecovery -- Write serial via iRecovery setenv in recovery mode.
|
||||
* Device must already be in recovery mode (PID 0x1281) before calling.
|
||||
* Used internally by path_b.c step_manipulate_identity().
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
int path_b_write_serial_irecovery(device_info_t *dev, const char *new_serial);
|
||||
|
||||
#endif /* PATH_B_H */
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@
|
|||
{ .cpid = 0x8110, .name = "A15", .marketing = "iPhone 13 / iPhone SE (3rd gen)" },
|
||||
{ .cpid = 0x8112, .name = "M2", .marketing = "iPad Pro (6th gen) / MacBook (M2)" },
|
||||
{ .cpid = 0x8120, .name = "A16", .marketing = "iPhone 14 Pro / iPhone 14 Pro Max" },
|
||||
{ .cpid = 0x8130, .name = "A17", .marketing = "iPhone 15 Pro / iPhone 15 Pro Max" },
|
||||
{ .cpid = 0x8130, .name = "A17P", .marketing = "iPhone 15 Pro / iPhone 15 Pro Max" },
|
||||
|
||||
/* Null-terminated sentinel */
|
||||
{ 0 }
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@
|
|||
/* Exploit tuning parameters */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
#define MAX_EXPLOIT_TRIES 3
|
||||
#define STAGE_DELAY_USEC 10000 /* 10 ms */
|
||||
#define STALL_TIMEOUT_MS 1 /* 1 ms async stall */
|
||||
#define USB_TIMEOUT_MS 5000
|
||||
#define MAX_EXPLOIT_TRIES 3
|
||||
#define STAGE_DELAY_USEC 10000 /* 10 ms */
|
||||
#define USB_RECONNECT_DELAY_USEC 2000000 /* 2 s: wait for device reset between retries */
|
||||
#define STALL_TIMEOUT_MS 1 /* 1 ms async stall */
|
||||
#define USB_TIMEOUT_MS 5000
|
||||
|
||||
/* USB timeout for abort-based async transfers (matches gaster default) */
|
||||
#define USB_ABORT_TIMEOUT_DEFAULT 5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue