fix(exploit): Rewrite setup and spray stages to match gaster
Corrected setup stage padding logic to properly handle config_overwrite_pad without 8-bit truncation. Fixed spray large_leak wIndex and no_leak hole creation to match gaster's exact USB transfer sequences. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5fa99730e6
commit
5fccb44766
3 changed files with 413 additions and 131 deletions
|
|
@ -31,6 +31,18 @@
|
|||
#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
|
||||
#define USB_ABORT_TIMEOUT_MIN 0
|
||||
|
||||
/*
|
||||
* Apple DFU devices report serial number at descriptor index 3.
|
||||
* USB_MAX_STRING_DESCRIPTOR_IDX (10) is used as wIndex in GET_DESCRIPTOR
|
||||
* requests to trigger the string descriptor allocation path.
|
||||
*/
|
||||
#define DFU_SERIAL_IDX 3
|
||||
#define USB_MAX_STRING_DESC_IDX 10
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* CPID classification helpers */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
|
@ -172,4 +184,47 @@ int usb_ctrl_transfer_async(libusb_device_handle *dev,
|
|||
uint16_t wLength,
|
||||
unsigned int timeout_ms);
|
||||
|
||||
/*
|
||||
* usb_ctrl_transfer_async_ret -- Send a control transfer with a short
|
||||
* timeout, returning the number of bytes actually transferred (or -1
|
||||
* on hard failure, 0 on timeout). Used for abort-based setup.
|
||||
*/
|
||||
int usb_ctrl_transfer_async_ret(libusb_device_handle *dev,
|
||||
uint8_t bmRequestType,
|
||||
uint8_t bRequest,
|
||||
uint16_t wValue,
|
||||
uint16_t wIndex,
|
||||
unsigned char *data,
|
||||
uint16_t wLength,
|
||||
unsigned int timeout_ms);
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Spray helpers (checkm8_spray.c) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* checkm8_usb_request_stall -- Send a SET_FEATURE to EP0x80 to provoke
|
||||
* a STALL. Returns 1 if the device STALLed, 0 otherwise.
|
||||
*/
|
||||
int checkm8_usb_request_stall(libusb_device_handle *usb);
|
||||
|
||||
/*
|
||||
* checkm8_usb_request_leak -- Async GET_DESCRIPTOR with 1ms timeout
|
||||
* and EP0_MAX_PACKET_SZ length. Returns 1 if sz==0, 0 otherwise.
|
||||
*/
|
||||
int checkm8_usb_request_leak(libusb_device_handle *usb);
|
||||
|
||||
/*
|
||||
* checkm8_stall -- Repeatedly send GET_DESCRIPTOR with variable abort
|
||||
* timeout until the device responds with a short transfer and a
|
||||
* successful leak request. Matches gaster's checkm8_stall().
|
||||
*/
|
||||
void checkm8_stall(libusb_device_handle *usb);
|
||||
|
||||
/*
|
||||
* checkm8_no_leak -- Async GET_DESCRIPTOR with 1ms timeout and
|
||||
* (3*EP0_MAX_PACKET_SZ + 1) length. Returns 1 if sz==0, 0 otherwise.
|
||||
*/
|
||||
int checkm8_no_leak(libusb_device_handle *usb);
|
||||
|
||||
#endif /* CHECKM8_INTERNAL_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue