feat(14b): add interactive hf 14b tearoff command

Add an interactive command for performing tear-off attacks on ST25TB/SRx
monotonic counter blocks. This exploits EEPROM tearing to increment
counters that normally can only be decremented, based on the
near-field-chaos project by SecLabz.

The command sweeps tear-off timing from --start downward in --adj
microsecond steps, automatically consolidates partial writes, verifies
stability across multiple reads, and reports progress in real-time with
color-coded output.

Performance optimizations:
- One-time full iso14443b_setup() at start; subsequent field cycles use
  lightweight tearoff_field_on()/tearoff_field_off() that skip FPGA
  bitstream reload and buffer reallocation
- Periodic CMD_WTX keepalives to prevent USB timeouts during long attacks
- Calls FpgaResetBitstream() on exit to ensure clean FPGA state

Usage: hf 14b tearoff -b <block> -d <target> [--start <us>] [--adj <us>]
This commit is contained in:
xNovyz committed 2026-03-11 21:43:37 +01:00
1 parent 0151c0d710
commit 286df8f4eb
9 files changed
+616

No files matched your search

+1
View File
@@ -775,6 +775,7 @@ typedef struct {
#define CMD_HF_ISO14443B_PRINT_CONFIG 0x03D0
#define CMD_HF_ISO14443B_GET_CONFIG 0x03D1
#define CMD_HF_ISO14443B_SET_CONFIG 0x03D2
#define CMD_HF_ISO14443B_ST25TB_TEAROFF 0x03D3
// For measurements of the antenna tuning
#define CMD_MEASURE_ANTENNA_TUNING 0x0400