Skip to content

Safety and legal

Authorized use only

hwntools is a tool for authorized hardware security assessments: devices you own, or devices whose owner has explicitly permitted you to test them, within the scope of that permission.

  • Get written authorization before testing a device you do not own, and stay inside its scope.
  • Extracting firmware, credentials or keys from a device can be restricted by contract (licence terms, NDAs) and by law, even for hardware you bought. Check what applies to you.
  • Default-credential checks and console logins leave traces and can lock accounts. LinuxShell.try_default_credentials() only runs when you call it.
  • Firmware may contain personal data, secrets or third-party code. Handle dumps as sensitive and report vulnerabilities responsibly to the vendor.

The software is provided under the MIT license, "as is", without warranty of any kind. You are responsible for how you use it and for any damage to devices.

Destructive operations need force=True

Operations that change persistent state on the target refuse to run unless you opt in:

Call What it does
UBoot.saveenv(force=True) writes the U-Boot environment to flash
Flashrom.write(image, force=True) programs the SPI flash
Flashrom.erase(force=True) erases the whole chip
OpenOCD.flash_write_image(path, force=True) programs flash over JTAG/SWD

Without force=True they raise SafetyError. Everything else is read-only or RAM-only: UBoot.setenv() and UBoot.inject_bootargs() only change the environment in RAM, and a power cycle undoes them.

Always take and verify a full backup first. Flashrom.read() reads the chip twice and compares the reads; keep the image and its hash before you write anything.

Some actions are not guarded because they are ordinary commands: anything you send yourself with UBoot.run(), LinuxShell.run(), OpenOCD.cmd() or OpenOCD.write_memory() runs as given.

Wiring and voltage levels

  • Connect ground first, and keep a common ground between the target, your adapter and any logic analyzer.
  • Measure the UART/JTAG/SPI pins with a multimeter before connecting. Embedded boards use 1.8 V, 3.3 V or 5 V logic. A 5 V USB-UART adapter can destroy a 1.8 V or 3.3 V SoC. Use a level shifter or an adapter that matches the target's I/O voltage.
  • Connect the adapter's RX to the target's TX first and listen. Only connect TX after you have confirmed the voltage level.
  • Do not power the target from the adapter's VCC pin unless you know the board's power requirements. Leave it disconnected.
  • In-circuit SPI flash reads (a clip on a powered-off board) can back-power the SoC through the flash's VCC. If reads are unstable or the board heats up, stop: hold the SoC in reset or desolder the chip.
  • RS-232 ports swing to ±12 V and must never be wired to logic-level UART pins.

Firmware is untrusted input

Images from devices can be malformed on purpose. hwntools' built-in extractor never writes outside its output directory and bounds every decompression, and the Docker backend runs unblob without network access with the input mounted read-only. See Safe by default. External extractors you install (binwalk, native unblob) run with your user's permissions.