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 DESFire UID emulation not possible due to "Can not parse file" #2040

Closed
mh- opened this issue Nov 22, 2022 · 3 comments · Fixed by #2041
Closed

Mifare DESFire UID emulation not possible due to "Can not parse file" #2040

mh- opened this issue Nov 22, 2022 · 3 comments · Fixed by #2041
Labels

Comments

@mh-
Copy link
Contributor

mh- commented Nov 22, 2022

Describe the bug.

This is related to #1730, but I want to clarify that I do not expect the encrypted (and thus unreadable) data to be saved.
What I do want is that the UID is saved and can be emulated later, by opening a "saved" card.

I only have one particular DESFire card, and it is possible to use a cloned version of that card in its system, by just emulating the UID. I know this works, because the Android app "NFC Card Emulator Pro (Root)" can do that.
Of course, only the UID can be cloned, no encrypted data, but the reader accepts it anyway.

Now, after reading this card, the data which is saved by the firmware is 'a bit short', because of these problems

7618 [I][NfcWorker] Mifare DESFire detected
7832 [W][MifareDESFire] Bad DESFire GET_KEY_SETTINGS response
7842 [W][MifareDESFire] Bad DESFire GET_KEY_SETTINGS response

so the file ends after the Application IDs:

Filetype: Flipper NFC device
Version: 2
# Nfc device type can be UID, Mifare Ultralight, Mifare Classic
Device type: Mifare DESFire
# UID, ATQA and SAK are common for all formats
UID: 04 1B 2C EA 6B 3B 80
ATQA: 44 03
SAK: 20
# Mifare DESFire specific data
PICC Version: 04 01 01 01 00 16 05 04 01 01 01 04 16 05 04 1B 2C EA 6B 3B 80 BA 54 D3 9D 70 33 14
PICC Free Memory: 1760
PICC Change Key ID: 00
PICC Config Changeable: true
PICC Free Create Delete: true
PICC Free Directory List: true
PICC Key Changeable: true
PICC Max Keys: 01
PICC Key 0 Version: A2
Application Count: 2
Application IDs: 01 00 00 02 00 00

This causes the "Can not parse file" screen, and nothing can be done with this file.
So I suggest to accept such file (as it was written by the firmware previously) and only emulate the UID, no apps.
I will provide a simple PR for that.

Reproduction

  1. Switch on
  2. Go to NFC, Read
  3. Place a specific Mifare DESFire token under the device
  4. Save the data to a .nfcfile
  5. Go to NFC, Saved
  6. Select the file that was just written
  7. "Can not parse file" is shown, nothing can be done with the file.

Target

No response

Logs

No response

Anything else?

There is a follow-up bug - when trying to emulate the UID of that specific card immediately after the "Read", the external reader will not accept the emulation; and this apparently continues until the Flipper is rebooted, also when using the data from the saved file (which I did after applying the mentioned PR).

@mh- mh- added the Bug label Nov 22, 2022
mh- added a commit to mh-/flipperzero-firmware that referenced this issue Nov 22, 2022
@LowSkillDeveloper
Copy link

I also have this problem with my bus pass, wrote here: #1904 (comment)

@bkimminich
Copy link
Contributor

I have one Mifrare Desfire which was read by FZ previously as an Unknown ISO tag and I was able to save and also emulate its UID without any issues. My Android phone with the NFC Tools PRO app was telling me this is actually a Mifare Desfire, otherwise I wouldn't have known.

mh- added a commit to mh-/flipperzero-firmware that referenced this issue Nov 24, 2022
skotopes added a commit that referenced this issue Nov 28, 2022
* NFC: Accept non-parsed apps in Mifare DESFire. Fixes #2040

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
@skotopes
Copy link
Member

Fixed in #2041 thanks to @mh-

Dig03 pushed a commit to Dig03/flipperzero-firmware that referenced this issue Dec 31, 2022
* NFC: Accept non-parsed apps in Mifare DESFire. Fixes flipperdevices#2040

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants