Flipper-XFW / Xtreme-Firmware

The Dom amongst the Flipper Zero Firmware. Give your Flipper the power and freedom it is really craving. Let it show you its true form. Dont delay, switch to the one and only true Master today!
https://flipper-xtre.me
GNU General Public License v3.0
9.15k stars 651 forks source link

NFC writing through NFC Magic is entirely broken in XFW-0052_09122023 #526

Closed koolfy closed 5 months ago

koolfy commented 5 months ago

Describe the bug.

During some tests with a Ultimate Magic card (gen4), I noticed any attempt at writing data to the card through the NFC Magic app failed. The "Wipe Card" failed as well, and had an apparently random chance of soft-bricking the card. At that point, the card is completely useless unless you get a proxmark3 to issue a proper reset command.

I wanted to dig further, but simply by switching over to the latest upstream release of 0.97.1 fixed all these issues.

There were a bunch of refactoring and tweaks to the NFC stack upstream, so my theory is the current Xtreme build ( XFW-0052_09122023) got caught in the middle of some important ones, and they have since been fixed.

This issue is simply a warning that the current latest build has some broken functionalities, that will simply go away with the next Xtreme release when you ship the upstream fixes.

I don't know if this is worth updating the "known issues" section.

Basically, don't spent too much time investigating this, it will sort itself out :)

Reproduction

  1. Install NFC Magic (latest) on the flipper with Xtreme firmware (XFW-0052_09122023)
  2. Check tag of a Ultimate Magic card (gen4)
  3. Attempt any write operation (write a saved NFC dump or try wiping the card
  4. Notice that writes fail and wiping the card a few times results in a soft-brick (currently unrecoverable with the current NFC Magic and thus requiring dedicated hardware)

Target

No response

Logs

N/A this problem is not worth an in-depth investigation, it is already fixed upstream

Anything else?

This is a placeholder issue, the problem is already fixed upstream and very likely will disappear with the next official release (this might be a good reason to push one out the door soon?)

koolfy commented 5 months ago

In case people are curious, NFC Magic cannot currently reset a soft-bricked ultimate magic card (gen4), because such a card fails the initial "check tag" operation, which gates the wipe operation.

I'm thinking of doing a contribution to improve this in the app, but in the meantime, don't attempt repeated "wipes" through NFC magic on the current XFW-0052_09122023 build if you don't have access to a Proxmark3 device

FYI if you do, this will reset the card back to a usable state: hf 14a raw -s -c -t 1000 CF00000000F000000000000002000978009102DABC19101011121314151604000800

Willy-JL commented 5 months ago

Install latest xtreme dev and see if it's fixed

koolfy commented 5 months ago

Seems fixed when building and installing latest DEV (b833ebab1a3cea883aa53c2afa6f08befb367f3c) There is a problem with the "wiping" operation but other write operations seem to work fine so I suspect something changed with NFC Magic and will investigate on the app side :)

Doesn't look like a firmware-wide issue anymore!

Edit: Testing further I see some erratic behaviors, I'll try building the original firmware from dev branch as well and compare both to be 100% certain I see the same thing over there.

Willy-JL commented 5 months ago

As you said this is most likely an issue on app side. All depends how you install the app and what version. With xtreme you get the app version from out apps repo, it's updated every few days, but there might be new changes upstream in official nfc magic repo. As for official firmware, I'm guessing you are installing the app from app hub, which is stable releases rather than development versions. We always pull the latest from upstream apps

Willy-JL commented 5 months ago

That's to say maybe it's a bug that is being actively developed and fixed, and isn't quite there yet, not sure. But if you install the same app on xtreme and ofw and get different results, then that is an issue that should be brought up to us. Or if the issue is fixed upstream and we are yet to include the fix, then that too.

koolfy commented 5 months ago

I'll try to determine what introduced/fixed the issue currently affecting the latest release of Xtreme (app or firmware), before we close this issue if that's ok with you!

koolfy commented 5 months ago

Allright after many firmware and version flashes, I haven't been able to reproduce exactly the problems I was experiencing. I can confirm that XFW-0052_09122023 is unreliable when it comes to Nfc Magic writing operations but can't really be sure of whether it's simply caused by the vastly different app version. While these functionalities are unreliable, they are working better than I was experiencing previously, and after trying for an hour I was unable to soft-brick the card again. (this was a 20s affair before)

I'm questionning my entire methodology for reproducing this issue, so I think I'll stop there, close this issue, and simply give my testimony that the next Xtreme-firmware build will bring substantial improvements when interacting with Magic Ultimate Cards (gen4), both in reliability and added functionalities.

I don't know how widespread my initial issue was, as I can't reproduce it, I suspect it is the reason behind these posts on reddit: https://www.reddit.com/r/flipperzero/comments/18nul01/gen4_ultimate_magic_card_recovery_mode/ But I'm not sure it is as "urgent" as I thought to produce a new release. Cool, absolutely. But not urgent IMO.

Sorry for the noise, I'll keep using dev builds and being more careful with my methodology before I open other issues :)

Willy-JL commented 5 months ago

Thanks for taking the time and experimenting with it, most wouldn't and would just demand a fix with no further explanation or research. Props! And yeah release will be not too far from now I hope