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

Mifare Classic emulation regression after NFC refactor #3248

Closed
dogtopus opened this issue Nov 28, 2023 · 6 comments
Closed

Mifare Classic emulation regression after NFC refactor #3248

dogtopus opened this issue Nov 28, 2023 · 6 comments
Assignees
Labels
Bug NFC NFC-related

Comments

@dogtopus
Copy link
Contributor

Describe the bug.

The NFC refactor (at least partially) reintroduces bugs fixed by #2825. My phone (Pixel 7 Pro) can no longer read emulated Mifare Classic tags after the NFC refactor was merged.

Reproduction

  1. Emulate some Mifare Classic dump
  2. Scan the tag
  3. See it fail without anything being read

Target

f7

Logs

Nothing useful.

Anything else?

Proxmark3 trace

      Start |        End | Src | Data (! denotes parity error)                                           | CRC | Annotation
------------+------------+-----+-------------------------------------------------------------------------+-----+--------------------
          0 |        992 | Rdr |52(7)                                                                    |     | WUPA
       2228 |       4596 | Tag |44  00                                                                   |     | 
      12016 |      16784 | Rdr |50  00  57  cd                                                           |  ok | HALT
     873568 |     874560 | Rdr |52(7)                                                                    |     | WUPA
     875796 |     878164 | Tag |44  00                                                                   |     | 
     885584 |     888048 | Rdr |93  20                                                                   |     | ANTICOLL
     889220 |     895108 | Tag |04  e2  26  75  b5                                                       |     | 
     902464 |     912928 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
     914164 |     917684 | Tag |08  b6  dd                                                               |  ok | 
    1108384 |    1110592 | Rdr |50! 00!                                                                  |     | HALT
    1113364 |    1114004 | Tag |00(4)                                                                    |     | 
    1197952 |    1200160 | Rdr |50! 00!                                                                  |     | HALT
    1202868 |    1203508 | Tag |00(4)                                                                    |     | 
    1278304 |    1280512 | Rdr |50! 00!                                                                  |     | HALT
    1283236 |    1283876 | Tag |00(4)                                                                    |     | 
    1342432 |    1344640 | Rdr |50! 00!                                                                  |     | HALT
    1347364 |    1348004 | Tag |00(4)                                                                    |     | 
    1763232 |    1764224 | Rdr |52(7)                                                                    |     | WUPA
    1765460 |    1767828 | Tag |44  00                                                                   |     | 
    1775248 |    1780016 | Rdr |50  00  57  cd                                                           |  ok | HALT
    2636864 |    2637856 | Rdr |52(7)                                                                    |     | WUPA
    2639092 |    2641460 | Tag |44  00                                                                   |     | 
    2648880 |    2651344 | Rdr |93  20                                                                   |     | ANTICOLL
    2652516 |    2658404 | Tag |04  e2  26  75  b5                                                       |     | 
    2665760 |    2676224 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
    2677460 |    2680980 | Tag |08  b6  dd                                                               |  ok | 
    2795232 |    2797440 | Rdr |50! 00!                                                                  |     | HALT
    2800180 |    2800820 | Tag |00(4)                                                                    |     | 
    2893056 |    2895264 | Rdr |50! 00!                                                                  |     | HALT
    2898052 |    2898692 | Tag |00(4)                                                                    |     | 
    2978192 |    2980400 | Rdr |50! 00!                                                                  |     | HALT
    2983188 |    2983828 | Tag |00(4)                                                                    |     | 
    3036672 |    3038880 | Rdr |50! 00!                                                                  |     | HALT
    3041668 |    3042308 | Tag |00(4)                                                                    |     | 
    3425520 |    3426512 | Rdr |52(7)                                                                    |     | WUPA
    3427748 |    3430116 | Tag |44  00                                                                   |     | 
    3437536 |    3442304 | Rdr |50  00  57  cd                                                           |  ok | HALT
    4299088 |    4300080 | Rdr |52(7)                                                                    |     | WUPA
    4301316 |    4303684 | Tag |44  00                                                                   |     | 
    4311120 |    4313584 | Rdr |93  20                                                                   |     | ANTICOLL
    4314756 |    4320644 | Tag |04  e2  26  75  b5                                                       |     | 
    4328000 |    4338464 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
    4339700 |    4343220 | Tag |08  b6  dd                                                               |  ok | 
    4449920 |    4452128 | Rdr |50! 00!                                                                  |     | HALT
    4454900 |    4455540 | Tag |00(4)                                                                    |     | 
    4547824 |    4550032 | Rdr |50! 00!                                                                  |     | HALT
    4552820 |    4553460 | Tag |00(4)                                                                    |     | 
    4638848 |    4641056 | Rdr |50! 00!                                                                  |     | HALT
    4643876 |    4644516 | Tag |00(4)                                                                    |     | 
    4709616 |    4711824 | Rdr |50! 00!                                                                  |     | HALT
    4714612 |    4715252 | Tag |00(4)                                                                    |     | 
    5080448 |    5081440 | Rdr |52(7)                                                                    |     | WUPA
    5082676 |    5085044 | Tag |44  00                                                                   |     | 
    5092464 |    5097232 | Rdr |50  00  57  cd                                                           |  ok | HALT
    5954032 |    5955024 | Rdr |52(7)                                                                    |     | WUPA
    5956260 |    5958628 | Tag |44  00                                                                   |     | 
    5966064 |    5968528 | Rdr |93  20                                                                   |     | ANTICOLL
    5969700 |    5975588 | Tag |04  e2  26  75  b5                                                       |     | 
    5982944 |    5993408 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
    5994644 |    5998164 | Tag |08  b6  dd                                                               |  ok | 
    6106096 |    6108304 | Rdr |50! 00!                                                                  |     | HALT
    6111092 |    6111732 | Tag |00(4)                                                                    |     | 
    6183280 |    6185488 | Rdr |50! 00!                                                                  |     | HALT
    6188276 |    6188916 | Tag |00(4)                                                                    |     | 
    6251856 |    6254064 | Rdr |50! 00!                                                                  |     | HALT
    6256884 |    6257524 | Tag |00(4)                                                                    |     | 
    6310688 |    6312896 | Rdr |50! 00!                                                                  |     | HALT
    6315668 |    6316308 | Tag |00(4)                                                                    |     | 
    6693872 |    6694864 | Rdr |52(7)                                                                    |     | WUPA
    6696100 |    6698468 | Tag |44  00                                                                   |     | 
    6705888 |    6710656 | Rdr |50  00  57  cd                                                           |  ok | HALT
    7567424 |    7568416 | Rdr |52(7)                                                                    |     | WUPA
    7569652 |    7572020 | Tag |44  00                                                                   |     | 
    7579440 |    7581904 | Rdr |93  20                                                                   |     | ANTICOLL
    7583076 |    7588964 | Tag |04  e2  26  75  b5                                                       |     | 
    7596320 |    7606784 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
    7608020 |    7611540 | Tag |08  b6  dd                                                               |  ok | 
    7737904 |    7740112 | Rdr |50! 00!                                                                  |     | HALT
    7742900 |    7743540 | Tag |00(4)                                                                    |     | 
    7807584 |    7809792 | Rdr |50! 00!                                                                  |     | HALT
    7812580 |    7813220 | Tag |00(4)                                                                    |     | 
    7887440 |    7889648 | Rdr |50! 00!                                                                  |     | HALT
    7892436 |    7893076 | Tag |00(4)                                                                    |     | 
    7993440 |    7995648 | Rdr |50! 00!                                                                  |     | HALT
    7998436 |    7999076 | Tag |00(4)                                                                    |     | 
    8386272 |    8387264 | Rdr |52(7)                                                                    |     | WUPA
    8388500 |    8390868 | Tag |44  00                                                                   |     | 
    8398288 |    8403056 | Rdr |50  00  57  cd                                                           |  ok | HALT
    9259856 |    9260848 | Rdr |52(7)                                                                    |     | WUPA
    9262084 |    9264452 | Tag |44  00                                                                   |     | 
    9271872 |    9274336 | Rdr |93  20                                                                   |     | ANTICOLL
    9275508 |    9281396 | Tag |04  e2  26  75  b5                                                       |     | 
    9288752 |    9299216 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
    9300452 |    9303972 | Tag |08  b6  dd                                                               |  ok | 
    9407728 |    9409936 | Rdr |50! 00!                                                                  |     | HALT
    9412708 |    9413348 | Tag |00(4)                                                                    |     | 
    9486096 |    9488304 | Rdr |50! 00!                                                                  |     | HALT
    9491092 |    9491732 | Tag |00(4)                                                                    |     | 
    9580960 |    9583168 | Rdr |50! 00!                                                                  |     | HALT
    9585940 |    9586580 | Tag |00(4)                                                                    |     | 
    9659376 |    9661584 | Rdr |50! 00!                                                                  |     | HALT
    9664372 |    9665012 | Tag |00(4)                                                                    |     | 
   10200256 |   10201248 | Rdr |52(7)                                                                    |     | WUPA
   10202484 |   10204852 | Tag |44  00                                                                   |     | 
   10212272 |   10217040 | Rdr |50  00  57  cd                                                           |  ok | HALT
   11073792 |   11074784 | Rdr |52(7)                                                                    |     | WUPA
   11076020 |   11078388 | Tag |44  00                                                                   |     | 
   11085808 |   11088272 | Rdr |93  20                                                                   |     | ANTICOLL
   11089444 |   11095332 | Tag |04  e2  26  75  b5                                                       |     | 
   11102688 |   11113152 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
   11114388 |   11117908 | Tag |08  b6  dd                                                               |  ok | 
   11243136 |   11245344 | Rdr |50! 00!                                                                  |     | HALT
   11248116 |   11248756 | Tag |00(4)                                                                    |     | 
   11436720 |   11438928 | Rdr |50! 00!                                                                  |     | HALT
   11441652 |   11442292 | Tag |00(4)                                                                    |     | 
   11633056 |   11635264 | Rdr |50! 00!                                                                  |     | HALT
   11638036 |   11638676 | Tag |00(4)                                                                    |     | 
   11747120 |   11749328 | Rdr |50! 00!                                                                  |     | HALT
   11752100 |   11752740 | Tag |00(4)                                                                    |     | 
   12118512 |   12119504 | Rdr |52(7)                                                                    |     | WUPA
   12120740 |   12123108 | Tag |44  00                                                                   |     | 
   12130544 |   12135312 | Rdr |50  00  57  cd                                                           |  ok | HALT
   12992128 |   12993120 | Rdr |52(7)                                                                    |     | WUPA
   12994356 |   12996724 | Tag |44  00                                                                   |     | 
   13004144 |   13006608 | Rdr |93  20                                                                   |     | ANTICOLL
   13007780 |   13013668 | Tag |04  e2  26  75  b5                                                       |     | 
   13021024 |   13031488 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
   13032724 |   13036244 | Tag |08  b6  dd                                                               |  ok | 
   13152528 |   13154736 | Rdr |50! 00!                                                                  |     | HALT
   13157508 |   13158148 | Tag |00(4)                                                                    |     | 
   13231936 |   13234144 | Rdr |50! 00!                                                                  |     | HALT
   13236932 |   13237572 | Tag |00(4)                                                                    |     | 
   13286928 |   13289136 | Rdr |50! 00!                                                                  |     | HALT
   13291924 |   13292564 | Tag |00(4)                                                                    |     | 
   13333312 |   13335520 | Rdr |50! 00!                                                                  |     | HALT
   13338308 |   13338948 | Tag |00(4)                                                                    |     | 
   13730976 |   13731968 | Rdr |52(7)                                                                    |     | WUPA
   13733204 |   13735572 | Tag |44  00                                                                   |     | 
   13742992 |   13747760 | Rdr |50  00  57  cd                                                           |  ok | HALT
   14604672 |   14605664 | Rdr |52(7)                                                                    |     | WUPA
   14606900 |   14609268 | Tag |44  00                                                                   |     | 
   14616704 |   14619168 | Rdr |93  20                                                                   |     | ANTICOLL
   14620340 |   14626228 | Tag |04  e2  26  75  b5                                                       |     | 
   14633584 |   14644048 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
   14645284 |   14648804 | Tag |08  b6  dd                                                               |  ok | 
   14736496 |   14738704 | Rdr |50! 00!                                                                  |     | HALT
   14741476 |   14742116 | Tag |00(4)                                                                    |     | 
   14796160 |   14798368 | Rdr |50! 00!                                                                  |     | HALT
   14801140 |   14801780 | Tag |00(4)                                                                    |     | 
   14882288 |   14884496 | Rdr |50! 00!                                                                  |     | HALT
   14887284 |   14887924 | Tag |00(4)                                                                    |     | 
   14969216 |   14971424 | Rdr |50! 00!                                                                  |     | HALT
   14974148 |   14974788 | Tag |00(4)                                                                    |     | 
   15327936 |   15328928 | Rdr |52(7)                                                                    |     | WUPA
   15330164 |   15332532 | Tag |44  00                                                                   |     | 
   15339952 |   15344720 | Rdr |50  00  57  cd                                                           |  ok | HALT
   16201552 |   16202544 | Rdr |52(7)                                                                    |     | WUPA
   16203780 |   16206148 | Tag |44  00                                                                   |     | 
   16213568 |   16216032 | Rdr |93  20                                                                   |     | ANTICOLL
   16217204 |   16223092 | Tag |04  e2  26  75  b5                                                       |     | 
   16230448 |   16240912 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
   16242148 |   16245668 | Tag |08  b6  dd                                                               |  ok | 
   16367632 |   16369840 | Rdr |50! 00!                                                                  |     | HALT
   16372676 |   16373316 | Tag |00(4)                                                                    |     | 
   16439632 |   16441840 | Rdr |50! 00!                                                                  |     | HALT
   16444628 |   16445268 | Tag |00(4)                                                                    |     | 
   16480256 |   16482464 | Rdr |50! 00!                                                                  |     | HALT
   16485252 |   16485892 | Tag |00(4)                                                                    |     | 
   16554944 |   16557152 | Rdr |50! 00!                                                                  |     | HALT
   16559940 |   16560580 | Tag |00(4)                                                                    |     | 
   16932176 |   16933168 | Rdr |52(7)                                                                    |     | WUPA
   16934404 |   16936772 | Tag |44  00                                                                   |     | 
   16944208 |   16948976 | Rdr |50  00  57  cd                                                           |  ok | HALT
   17805808 |   17806800 | Rdr |52(7)                                                                    |     | WUPA
   17808036 |   17810404 | Tag |44  00                                                                   |     | 
   17817824 |   17820288 | Rdr |93  20                                                                   |     | ANTICOLL
   17821460 |   17827348 | Tag |04  e2  26  75  b5                                                       |     | 
   17834704 |   17845168 | Rdr |93  70  04  e2  26  75  b5  c8  c0                                       |  ok | SELECT_UID
   17846404 |   17849924 | Tag |08  b6  dd                                                               |  ok | 
   17982448 |   17984656 | Rdr |50! 00!                                                                  |     | HALT
   17987444 |   17988084 | Tag |00(4)                                                                    |     | 
   18054736 |   18056944 | Rdr |50! 00!                                                                  |     | HALT
   18059732 |   18060372 | Tag |00(4)                                                                    |     | 
   18135696 |   18137904 | Rdr |50! 00!                                                                  |     | HALT
   18140692 |   18141332 | Tag |00(4)                                                                    |     | 
   18222256 |   18224464 | Rdr |50! 00!                                                                  |     | HALT
   18227236 |   18227876 | Tag |00(4)                                                                    |     | 
   18562416 |   18563408 | Rdr |52(7)                                                                    |     | WUPA
   18564660 |   18567028 | Tag |44  00                                                                   |     | 
   18574432 |   18579200 | Rdr |50  00  57  cd                                                           |  ok | HALT
   19438292 |   19440660 | Tag |44  00                                                                   |     | 
@gornekich
Copy link
Member

Hello @dogtopus
We reproduced this issue and a fix arrived in #3264 . For some reason Pixel sends 15bit "halt" command instead of 16 bit 50 00 + 16 bit crc. I added crutch and now emulation should work as expected. Please update firmware to latest RC or dev and let me know if you still have this issue

@dogtopus
Copy link
Contributor Author

dogtopus commented Dec 5, 2023

It does go further and now empty/unlocked tags can be read. Though I'm now getting tag lost when trying to unlock a locked card. More info coming soon...

@dogtopus
Copy link
Contributor Author

dogtopus commented Dec 8, 2023

So it seems like whenever Flipper tries to emulate a tag with keyB auth I'm getting tag lost.

Unfortunately I can't provide a protocol trace here because my Proxmark3 seems to desync after the first AUTH command and only prints out a bunch of gibberish, for some reason.

@dogtopus
Copy link
Contributor Author

dogtopus commented Dec 8, 2023

Test.zip

Test file that reproduces this.

Tag lost occurs when unlocking the sector 1 (which has the access condition patched to 0x70f878) with Metrodroid.

@gornekich
Copy link
Member

Thanks for information!
#3291 should fix the issue

@dogtopus
Copy link
Contributor Author

@gornekich Seems to work well.

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

No branches or pull requests

3 participants