nfc - cllu/.rc GitHub Wiki

Building on Raspberry Pi, with ACR122 reader

ACR122 driver

$ # check http://www.acs.com.hk/en/driver/3/acr122u-usb-nfc-reader/
$ # the `PC/SC Driver Package Linux` contained deb packages, and is preferred 
$ wget http://www.acs.com.hk/download-driver-unified/5128/ACS-Unified-PKG-Lnx-111-P.zip
$ # unzip
$ dpki -i 

dependencies

$ sudo apt-get install automake autoconf libtool libusb-dev
$ sudo apt-get install libpcsclite-dev libpcsclite1 pcsc-tools pcscd

pscs-tools provides pscs_scan, use this to confirm that PCSC lite is working correctly. To debug the problem of PCSC, start it in front using sudo pcscd -f and check the output messages. If it says that usb cannot be claimed, it probably already claimed by linux kernels. Check this for a solution:

Create a file /etc/modprobe.d/rfid-blacklist.conf with content:

blacklist pn533
blacklist nfc

and remove kernels: sudo modprobe -r pn533 nfc

libnfc

$ git clone https://github.com/nfc-tools/libnfc.git
$ autoreconf -i
$./configure --with-drivers=acr122_pcsc --sysconfdir=/etc --prefix=/usr
$ make
$ make install

confirm libnfc is working by running nfc-list, remember to put the card on the reader first.

mfcuk

$ git clone https://github.com/nfc-tools/mfcuk.git
$ ./configure
$ make

mfoc

$ git clone https://github.com/nfc-tools/mfoc.git
$ autoreconf -vis
$ ./configure
$ make

Usage:

$ sudo mfcuk -C -R 1 -s 250 -S 250 -v 3
  • -C require explicit connection to the reader.
  • -R 1 means we only want to recover the second key
  • -v 3 so we can see the progress

why setting -s and -S

https://github.com/nfc-tools/mfcuk/issues/30#issuecomment-162279468

"Misbehaving cards" where "diff Nt" continues to increment with "auths" above 300 can indicate a couple of different issues:

  1. Your card reader is not operating very well. With cheap readers, you may have to add sleep options (eg: -s 250 -S 250) in order to increase the stability of the crack. You should see diff Nt stay below 300, and auths continue to increment above that. This is particularly an issue with the acr122u and pn532 chipsets.

  2. You have the wrong version of libnfc/mfcuk. Make sure that mfcuk is loading the correct library (use ldd and LD_LIBRARY_PATH to check and fix).

  3. You have a Mifare Plus card with Classic emulation mode. This fixes the exploit vector used by mfcuk and mfoc. Unfortunately, there's not much you can do about this, apart from wallowing in sadness.

If your cards are part of a system, it's probable that the key is generated by a function of the card's UID and sector number. If you have enough older cards (not MF Plus) which are vulnerable, you should be able to figure out the key derivation function once you have a mathematically significant number of samples.

mfcuk: ERROR: mfcuk_key_recovery_block()

http://forums.nfc-tools.org/topic/1321/mfcuk-error-after-970-auth-with-an-acr122/

ACR122U does have the worst support in libnfc... That's not a problem from software, that's an hardware problem. Please read wiki about issues around this reader.

References