From 34fd49dcbbc4a0bcfd6d56d48b1dabcb88777de4 Mon Sep 17 00:00:00 2001 From: debian Date: Sun, 29 Nov 2026 09:18:00 -0300 Subject: [PATCH] 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. --- src/exploit/checkm8_spray.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/exploit/checkm8_spray.c b/src/exploit/checkm8_spray.c index 4d66677..937c9f5 100644 --- a/src/exploit/checkm8_spray.c +++ b/src/exploit/checkm8_spray.c @@ -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");