Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mfoc-hardnested-dump fails when rewriting back to card #15

Open
ld21 opened this issue Jul 27, 2022 · 5 comments
Open

mfoc-hardnested-dump fails when rewriting back to card #15

ld21 opened this issue Jul 27, 2022 · 5 comments

Comments

@ld21
Copy link

ld21 commented Jul 27, 2022

Hi everyone

I successfully extracted the contents of a MIFARE classic card using mfoc-hardnested using
mfoc-hardnested -f keys.txt -O extractedcard.mfd over an USB Adafruit PN532 Breakout Board:

# ./mfoc-hardnested -f keys.txt -O extractedcard.mfd 
ATS len = -20
Found Mifare Classic 1k tag
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04  
* UID size: single
* bit frame anticollision supported
       UID (NFCID1): 6d  02  b6  62  
      SAK (SEL_RES): 08  
* Not compliant with ISO/IEC 14443-4
* Not compliant with ISO/IEC 18092

Fingerprinting based on MIFARE type Identification Procedure:
* MIFARE Classic 1K
* MIFARE Plus (4 Byte UID or 4 Byte RID) 2K, Security level 1
* SmartMX with MIFARE 1K emulation
Other possible matches based on ATQA & SAK values:

Try to authenticate to all sectors with default keys...
...
...

However, when trying to write the dump back to the card using
nfc-mfclassic w a extractedcard.mfd extractedcard.mfd, the process fails with

root@nfc:/home/to# LIBNFC_LOG_LEVEL=3 nfc-mfclassic w a extractedcard.mfd extractedcard.mfd
NFC reader: Adafruit PN532 Breakout opened
Found MIFARE Classic card:
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04  
       UID (NFCID1): 6d  02  b6  62  
      SAK (SEL_RES): 08  
RATS support: no
Guessing size: seems to be a 1024-byte card
Writing 63 blocks |Failure to write to data block 1
xroot@nfc:/home/to# 

and the card remains unaltered. I'm using a fresh Kali linux and an uptodate libnfc (1.8.0).

Am I correct using nfc-mfclassic to write the dump back or should I use another program (since it identifies as a MIFARE Plus)?

Does anyone have an idea what the problem might be?
Thanks!

@caps6
Copy link

caps6 commented Sep 7, 2022

I had the same issue. I am using a 320 byte card and authentication failed for blocks 4, 8, 12 and 16. This problem came out after I have upgraded from Ubuntu 20.04 to 22.04 LTS and using the latest version of mfoc-hardnested. Removing libnfc-bin 1.8.0 and installing from source libnfc-bin 1.7.1 did the trick for me.

@ld21
Copy link
Author

ld21 commented Jul 16, 2023

I tried it with libnfc 1.7.1 – but that didn't solve the issue. Any other ideas?

@gelotus
Copy link
Collaborator

gelotus commented Jul 16, 2023 via email

@ld21
Copy link
Author

ld21 commented Jul 16, 2023

I have recompiled libnfc 1.7.1 using Ludo1598's post https://github.com/nfc-tools/libnfc/issues/684#issuecomment-1634573967.
Gelotus, I don't unterstand what you suggest: do you mean I should compile from the latest version of libnfc as in https://github.com/nfc-tools/libnfc? Thanks!

@gelotus
Copy link
Collaborator

gelotus commented Jul 16, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants