mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
hf mf restore: check for access control consistency, else replace by default values
This commit is contained in:
parent
28a3c76db5
commit
5395f870b9
1 changed files with 6 additions and 8 deletions
|
@ -1063,10 +1063,9 @@ static int CmdHF14AMfRestore(const char *Cmd) {
|
|||
|
||||
memcpy(bldata, dump, MFBLOCK_SIZE);
|
||||
|
||||
if (use_keyfile_for_auth == false) {
|
||||
|
||||
// if sector trailer replace key
|
||||
// if sector trailer
|
||||
if (mfNumBlocksPerSector(s)-1 == b) {
|
||||
if (use_keyfile_for_auth == false) {
|
||||
// replace KEY A
|
||||
bldata[0] = (keyA[s][0]);
|
||||
bldata[1] = (keyA[s][1]);
|
||||
|
@ -1082,11 +1081,10 @@ static int CmdHF14AMfRestore(const char *Cmd) {
|
|||
bldata[14] = (keyB[s][4]);
|
||||
bldata[15] = (keyB[s][5]);
|
||||
}
|
||||
}
|
||||
|
||||
if (mfNumBlocksPerSector(s)-1 == b) {
|
||||
// ensure access right isn't messed up.
|
||||
if (memcmp(bldata + 6, "\x00\x00\x00\x00", 4) == 0) {
|
||||
if (! mfValidateAccessConditions(&bldata[6])) {
|
||||
PrintAndLogEx(WARNING, "Invalid Access Conditions on sector %i, replacing by default values", s);
|
||||
memcpy(bldata + 6, "\xFF\x07\x80\x69", 4);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue