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 <noreply@anthropic.com>
This commit is contained in:
iceman1001andClaude Opus 5.5 committed 2026-11-10 07:35:47 +07:00
1 parent 3515724f9a
commit 4f7a1fe28b
1 file changed
+5 -7
+5 -7
View File
@@ -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;