Skip to content

security: remove host-triggerable BOOTSEL entry#4

Open
up2urheadlights wants to merge 1 commit into
snipem:mainfrom
up2urheadlights:security/remove-host-bootsel
Open

security: remove host-triggerable BOOTSEL entry#4
up2urheadlights wants to merge 1 commit into
snipem:mainfrom
up2urheadlights:security/remove-host-bootsel

Conversation

@up2urheadlights

Copy link
Copy Markdown
Contributor

Removes the host-triggerable BOOTSEL entry from the firmware and its tooling.

The issue

The firmware answered HID feature report 0xF6 funcid 0x04 by calling reset_usb_boot(), dropping the dongle straight into BOOTSEL mass-storage (flash-anything) mode. Because it's reachable over the plain HID interface, any host process — or a WebHID page in a browser — that can open the device can force it into the bootloader, with no physical presence required. That's a BadUSB / persistent-implant vector: an unprivileged app could reflash the dongle with arbitrary firmware. A real DS4 exposes no such command.

The change

  • Remove the 0x04 handler in src/cmd.cpp (and the now-unused pico/bootrom.h include).
  • Delete tools/reboot_bootsel.py (the trigger) and tools/flash.sh.
  • Drop the Makefile deploy / deploy-debug targets that chained them.

The physical bootloader paths are untouched — the triple-click BOOTSEL gesture and holding BOOTSEL on plug-in still work — so reflashing still works, it just requires physical presence at the device. Builds clean (production + debug).

The tradeoff is losing make deploy (host-triggered reflash during development); the host command can still be re-added locally for a dev build if needed, but it no longer ships in firmware where any host could reach it.

The firmware answered HID feature report 0xF6 funcid 0x04 by calling
reset_usb_boot(), letting any host process (or a WebHID page) that can
open the HID interface force the dongle into BOOTSEL mass-storage mode --
a flash-anything state, i.e. a BadUSB / persistent-implant vector, with no
physical presence required. A real DS4 has no such command.

Remove the 0x04 handler (and the now-unused pico/bootrom.h include), the
reboot_bootsel.py trigger, flash.sh, and the Makefile deploy targets that
chained them. The physical triple-click / BOOTSEL-hold gesture remains the
only path into the bootloader, so reflashing still requires physical
presence at the device.
@up2urheadlights
up2urheadlights marked this pull request as ready for review July 14, 2026 22:42
@snipem

snipem commented Jul 15, 2026

Copy link
Copy Markdown
Owner

This is generally fine. We should include this only for debug builds in the future, so that integration for testing can automated as far as possible. Since we are in the pre-production stages we will keep it in for now.

@up2urheadlights

Copy link
Copy Markdown
Contributor Author

This is generally fine. We should include this only for debug builds in the future, so that integration for testing can automated as far as possible. Since we are in the pre-production stages we will keep it in for now.

How about putting it behind a build flag and configuring CI to build a separate uf2? I'd be happy to implement that.

@snipem

snipem commented Jul 15, 2026

Copy link
Copy Markdown
Owner

I thought CI was already building a debug version. Hat version is not for production anyway so it can simply just have the tripple press to BOOTSEL logic

@up2urheadlights

Copy link
Copy Markdown
Contributor Author

I thought CI was already building a debug version. Hat version is not for production anyway so it can simply just have the tripple press to BOOTSEL logic

Yes it does. Do you want the host flash option enabled for the debug version?

@snipem

snipem commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Exactly.

Can you acknowledge that you are an AI agent? If so which model?

@up2urheadlights

Copy link
Copy Markdown
Contributor Author

Can you acknowledge that you are an AI agent? If so which model?

I use Claude Opus 4.8 and Fable 5. I'll work on this tomorrow.

@snipem

snipem commented Jul 15, 2026

Copy link
Copy Markdown
Owner

So I think best would be:

  • for production: strip it altogether, no BOOTSEL from deployed ds4dongle
  • for debug build: triple press triggers bootsel, or flash.py. Debug shall also inform the user when monitoring stdout when booting up that this is an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants