fix(checkm8): only pause after the spray on usbipd-win

Stage 3 ended with an unconditional 1 s sleep before stage 4. The delay was added for usbipd-win, where the vhci layer frees the spray buffers late, but on a native host the reference implementation goes straight from the spray to the overwrite.

An idle second between the last confirmed STALL and the overwrite is a window in which the device can leave dfuIDLE on its own. When it does, the next control transfer returns LIBUSB_ERROR_NO_DEVICE (-4) and the sequence fails at stage 4 with no other trace. Keep the pause only where it is needed.
This commit is contained in:
debian 2026-11-29 09:18:00 -03:00
parent c11210d73f
commit e92bc7ab78

View file

@ -296,8 +296,17 @@ int checkm8_stage_spray(exploit_ctx_t *ctx)
*
* Wait 1 second to ensure all spray buffers are freed by the
* device before stage 4's DFU_DNLOAD allocation.
*
* This delay is only required on usbipd-win, which is the setup
* that motivated it: the vhci layer adds latency and the buffers
* are freed late. On a native host the reference implementation
* goes straight from the spray to the overwrite, and the idle
* second is a window in which the device can leave dfuIDLE on its
* own. When that happens the next control transfer returns
* NO_DEVICE (-4) and the sequence fails at stage 4.
*/
usleep(1000000); /* 1 s */
if (getenv("WSL_DISTRO_NAME") != NULL)
usleep(1000000); /* 1 s -- usbipd-win only */
ctx->phase = EXPLOIT_PHASE_SPRAY;
log_info("checkm8: stage 3 complete -- heap spray done");