Skip to content

Conversation

@edvincent
Copy link
Contributor

@edvincent edvincent commented Jan 2, 2024

What's new

What's currently being added to the config structure was the total amount of blocks - as per this definition - which is 256.

However, what needs to be sent is the maximum sector data (as per the Proxmark3 Gen4 card notes). That's because the first block is 0, not 1. So if you need 256 blocks, you actually need to be able to write up to the 255th block - i.e. send 255 - well more specifically, 0xFF.

Effectively, this also "fixes" the fact that for each card being cloned, an extra sector was being provisioned as writable when using a Flipper Zero.

Why

I was having issues cloning an S70 fob (7b UID, 4k data), because as soon as it was written by the Flipper, it would be immediately read as a Mifare Mini 0.3k... I bought a Proxmark3, and after reading the backdoor config from the card, I saw that the 6B setting was set to 0x00.

That's because the config is a structure storing uint8_t, so trying to store the amount of blocks (256) instead of the maximum sector data we need (255) was causing an integer overflow... Because obviously, storing 256 needs more than 8 bits.

Verification

  • Build and launch nfc_magic with the change.
  • Write any 4k tag to a Gen4 card.
  • Read the Gen4 card, and see how it is not being recognized as a Gen4 tag.
  • (If you have a reader that allows you to check the raw config of a Gen4 tag) Check that the 29th bit of the config is 0xFF and not 0x00.

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

skotopes
skotopes previously approved these changes Jan 2, 2024
@skotopes
Copy link
Contributor

skotopes commented Jan 2, 2024

Nice catch. We'll release catalog update soon.

@skotopes skotopes merged commit 11c4d2a into flipperdevices:dev Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants