

We can research for special commands throughout the specification datasheets, for example, in the ACR122u we can find how to create a direct transmission to the RFID reader:īasically, we have a class:FF, ins:00, p1:00, p2:00, the length and the data. Result, sw1, sw2 = ansmit(COMMANDS,protocol = sprotocol) To do this, we have to use the transmit() method. At this point we are able to send commands with the established connection. Now, we have everything to create a connection to the RFID:Ĭonnection = reader.createConnection()Īssuming that we only have one connected RFID to our computer: reader. Basically, the T0 is implemented for Chip & Pin card readers, and T1 for contactless card readers. The protocol is VERY important to read the right technology. Note: half duplex means that it can send OR transmit data only, not both tasks at the same time. The T0 has a low memory capacity while the T1 has a error detection by the end of the blocks. The T0 is byte-oriented half duplex transmission protocol, and the T1 is a block-oriented half duplex protocol. The next thing is to select what type of protocol we will use to communicate to the RFID.
Install pyscard mac install#
The RFID is the USB ACR122u.Īfter we install the pyscard, we can test the RFID communication directly from the Python console: The Smartcard library that I am implementing with Python is pyscard to control the communication with the reader.
Install pyscard mac mac os#
These code examples were tested in a Mac OS 10.13.1 and Python 2.7. This is important because with the right command, we may change the light, mode or buzzer configuration.Īs usual, I will start with a list of components to understand the process of emulation. One thing to have in mind is that we are talking directly to the hardware, so we can access special places to extract data, even we can change behaviors in the ACR122u hardware components.

We will interchange between datasheets: the “general” AR122u and the PN532. To talk directly to the hardware, we need to use a special language: Pseudo APDU Commands +. To understand more about the hardware, I recommend to take a look a its datasheet. I personally use it as RFID reader or emulator. It could be implemented in different ways. Of course, security by obscurity should not be implemented, instead of that, companies have to applied, in a correct way, established protocols such as distance bounding to avoid any NFC technology exploitation by relay attacks Also a better tokenization design to protect the NFC technology against replay attacks.

What do you think is going to be my next project!? #defcon /rwfU624oWL Some of these realistic attacks using emulation were presented at DEF CON 25, for example, the Man in the NFC talk. How to test these methodologies or how to create a new NFC penetration testing tool are essential. Moreover, the main reason to learn how to emulate a contactless card is to be prepared and aware about the dangerous scenarios and limitations of the NFC payment technology. The first could be that it is difficult to implement a native language to talk to the card reader, and it changes depending of the native chip. The idea of emulating is not very well documented for many different reasons. Some users could implement a RFID device as contactless card to make transactions, validate an individual entrance or to access certain building or hotel. To mimic a contactless card behavior, an emulation is required. We can see this in almost every smart-phone or gadgets to make payments. You can learn more about that from my first post about NFC.Įmulate a card is essential in the actual NFC technology. Those commands could be Pseudo APDUs or Native orders.

In order to implement a RFID reader as card emulator, we should be able to program the hardware using specific configuration commands to initialize it in that specific mode. I will focus on card emulation after a difficult poll: In the same way, NFC protocol is divided in three categories: RFID is divided is different categories: low frequency (LF), high frequency (HF), ultra-high frequency (UHF)… Because we have different technologies using high frequency, I will talk specifically about ISO/IEC 18000-3 which standards for Near Field Communication (NFC). In this post specifically, I will use the PN532 NFC Controller chip from my USB RFID ACR122u. Card emulation is a technique that many different RFID chips support.
