nfc-tools / mfoc-hardnested

A fork of mfoc integrating hardnested code from the proxmark
GNU General Public License v2.0
191 stars 31 forks source link

Question regarding usage #18

Open bosgnoom opened 1 year ago

bosgnoom commented 1 year ago

Hi,

At first my apologies, but I do not know where to ask this question. I am trying (just for the fun of it) to get the keys of a Mifare card. Other cards can be accessed quite easily, but there's one with some issues. Could anyone point out how to handle this one?

mfoc-hardnested exits after a few seconds, giving various error messages:

Number of probes: 5000
Tolerance number: 5000
The custom key 0x000000000000 has been added to the default keys
Found Mifare Classic 4k tag
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  02  
* UID size: single
* bit frame anticollision supported
       UID (NFCID1): 21  38  19  0d  
      SAK (SEL_RES): 18  
* Not compliant with ISO/IEC 14443-4
* Not compliant with ISO/IEC 18092

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

Try to authenticate to all sectors with default keys...
Symbols: '.' no key found, '/' A key found, '\' B key found, 'x' both keys found
[Key: 000000000000] -> [xxxxxxxxxxxxxxxxxxxxxx..................]

Sector 00 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 01 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 02 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 03 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 04 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 05 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 06 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 07 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 08 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 09 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 10 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 11 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 12 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 13 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 14 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 15 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 16 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 17 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 18 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 19 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 20 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 21 - Found   Key A: 000000000000 Found   Key B: 000000000000
Sector 22 - Unknown Key A               Unknown Key B
Sector 23 - Unknown Key A               Unknown Key B
Sector 24 - Unknown Key A               Unknown Key B
Sector 25 - Unknown Key A               Unknown Key B
Sector 26 - Unknown Key A               Unknown Key B
Sector 27 - Unknown Key A               Unknown Key B
Sector 28 - Unknown Key A               Unknown Key B
Sector 29 - Unknown Key A               Unknown Key B
Sector 30 - Unknown Key A               Unknown Key B
Sector 31 - Unknown Key A               Unknown Key B
Sector 32 - Unknown Key A               Unknown Key B
Sector 33 - Unknown Key A               Unknown Key B
Sector 34 - Unknown Key A               Unknown Key B
Sector 35 - Unknown Key A               Unknown Key B
Sector 36 - Unknown Key A               Unknown Key B
Sector 37 - Unknown Key A               Unknown Key B
Sector 38 - Unknown Key A               Unknown Key B
Sector 39 - Unknown Key A               Unknown Key B

Using sector 21 as an exploit sector

Mode: d, Auth command:  60  57  cf  5d  
19  28  4b  30  
    {Ar}:   5a  1e  0e! 36  58  09! 92  55! 
    {At}:   eb  33! 7f! 3e  
Authentication completed.

Nested Auth number: 0
    {AuthEnc}:  75  6a  c0! 40! 0b  00! 00! 00! 
    {AuthEnResp}:   9f  d0  09  6e  
Card is not vulnerable to nested attack

Using AVX2 SIMD core.          

 time    | trg | #nonces | Activity                                                | expected to brute force          
         |     |         |                                                         | #states         | time           
-------------------------------------------------------------------------------------------------------------          
       0 | 22A |       0 | Start using 16 threads and AVX2 SIMD core               |                 |          
       0 | 22A |       0 | Brute force benchmark: 3000 million (2^31.5) keys/s     | 140737488355328 |   13h          
       1 | 22A |       0 | Using 235 precalculated bitflip state tables            | 140737488355328 |   13h          
Mode: h, Auth command:  60  54  54  6f  
fe  d6  79  7c  
    {Ar}:   c3! af! c5  c2  19  bc  40  4e  
    {At}:   91! e5  23! ac! 
Authentication completed.

       2 | 22A |       1 | Apply bit flip properties                               | 140737488355328 |   13h          
Mode: h, Auth command:  60  54  54  6f  
0c  e5  a0  7a  
    {Ar}:   16  9b  49! 5a! 80  6a! 5f! b9! 
    {At}:   17! 13! 84  13! 
Authentication completed.

       2 | 22A |       2 | Apply bit flip properties                               | 140737488355328 |   13h          
Mode: h, Auth command:  60  54  54  6f  
b8  65  68  bb  
    {Ar}:   b8  b6! b0  fb! fb  ba! 21! 8a! 
    {At}:   aa  ed! e8! c6! 
Authentication completed.

       2 | 22A |       3 | Apply bit flip properties                               | 140737488355328 |   13h          
Mode: h, Auth command:  60  54  54  6f  
95  ad  ff  d4  
    {Ar}:   08  15  ef  09! 80! 83  9c! 20! 
    {At}:   3b! 6e  06  47! 
Authentication completed.

       2 | 22A |       4 | Apply bit flip properties                               | 140737488355328 |   13h          
Mode: h, Auth command:  60  54  54  6f  
a7  b9  d1  af  
    {Ar}:   f4! 86  05  fc! 69! 6f! 4a! d6! 
mfoc-hardnested: ERROR: Reader-answer transfer error, exiting..
willem640 commented 1 year ago

If you'd like help with the usage of the program, it might be helpful to post your command line arguments. As for your problem, this looks to be an issue with your NFC reader. Which reader are you using and which OS?

bosgnoom commented 1 year ago

If you'd like help with the usage of the program, it might be helpful to post your command line arguments. As for your problem, this looks to be an issue with your NFC reader. Which reader are you using and which OS?

Hi @willem640 ,

I am using a generic ACR122U device on my laptop running Linux fedora 6.1.15-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Mar 3 17:29:44 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux.

dmesg shows:

usb 1-2: new full-speed USB device number 2 using xhci_hcd
usb 1-2: New USB device found, idVendor=072f, idProduct=2200, bcdDevice= 2.14
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-2: Product: ACR122U PICC Interface
usb 1-2: Manufacturer: ACS

For the use of mfoc-hardnested, I just use the basic invocation of the (and your fork) program: ./mfoc-hardnested -O card.mfd. When it complains about too little probes, I increase them to 2000. The nonce tolerance is kept the same, I am unsure what that parameter does.

One of the cards identifies as a Mifare 1k card. I've got it from some conference. It was a blank card and I uploaded a dump of a known card onto it. With the keys (-f keys.txt) I am able to get the dump again. Without the keys unfortunately not. If you are interested, I could send it/them to you by regular mail.