Kasper2007 Chapter AnEmbeddedSystemForPracticalSe PDF
Kasper2007 Chapter AnEmbeddedSystemForPracticalSe PDF
Keywords: RFID, Low Level Reader, Fake RFID Tag, Relay Attack.
1 Introduction
As technology evolves and chip sizes decrease, RFID (Radio Frequency Iden-
tification) is becoming widely-used for ubiquitous tasks. The ISO 14443 [14]
norm for contactless smartcards is currently employed in various security sen-
sitive applications, such as the electronic passport [3] to store biometric data
and RFID-enabled credit cards [31]. The contactless interface brings new oppor-
tunities for potential attackers: The device can not only be activated and read
out without the actual owner taking note of it, but also can the transmission
of data via the RF (Radio Frequency) field be eavesdropped from a distance
of several meters [8]. This demanded for countermeasures, such as encryption
of the interchanged data and the BAC (Basic Access Control) in the electronic
passport [15].
New Perils. However, modern attackers get physical access to the chip or its
electromagnetic field and perform so called side channel attacks like a DEMA
(Differential Electro Magnetic Analysis) which can be performed with contactless
smartcards [5]. By measuring and evaluating the electromagnetic emanation and
correlating it with the code running on the chip, information about a secret key
stored on it is gathered. A remote power analysis was performed by Oren and
Shamir [22]. Their attack, targeting at RFID tags operating in the UHF (Ultra
High Frequency) range, could probably also be applied to contactless smartcards.
D. Sauveron et al. (Eds.): WISTP 2007, LNCS 4462, pp. 150–160, 2007.
c IFIP International Federation for Information Processing 2007
An Embedded System for Practical Security Analysis 151
Reader → Tag. The reader sends data to the tag using a modified (pulsed)
Miller code [9]. Pauses have to be created with a duration of approximately 2.5 μs
with 100 % ASK (Amplitude Shift Keying), i.e., the field has to be completely
switched off and on by the reader (compare with the upper waveform in Fig. 1).
Tag → Reader. Due to the inductive coupling, the feedback of the transponder
drawing more or less energy from the field can be sensed on the side of the
reader. Hence, the tag transmits data by switching on and off an additional
load and thereby deliberately drawing more energy from the field than during
normal operation. This process is termed load modulation. As the coupling
between tag and reader is pretty weak, the resulting effect on the field is almost
not noticeable (compare with the lower waveform in Fig. 1). For this reason, a
subcarrier of the frequency of the reader is used for the load modulation, resulting
in the transmitted information being placed in sidebands and so making its
detection possible [9]. The data is transmitted employing Manchester code and
synchronously to the field of the reader, utilising the described OOK (On-Off
fc
Keying) with a subcarrier of 16 = 847.5 kHz.
The developed embedded system consists of a multi purpose reader device which
is equipped with a μC (microcontroller), an RF interface and some components
for signal processing. A second device, termed fake tag, is designed to appear like
an authentic tag to an RFID reader and furthermore can acquire the information
contained in the field. Between the two units, a communication link can be
established.
3
The technical term for coil is inductivity.
4
Similar to the common transformer principle.
An Embedded System for Practical Security Analysis 153
3.1 Reader
The operation principle of the low level reader, as detailed in this section, is
depicted in Fig. 3. The RFID tool is based on an Atmel ATMega32 [1] micro-
controller, clocked at 13.56 MHz, which is amongst others equipped with 32 kB
Flash RAM, 1 kB non-volatile EEPROM(Electronically Erasable Programmable
Read Only Memory) and an ADC (Analog to Digital Converter). For flexi-
ble operation and testing, the software running on the μC can be updated
through a PC without the need to remove it from the PCB (Printed Circuit
Board).
The main part of the analogue front end is provided by the EM 4094 RF-
transceiver [6] which possesses a 200 mW push pull transmitter operating at
13.56 MHz, is capable of 100% ASK and ready for ISO 14443A operation at a
price of less than 5 e . The received HF-Signal can be conditioned by internal
filters and adjustable receiver gain. The chip allows for transparent operation,
i.e., a high input level on its DIN pin will instantly switch off the field, while
a low level switches it on, thus enabling flexible, direct control of the RF field.
The output stage of the transceiver has been matched for feeding the signal into
154 T. Kasper, D. Carluccio, and C. Paar
A tag needs a coil to establish the coupling with its counterpart at the reader
(see Sect. 2). A capacitor is connected in parallel to this inductance, to form
1
a parallel resonant circuit. For an ideal parallel resonant circuit, fc = √LC
applies [32], where fc denotes the carrier frequency of the reader, C the capaci-
tance and L the inductance of the tuned circuit. In practice, first the value for L
is derived from the shape and dimensions of the coil. Afterwards, the optimal C
is calculated and then realised as a variable capacitor, so that the circuit can be
tuned more precisely later on. The induced voltage can become relatively large,
so two antiparallel Zener-diodes limit the maximum possible voltage and thus
protect the rest of the circuit.
fc
The subcarrier with a frequency of 16 =847.5 kHz is derived from the field
generated by the reader. For this, the antenna is connected to the input of a 4-bit
binary counter 74393 [23] through a resistor which limits the maximum current
into the input stage, as proposed in [7]. The fourth output of the binary counter
toggles every 23 = 8 clock cycles which equals frequency division by 16, i.e., the
desired subcarrier. For modulating the incoming Manchester coded signal with
the subcarrier, a 7408[24] AND gate combines it with the output of the binary
counter.
To achieve the load modulation, as described in Sect. 2, a resistor has to be
connected in parallel to the coil of the tag. This is realised via an IRFD 110 [13]
N-channel MOSFET, allowing for fast switching and a maximum drain-source
voltage of 100 V. The output of the AND gate (see above) is connected to the gate
of the transistor. Accordingly, by toggling the resistor, the 848 kHz-modulated
6
Can be a small lithium battery.
156 T. Kasper, D. Carluccio, and C. Paar
Manchester code is in turn modulated onto the 13.56 MHz field of the reader
and the information put into the sidebands of the carrier.
To acquire data from a nearby reader, an LM 311 comparator combined with
two envelope detectors (as detailed in Sect. 3.1) are connected in parallel to the
resonant circuit. One of the detectors has a fast response time and distinguishes
between the field being completely switched off and the load modulation case.
The other envelope detector reacts slower and averages the signal at the antenna,
for adapting the threshold voltage of the comparator to the current field strength.
This approach immunises the circuit to noise caused by the RF field and so
extends the operating range.
The output of the comparator is connected to a 7474 D-type flip-flop [25],
whose inverted output is fed back into its input. Hence, a change of the output
state occurs on every rising edge at the input. This conversion from pulses into
transitions, resulting in a Miller coded data signal, is amongst others necessary
to reduce the bandwidth required for the communication link of the RFID tool.
The software for the μC is mainly written in C, with assembler code inserted,
where the execution speed is crucial. Besides, a C library for controlling the RFID
tool from a PC, as well as a corresponding GUI (Graphical User Interface) is
available. The following operating modes are currently implemented:
– bit level reader : the reader is freely controlled by the PC via USB,
– stand-alone reader : mobile operation with an arbitrary command sequence
prestored in the EEPROM (and acquired data stored into it),
– tag emulation: the fake tag is directly controlled via USB,
– mobile tag emulation: prestored data is replayed by the fake tag, while the
reader’s requests are recorded to the EEPROM,
– relay mode: mobile operation of both reader and fake tag, while the relayed
bits in both directions can be recorded to the EEPROM.
Further routines are provided for generating ISO 14443 compliant bitstreams
and for reading and writing the non-volatile EEPROM.
4 Results
The flexible low level reader mode has been successfully tested with several
ISO 14443 compliant tags which are partly listed below in this section. The
exact behavior and timing of the contactless interface can be flexibly steered,
even transcending the ISO standard, if desired.
The data sent out by the fake tag is accepted by an ACG7 Dual 2.1 Passport
Reader in our laboratory, just as if it was a genuine tag. During our tests, the
answer of the fake tag to a request issued by the reader was intentionally delayed
7
http://acg-id.aaitg.com
An Embedded System for Practical Security Analysis 157
by more than 250 μs and the resulting behaviour was analysed. Compliance of
the ACG reader with the strict timing requirements during the initialisation
phase8 could not be observed, i.e., the delayed answer was still accepted, thus
easing relay attacks.
The RFID tool can be used for logging the data interchanged in any direc-
tion. This can be helpful to analyse unknown protocols, as well as for further
processing, e.g., key-search with cost effective hardware, such as proposed in [18].
Various antennas were built, tuned to resonance with the carrier frequency
and matched to a 50 Ω coaxial cable, to perform tests with regard to the oper-
ating range and the influence of the physical environment of the card.
For executing a relay attack [16], the antenna of the bit level reader possessed
by the offender has to be placed close enough to a contactless card of the victim.
At the same time, the fake tag is brought into the field of an RFID reader, e.g.,
at the cash desk, by an accomplice. The data being transferred by this reader is
acquired and directly forwarded on the bit layer through a communication link to
the attacker. There, the data is retransmitted to the card of the victim. Its answer
is relayed back to the reader at the cashpoint and so, as the attackers continue
relaying the data, both reader and tag will be convinced that they are in close
vicinity to each other and thus carry out their task, e.g., authorise a payment.
Such an attack has been successfully carried out using the here described
embedded tool with
until to at least reading out the UID (Unique Identifier) of the tags. In the case
of the Mifare classic, after a the successful login, encrypted data blocks were read
out and modified remotely. Furthermore, the 64 Byte content of a world cup ticket
was read out using the relay mode and the interchanged data was recorded for
subsequently analysing the protocol. The Philips Mifare Ultralight chip embedded
in the ticket [28] provides no encryption at all. Hence, the RFID access control
could easily be spoofed with the developed embedded system, by means of a replay
attack, as the communication protocol is fully published in the data sheet [27].
When relaying data, a delay is inevitable, as described in Sect. 3.1. However,
if a reader scrutinised the timing, a relay attack could still be carried out suc-
cessfully, as the (fixed) bit sequence of a command could be stored in the μC
and sent out instantly after an incoming request.
Hancke and Kuhn [12] proposed a countermeasure for relay attacks, based
on ultra-wideband pulses. Still, as it is not employed in current tags, the most
effective way to enhance privacy is constructing a Faraday’s cage for the tag:
Our experiments proved, that a single layer of aluminum foil wrapped around
8
ISO 14443 requires the tag to answer to a REQA exactly after 86.9 μs.
158 T. Kasper, D. Carluccio, and C. Paar
5 Future Prospects
At the moment, the achieved read range with the developed reader and the
antennas used is approximately 5-10 cm. It is possible to extend this range to
25 cm [17], using a power amplifier [20] and a large copper tube antenna [30].
The communication protocol of a Philips Mifare DESFire contactless smart-
card has been reverse engineered until to the point necessary for carrying out
a DEMA [4]. In the respective attack, the challenges9 were generated by a
proprietary RFID reader and had to be extracted from the oscilloscope wave-
forms, which meant a severe, time consuming constraint for the analysis. Using
the developed system, arbitrary access to the contactless interface is provided,
allowing amongst others for freely chosen challenges. A DEMA is based on a
statistical test at one certain point in time, so subsequent measurements need
to be synchronised before superimposing them. The for his purpose required
reliable signal to trigger the oscilloscope can now also be emitted by the RFID
tool, thus further improving the attack.
It is promising to use the embedded system for execution of a remote power
analysis. During the pauses occurring in the field of the reader (compare with
Sect. 2), a tag draws its energy from a built-in capacitor which recharges, when
the field is activated again. Consequently, different shaped energy peaks emerge
in the field, depending on the amount of power consumed by the tag during the
energy gap. This behaviour might be exploited to derive a secret key stored on
the tag. The RFID tool provides a corresponding output signal which can be
acquired by the Atmel’s internal ADC or an oscilloscope.
As the reader can be arbitrarily programmed, fault injection attacks are
feasible [2] in which the device is forced to show erroneous performance, by
perturbing physical parameters like the power supply or the clock frequency.
Furthermore, controlling of external pulse generators and other fault injection
equipment with the RFID tool is possible.
Finally, any new protocols based on the ISO 14443 standard can be im-
plemented and tested. If additional hardware was required, it could easily be
connected to the PCB.
6 Conclusion
In this contribution, we present an embedded implementation of a cost effective,
arbitrarily programmable RFID reader and a fake tag which can be used for var-
ious promising purposes. The tool was built using electronic hobbyist equipment
9
Random numbers interchanged for the authentification.
An Embedded System for Practical Security Analysis 159
and off the shelf components at a cost of less than 40 e, and its design is simple
enough to be reproduced by a low skilled attacker. With the developed hard-
ware, we have successfully carried out relay and replay attacks between various
contactless smartcards and a commercial RFID reader. Integrated in a measure-
ment system, the proposed tool can help to carry out security analyses, such
as a DEMA or a remote power analysis, and assist fault injection attacks. The
stand-alone operation modes permit for mobile tag emulation, reader operation
and logging of the interchanged data.
Employing ISO 14443 compliant contactless smartcards in security sensitive ap-
plications should be regarded very critically, as the physical interface is proven to
be insecure against relay attacks. A smartcard identified by a reader does not have
to be in its direct vicinity, as declared by many manufacturers. Instead, the data
can be forwarded from large distances without permission or even notification of
the owner, as described in this paper, with little effort. If an RFID tag is indispens-
able, we suggest a metal shielding to prevent unauthorised access and propose that
the card should not be able to become active, unless the owner has performed an
action, e.g., press a button or open the cover of his electronic passport.
References
1. Atmel. ATMega32 data sheet.
http://www.atmel.com/dyn/resources/prod documents/doc2503.pdf.
2. E. Biham and A. Shamir. Differential fault analysis of secret key cryptosystems.
Lecture Notes in Computer Science, 1294:513–, 1997.
3. BSI - German Ministry of Security. ePass - Der Reisepass mit biometrischen
Merkmalen. http://www.bsi.de/fachthem/epass/.
4. D. Carluccio. Electromagnetic Side Channel Analysis for Embedded Crypto De-
vices. Master’s thesis, Chair for Communication Security at the Ruhr University
Bochum, 2005. Diploma thesis.
5. D. Carluccio, K. Lemke, and C. Paar. Electromagnetic side channel analysis
of a contactless smart card: first results. In ECRYPT Workshop on RFID
and Lightweight Crypto, pages 44–51, Graz, Austria, July 2005. ECRYPT.
http://www.iaik.tu-graz.ac.at/research/krypto/events/RFID-Slidesand
Proceedings/Proceedings-WSonRFIDandLWCrypto.zip.
6. EM Microelectronic. EM4094 fact sheet. http://www.emmicroelectronics.com/
webfiles/product/rfid/ds/EM4094 fs.pdf
7. Fairchild Semiconductors. Application note 313: DC electrical characteristics of
MM74HC high speed logic. http://www.fairchildsemi.com/an/AN/AN-313.pdf.
8. T. Finke and H. Kelter. Radio Frequency Identification Abhörmöglichkeiten der
Kommunikation zwischen Lesegerät und Transponder am Beispiel eines ISO14443-
Systems. http://www.bsi.de/fachthem/rfid/Abh RFID.pdf. BSI - German Min-
istry of Security.
9. K. Finkenzeller. RFID Handbook: Fundamentals and Applications in Contactless
Smart Cards and Identification. John Wiley and Sons, 2nd edition, 2003.
10. FTDI. FT245 USB chip data sheet. http://www.ftdichip.com/Documents/
DataSheets/DS FT245R v105.pdf.
11. G. Hancke. A practical relay attack on ISO 14443 proximity cards.
http://www.cl.cam.ac.uk/ gh275/relay.pdf, 2005.
160 T. Kasper, D. Carluccio, and C. Paar