HID SAM: return CSN / UID and the plaintext SIO with the PACS
Seader keeps the SIO it sees on the air while the SAM reads a card, which is what lets it write an iCLASS SR downgrade. Do the same: - iCLASS: READ / READ4 answers from block 6 on are kept; the SIO is the lowest captured block holding a SEQUENCE whose DER length is covered by contiguous captured blocks (so a legacy block 7 that happens to start with 0x30 is not taken for it). - DESFire: the ReadData of file 0x0F Seader keys on, plus 91 AF continuations (Seader only keeps the first frame). A new request flag (bit 7 for CMD_HF_SAM_PICOPASS, bit 2 for CMD_HF_SAM_SEOS) asks for a sam_ext_reply_hdr_t ahead of the SAM response. It is only sent for a plain PACS request, so -d, --info and --break replies are unchanged. The capture lives in .bss and the reply is built in BigBuf to keep the RDV4 stack untouched. Also from Seader: a DESFire EV2 answers the Seos select with a 6F 22 85 20 FCI. Hide it from the SAM as 6A 82 and add Le to the DESFire select. sam_set_card_detected_seos() moves to sam_common.c as sam_set_card_detected_iso14a() so the MIFARE Classic path can share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6100a46f12
commit
d2e077ded9
5 files changed
+296
-81
No files matched your search
@@ -340,6 +340,20 @@ typedef struct {
|
||||
bool EM;
|
||||
} PACKED lf_hidsim_t;
|
||||
|
||||
// Extended PACS reply of CMD_HF_SAM_PICOPASS (flag bit 7), CMD_HF_SAM_SEOS and
|
||||
// CMD_HF_SAM_MFC (flag bit 2). Followed by sio_len SIO bytes, then sam_len
|
||||
// bytes of SAM response. Only sent for a plain PACS request.
|
||||
#define SAM_EXT_REPLY_MAGIC 0xE5
|
||||
#define SAM_EXT_SIO_MAX 128
|
||||
typedef struct {
|
||||
uint8_t magic;
|
||||
uint8_t uid_len;
|
||||
uint8_t uid[10]; // CSN for iCLASS, UID for ISO14443-A
|
||||
uint8_t sio_start; // iCLASS block the SIO was read from, 0 otherwise
|
||||
uint8_t sio_len; // plaintext SIO seen on the air, 0 if none
|
||||
uint8_t sam_len;
|
||||
} PACKED sam_ext_reply_hdr_t;
|
||||
|
||||
// For CMD_LF_FSK_SIMULATE (FSK)
|
||||
typedef struct {
|
||||
uint8_t fchigh;
|
||||
|
||||
Reference in new issue
Block a user