Merge pull request #2848 from Antiklesys/master

Updated iclass trbl effectiveness to detect partial tearoffs
This commit is contained in:
Iceman 2025-05-17 21:00:10 +02:00 committed by GitHub
commit 1287454781
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 8 deletions

View file

@ -3,6 +3,8 @@ 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... 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] ## [unreleased][unreleased]
- Fixed and updated `hf iclass trbl` to correctly use the credit key when passed and show partial tearoff results (@antiklesys)
- Fixed `hf iclass legbrute` was not correctly parsin the index value
- Fixed `hf mf ekeyprn` - failed to download emulator memory due to wrong size calculation (@iceman1001) - Fixed `hf mf ekeyprn` - failed to download emulator memory due to wrong size calculation (@iceman1001)
- Fixed `hf mf fchk --mem` to actually use flash dict (@doegox) - Fixed `hf mf fchk --mem` to actually use flash dict (@doegox)
- Fixed `make install` on OSX thanks DaveItsLong (@doegox) - Fixed `make install` on OSX thanks DaveItsLong (@doegox)
@ -45,7 +47,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
- Changed `hf mf cload` - now accepts MFC Ev1 sized dumps (@iceman1001) - Changed `hf mf cload` - now accepts MFC Ev1 sized dumps (@iceman1001)
- Changed `hf mfu info` - now properly identify ULEv1 AES 50pF (@iceman1001) - Changed `hf mfu info` - now properly identify ULEv1 AES 50pF (@iceman1001)
- Changed `hf mf info` - now differentiates between full USCUID and cut down ZUID chips (@nvx) - Changed `hf mf info` - now differentiates between full USCUID and cut down ZUID chips (@nvx)
- Changed `lf hitag chk` - added key counter, client side abort and minor delay (@iceman1001) - Changed `lf hitag chk` - added key counter, client side abort and minor delay (@iceman1001)
- Added `hf seos sam` - Added support for HID SAM SEOS communications (@jkramarz) - Added `hf seos sam` - Added support for HID SAM SEOS communications (@jkramarz)
- Changed (extended) area accessible by spiffs into last page of FLASH (@piotrva) - Changed (extended) area accessible by spiffs into last page of FLASH (@piotrva)
- Changed flash-stored key dictionaries (Mifare, iClass, T55XX) and T55XX configurations to SPIFFS files (@piotrva) - Changed flash-stored key dictionaries (Mifare, iClass, T55XX) and T55XX configurations to SPIFFS files (@piotrva)

View file

@ -3030,12 +3030,13 @@ static int CmdHFiClass_TearBlock(const char *Cmd) {
int isok = 0; int isok = 0;
tearoff_params_t params; tearoff_params_t params;
bool read_ok = false; bool read_ok = false;
uint8_t keyType = 0x88; //debit key uint8_t keyType = 0x88; //debit key
if (use_credit_key) { if (use_credit_key) {
PrintAndLogEx(SUCCESS, "Using " _YELLOW_("credit") " key"); PrintAndLogEx(SUCCESS, "Using " _YELLOW_("credit") " key");
keyType = 0x18; //credit key keyType = 0x18; //credit key
} }
while (tearoff_start < tearoff_end && !read_ok) { while (tearoff_start < tearoff_end && !read_ok) {
//perform read here, repeat if failed or 00s //perform read here, repeat if failed or 00s
@ -3097,17 +3098,28 @@ static int CmdHFiClass_TearBlock(const char *Cmd) {
tearoff_start--; tearoff_start--;
} }
bool tear_success = true; bool tear_success = true;
for (int i = 0; i < PICOPASS_BLOCK_SIZE; i++) { bool expected_values = true;
if (data[i] != data_read[i]) { if(memcmp(data_read, data, 8) != 0) {
tear_success = false; tear_success = false;
} }else if ((!tear_success) && (memcmp(data_read, zeros, 8) != 0) && (memcmp(data_read, data_read_orig, 8) != 0)) { //tearoff succeeded (partially)
tear_success = true;
expected_values = false;
PrintAndLogEx(SUCCESS, _GREEN_("Tear-off Success! -> Different values"));
PrintAndLogEx(INFO, "Original: %s", sprint_hex(data_read_orig, sizeof(data_read)));
PrintAndLogEx(INFO, "Expected: %s", sprint_hex(data, sizeof(data)));
} }
if (tear_success) { //tearoff succeeded if (tear_success) { //tearoff succeeded
read_ok = true; read_ok = true;
PrintAndLogEx(SUCCESS, _GREEN_("Tear-off Success!")); if(expected_values) {
PrintAndLogEx(INFO, "Read: %s", sprint_hex(data_read, sizeof(data_read))); PrintAndLogEx(SUCCESS, _GREEN_("Tear-off Success! -> Expected values"));
}
PrintAndLogEx(INFO, "Read: %s", sprint_hex(data_read, sizeof(data_read)));
} else { //tearoff did not succeed } else { //tearoff did not succeed
PrintAndLogEx(FAILED, _RED_("Tear-off Failed!")); PrintAndLogEx(FAILED, _RED_("Tear-off Failed!"));
if(verbose) {
PrintAndLogEx(INFO, "Read: %s", sprint_hex(data_read, sizeof(data_read)));
PrintAndLogEx(INFO, "Expected: %s", sprint_hex(data, sizeof(data)));
}
tearoff_start++; tearoff_start++;
} }
PrintAndLogEx(INFO, "---------------"); PrintAndLogEx(INFO, "---------------");