Commit Graph
4210 Commits
Author SHA1 Message Date
iceman1001 d1a6ef4704 guard , if someone wanted to break pm3 simulation.... which is very like not to happen 2026-03-24 19:03:13 +07:00
iceman1001 2ccfa06386 added sanity checks 2026-03-24 19:02:04 +07:00
iceman1001 bff9b9c37a added sanity check for too large length, and reworked the arrays in "hf 14b raw". It now uses 512b instead of 1024b ram :) Which is better for the stack 2026-03-24 17:33:09 +07:00
iceman1001 7f09f556d6 limit len correctly now 2026-03-24 14:22:28 +07:00
iceman1001 90b4c8fe6d add gaurd 2026-03-24 14:21:54 +07:00
iceman1001 c62b9e0480 add guard for size_t underflow 2026-03-24 14:21:09 +07:00
iceman1001 0d63e53a77 apply sanity checks for "smart upload" 2026-03-24 13:52:13 +07:00
iceman1001 46ebcb9290 fix a chain of calls, where MifareSendCommand uses a 64 byte array and DesfireAPDU uses a memcpy up to 256 bytes 2026-03-24 13:31:51 +07:00
iceman1001 98552b54dc fix mac_input_idx to possible overflow u8, and some sanity checks that what we got doesnt overflow when we copy it into cmac calcs 2026-03-24 12:56:26 +07:00
iceman1001 0cde6ee075 fix possible overflow copy 2026-03-24 12:55:11 +07:00
iceman1001 f8d3841d3e fix hf 14a simaid on device side, with correct bytes to copy 2026-03-24 11:58:04 +07:00
iceman1001 f1b7ad4a56 add sanity check 2026-03-24 11:44:18 +07:00
iceman1001 8d681fc2aa style 2026-03-24 11:36:36 +07:00
iceman1001 af0659b7ba added extra length checks 2026-03-24 11:13:48 +07:00
iceman1001 7c11ff5330 added extra length checks 2026-03-24 11:13:19 +07:00
Aaron Tulino (Aaronjamt) bd7d0735ce [hf 14a] Add Mifare Plus card type for sim 2026-03-18 12:48:22 -07:00
iceman1001 09ee0ced2c reset fpga after simulation, to see if this stabilizes the device 2026-03-18 10:50:48 +07:00
Erland Waldreus d281724ca8 Correct return value type int in EmGetCmd
The return false would trigger unwanted behaviour as emulation completed with button pressed.
2026-03-17 15:17:50 +01:00
xNovyz 6b5eee46af hf 14b tearoff: dramatically speed up tear-off loop timings
- Reinitialize BigBuf memory before FpgaSetupSsc to reset PDC internal buffer pointers
- With properly reset DMA pointers, the field stabilization time can be safely reduced from 5.0ms down to 0.25ms (which matches the timing originally intended by the near-field-chaos patch)
- Further reduced the ST25TB charge capacitor drain wait time from 10ms to an aggressive 0.5ms (the tRST minimum specified in ST25TB datasheet)
2026-03-14 22:44:12 +01:00
Christian Zanon 5b2e805c73 Update start delay comment
Signed-off-by: Christian Zanon <105173223+xNovyz@users.noreply.github.com>
2026-03-13 13:02:34 +01:00
Christian Zanon b9ddb038b7 Merge branch 'master' into hf-14b-tearoff
Signed-off-by: Christian Zanon <105173223+xNovyz@users.noreply.github.com>
2026-03-13 11:39:06 +01:00
xNovyz 52676ebbd4 style: whitespace fixes 2026-03-11 22:41:21 +01:00
xNovyz 286df8f4eb 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>]
2026-03-11 21:43:37 +01:00
pingu2211 3d5f1df093 Pull docs out for all the existing stand alone modes, including a diagram and what do the lights mean, so users don't have to go digging in source code 2026-03-11 14:57:06 +11:00
xNovyz 0151c0d710 fix(fpga): add FpgaResetBitstream() to force re-initialization
After aggressive field cycling (e.g. tear-off attacks), the FPGA's
internal SSC/DMA state can become corrupted even though the bitstream
is technically loaded. FpgaDownloadAndGo() caches downloaded_bitstream
and skips re-download if it matches, so subsequent commands fail
silently or hang.

Add FpgaResetBitstream() which sets downloaded_bitstream to
FPGA_BITSTREAM_UNKNOWN, forcing the next FpgaDownloadAndGo() to
perform a complete reload.
2026-03-10 23:06:41 +01:00
xNovyz 57f200d107 fix(iso14443b): add WDT_HIT and timeout to DMA receive loop
In Get14443bAnswerFromTag(), the behindBy == 0 idle loop (waiting for
FPGA DMA samples) had no watchdog kick, no button check, and no
timeout. If the FPGA stops providing the SSC clock, this loop spins
infinitely until the hardware watchdog triggers a reboot.

Add WDT_HIT(), BUTTON_PRESS() check, and a 200ms failsafe timeout
using GetTickCountDelta() to prevent infinite spins.
2026-03-10 23:06:28 +01:00
Antiklesys 5041fbffa7 Added --creidit option for hf iclass legrec
Added --creidit option for hf iclass legrec
2026-03-05 19:32:52 +08:00
kormax f855866ce0 Handle inverted polarity RX frames in 'hf felica' 2026-03-04 09:49:23 +02:00
Aaron Tulino (Aaronjamt) a468265f5e [14a sniff] Stop sniff with Enter key 2026-02-26 02:51:26 -07:00
iceman1001 338ab9c81a Revert "Release v4.21128 - Permafrost"
This reverts commit b10235b03b.
2026-02-25 16:15:01 +01:00
iceman1001 b10235b03b Release v4.21128 - Permafrost 2026-02-25 16:15:01 +01:00
Philippe Teuwen b8a5e7b656 hf mf cauth/aesauth/cchk/aeschk: make fast READ0 optional 2026-02-24 16:46:00 +01:00
Philippe Teuwen 118652bd90 CMD_HF_DECAY: factor with structs, remove cast align warning 2026-02-21 23:54:51 +01:00
Philippe Teuwen 5458a95fda avoid cppcheck errors on uninit vars 2026-02-21 14:14:50 +01:00
Philippe Teuwen b62658f5ac make style 2026-02-21 12:43:25 +01:00
Philippe Teuwen 89d60fc2cb PoC Standalone mode: unlock Ultralight C / AES tags 2026-02-21 00:07:50 +01:00
michael fe878be492 Added a new command (hw decay [which monitors the decay rate of the hf antenna cap]) and updated hw tune to detect booster boards and if the pm3 easy is on a metal surface 2026-02-18 15:51:08 -08:00
kormax c6675018b3 felica: use NG frames for commands 2026-02-15 19:04:22 +02:00
Iceman 3d039d84cf Merge pull request #3095 from kormax/felica-dump-fix-missing-trace
hf felica dump: vastly improve speed; fix traces being empty
2026-02-15 12:09:43 +01:00
kormax 2721b13792 hf felica dump: vastly improve speed; fix traces being empty after command execution 2026-02-14 15:36:28 +02:00
Philippe Teuwen d6f74b342e Make sure RAMFUNC is not inlined, else it won't be in RAM.
Some static RAMFUNC got inlined which means they weren't relocated in RAM.
By forcing noinline on RAMFUNC, the following functions move to RAM:

F .data 00000034 optimizedSniff
F .data 00000148 skipSniff
F .data 000002c8 ManchesterDecoding_Thinfilm

But ManchesterDecoding_Thinfilm worked fine without being in RAM,
so we remove its RAMFUNC attribute and it works as previously,
and avoid eating some RAM bytes.

In summary, impacted command is only:

hf sniff
2026-02-11 14:19:05 +01:00
Philippe Teuwen 7c4758f40b ulaes: add verify_cmac, display counters in mfu info, fix sig when schann in mfu info 2026-02-09 12:44:50 +01:00
Philippe Teuwen 9f70011fee hf mfu setkey: supports ulc/ulaes auth and ulaes schann 2026-02-09 01:08:23 +01:00
Philippe Teuwen a4291f676f ulaes cmac: fix 14a raw 2026-02-08 22:56:33 +01:00
Philippe Teuwen 54b4459f45 ulaes cmac: reuse cmac api for read/write 2026-02-08 22:24:00 +01:00
Philippe Teuwen aeb28b36f2 cppcheck: fix warning on mixing boolean and bitwise operations 2026-02-06 22:19:28 +01:00
Philippe Teuwen cb1f66f9f4 cppcheck: fix size of pointer <> size of data 2026-02-06 22:19:11 +01:00
Philippe Teuwen 73df0e186b cppcheck: fix null ptr dereference warning 2026-02-06 16:00:29 +01:00
Philippe Teuwen 3234c2ba47 cppcheck: fix redundant condition 2026-02-06 14:34:26 +01:00
Philippe Teuwen c00e4801b7 make style 2026-02-06 13:43:41 +01:00