mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
better OTP update sanity check by @jmichelp. Checks every bytewise if any bit is 0
This commit is contained in:
parent
440d283a53
commit
1bd811f7a1
1 changed files with 10 additions and 5 deletions
|
@ -1742,12 +1742,17 @@ void SimulateIso14443aTag(uint8_t tagType, uint16_t flags, uint8_t *useruid, uin
|
|||
}
|
||||
|
||||
// OTP sanity check
|
||||
// Quite a bad one, one should look at all individual bits and see if anyone tries be set as zero
|
||||
// we cheat and do fat 00000000 check instead
|
||||
if (block == 0x03) {
|
||||
if (memcmp(receivedCmd + 2, "\x00\x00\x00\x00", 4) == 0) {
|
||||
// OTP can't be set back to zero
|
||||
// send NACK 0x0 == invalid argument,
|
||||
|
||||
uint8_t orig[4] = {0};
|
||||
emlGet(orig, 12 + MFU_DUMP_PREFIX_LENGTH, 4);
|
||||
|
||||
bool risky = false;
|
||||
for (int i = 0; i < len; i++) {
|
||||
risky |= orig[i] & ~receivedCmd[2 + i];
|
||||
}
|
||||
|
||||
if (risky) {
|
||||
EmSend4bit(CARD_NACK_IV);
|
||||
goto jump;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue