From 4f7a1fe28b8f5f8c157d0665b38bbd88d10bb9eb Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 10 Nov 2026 07:34:07 +0700 Subject: [PATCH] trace extract: only skip the ULC/iCLASS READCHECK reply when it is one MFU-C AUTH and iCLASS READCHECK skipped the next record before checking it was the tag's reply. With an unanswered command, the reader's next frame was swallowed: a retried 1A 00 lost the whole MFU-C auth, and a CHECK right after READCHECK was taken as the epurse, hiding the lookup. Now the record is only consumed when it is a tag frame of the expected shape. Co-Authored-By: Claude Opus 5.5 --- client/src/cmdtrace.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index 84b8a9f67..bb30f17a0 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -285,14 +285,12 @@ static uint32_t extractChallenges(uint32_t tracepos, uint32_t traceLen, uint8_t if (next_hdr == NULL) { break; } - tracepos += SKIP_TO_NEXT(next_hdr); - if (next_hdr->data_len != 11) { - break; - } - if (next_hdr->frame[0] != MIFARE_ULC_AUTH_2) { + // only consume a matching tag reply, a retried AUTH must stay for the next pass + if ((next_hdr->isResponse == false) || (next_hdr->data_len != 11) || (next_hdr->frame[0] != MIFARE_ULC_AUTH_2)) { break; } + tracepos += SKIP_TO_NEXT(next_hdr); PrintAndLogEx(INFO, "Found a MFU-C authententication attempt"); PrintAndLogEx(INFO, "3DES %s " NOLF, sprint_hex_inrow(next_hdr->frame + 1, 8)); @@ -346,10 +344,10 @@ static uint32_t extractChallenges(uint32_t tracepos, uint32_t traceLen, uint8_t if (next_hdr == NULL) { break; } - tracepos += SKIP_TO_NEXT(next_hdr); - if (next_hdr->data_len < 8) { + if ((next_hdr->isResponse == false) || (next_hdr->data_len < 8)) { break; } + tracepos += SKIP_TO_NEXT(next_hdr); memcpy(extract_epurse, next_hdr->frame, 8); } break;