From 8edafa3f39860df2642f1cda4fb50120a0bf9600 Mon Sep 17 00:00:00 2001 From: noproto Date: Thu, 12 Sep 2024 14:28:18 -0400 Subject: [PATCH] Do not enter nested attack if card is already finished --- lib/nfc/protocols/mf_classic/mf_classic_poller.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/nfc/protocols/mf_classic/mf_classic_poller.c b/lib/nfc/protocols/mf_classic/mf_classic_poller.c index 88af4744b..260c41221 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic_poller.c +++ b/lib/nfc/protocols/mf_classic/mf_classic_poller.c @@ -858,9 +858,10 @@ NfcCommand mf_classic_poller_handler_key_reuse_start(MfClassicPoller* instance) instance->mfc_event.type = MfClassicPollerEventTypeKeyAttackStop; command = instance->callback(instance->general_event, instance->context); // Nested entrypoint - // TODO: Ensure nested attack isn't run if tag is fully read - if(dict_attack_ctx->nested_phase == MfClassicNestedPhaseNone || - dict_attack_ctx->nested_phase != MfClassicNestedPhaseFinished) { + bool nested_active = dict_attack_ctx->nested_phase != MfClassicNestedPhaseNone; + if((nested_active && + (dict_attack_ctx->nested_phase != MfClassicNestedPhaseFinished)) || + (!(nested_active) && !(mf_classic_is_card_read(instance->data)))) { instance->state = MfClassicPollerStateNestedController; break; }