franckbour / Plugin.NFC

A Cross-Platform NFC (Near Field Communication) plugin to easily read and write NFC tags in your application.
MIT License
236 stars 68 forks source link

The readonly function does not set the complete nfc tag to readonly #80

Open JarJarBinkz opened 3 years ago

JarJarBinkz commented 3 years ago

Description

The CrossNFC.Current.PublishMessage(tagInfo, true) method does not set the entire Nfc tag to readonly. For example, it is possible to add or change records using an NFC Writer on the desktop. And that is exactly what should be prevented. The Plugin.NFC says if you want to rewrite a tag described with CrossNFC.Current.PublishMessage(tagInfo, true) that it is readonly. But with my Desktop USB NFC Writer I can write it because the records are not set to readonly.

Used nfc tag: NXP Mifare Ultralight - NTAG216

Steps to Reproduce

  1. Use an NXP Mifare Ultralight - NTAG (best the NTAG216)
  2. Write the Tag with CrossNFC.Current.PublishMessage(tagInfo, true)

Expected Behavior

The complete NFC tag should be readonly.

Actual Behavior

The records are not readonly and can be written with a desktop usb nfc writer. It seems that only a kind of flag was set for the write protection that does not protect the records.

Basic Information

Screenshots

The NTAG216 tag written with the Plugin.NFC and set to readonly. Here you can see that the blocks are not set to readonly. Bildschirmfoto 2021-08-24 um 11 35 45

Here is a NTAG213 that has already been purchased on the internet as readonly and is completely on readonly. Bildschirmfoto 2021-08-24 um 11 36 08

Reproduction Link

saamerm commented 3 years ago

@JarJarBinkz this is a good catch. Are you able to replicate this with android as well using the cloned code?

saamerm commented 3 years ago

@JarJarBinkz

JarJarBinkz commented 3 years ago

@saamerm Sorry for the late answer. Unfortunately, I don't have an Android device to test at the moment. If I get an Android device in the next few weeks, I can test this.