From 0b1c82a1023d606cbcd972f887df0421f436cf5f Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 9 Oct 2024 23:52:40 +0200 Subject: [PATCH] Fixed hf mf restore - really skip strict ACLs unless --force --- CHANGELOG.md | 1 + client/src/cmdhfmf.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5843bbcac..87768a727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed `hf mf restore` - really skip strict ACLs unless --force (@doegox) - Added `hf 14b setuid` - set uid on magic 14b tag (@iceman1001) - Changed `hf 14b info` - now detect Tiananxin (@iceman1001) - Fixed `lf em 410x brute` - better filehandling and memory handling (@iceman1001) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 465ed8be4..8d5b7b074 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -1535,9 +1535,9 @@ static int CmdHF14AMfRestore(const char *Cmd) { uint8_t bldata[MFBLOCK_SIZE] = {0x00}; memcpy(bldata, dump, MFBLOCK_SIZE); + bool skip = false; // if sector trailer if (mfIsSectorTrailerBasedOnBlocks(s, b)) { - // keep the current keys on the card if (use_keyfile_for_auth == false) { // replace KEY A @@ -1561,7 +1561,7 @@ static int CmdHF14AMfRestore(const char *Cmd) { // if --force isn't used, skip writing this block if (force == false) { PrintAndLogEx(INFO, "Skipping, use `" _YELLOW_("--force") "` to override and write this data"); - continue; + skip = true; } } } @@ -1571,6 +1571,9 @@ static int CmdHF14AMfRestore(const char *Cmd) { dump += MFBLOCK_SIZE; bytes_read -= MFBLOCK_SIZE; } + if (skip) { + continue; + } uint8_t wdata[26]; memcpy(wdata + 10, bldata, sizeof(bldata)); @@ -1607,7 +1610,7 @@ static int CmdHF14AMfRestore(const char *Cmd) { } // write somehow failed. Lets determine why. if (isOK == PM3_ETEAROFF) { - PrintAndLogEx(INFO, "Tear off triggerd. Recommendation is not to use tear-off with restore command"); + PrintAndLogEx(INFO, "Tear off triggered. Recommendation is not to use tear-off with restore command"); goto out; }