OTP circumventing in MIFARE ULTRALIGHT: Who says free rides?



Similar documents
NFCulT. An easy a nice tool that will make you have fun, or... make profit!

Electronic Access Control Security. Matteo Beccaro HackInTheBox Amsterdam, May 27 th, 2016

Credit Card Fraud The Contactless Generation Kristin Paget

MIFARE CONTACTLESS CARD TECHNOLOLGY AN HID WHITE PAPER

Security Evaluation of the disposable OV-chipkaart v1.6

RFID MODULE Mifare Reader / Writer SL030 User Manual Version 2.6 Nov 2012 StrongLink

NACCU Migrating to Contactless:

AN mifare Ultralight Features and Hints. Document information. Multiple ticketing, secured data storage, implementation hints

A: We really embarrassed ourselves last night at that business function.

Hacking Mifare Classic Cards. Márcio Almeida

Make a folder named Lab3. We will be using Unix redirection commands to create several output files in that folder.

Mobile memory dumps, MSAB and MPE+ Data collection Information recovery Analysis and interpretation of results

Bypassing Local Windows Authentication to Defeat Full Disk Encryption. Ian Haken

Reverse engineering hardware for software reversers: studying an encrypted external HDD

Securing Remote Desktop for Windows XP

RFID Security. April 10, Martin Dam Pedersen Department of Mathematics and Computer Science University Of Southern Denmark

Exercise 1: Set up the Environment

RFID Hacking. Live Free or RFID Hard. 01 Aug 2013 Black Hat USA 2013 Las Vegas, NV. Presented by: Francis Brown Bishop Fox

Secure USB Flash Drive. Biometric & Professional Drives

Introducing the Adafruit Bluefruit LE Sniffer

The Real State of WiFi Security in the Connected Home August 25, 2015

VIDEO Intypedia013en LESSON 13: DNS SECURITY. AUTHOR: Javier Osuna García-Malo de Molina. GMV Head of Security and Process Consulting Division

RFID MODULE Mifare Reader / Writer SL031 User Manual Version 2.7 Nov 2012 StrongLink

Security and Privacy Issues of Wireless Technologies

Good CAD / Bad CAD. by Tony Richards

New Attacks against RFID-Systems. Lukas Grunwald DN-Systems GmbH Germany

AN1304. NFC Type MIFARE Classic Tag Operation. Application note PUBLIC. Rev October Document information

Vulnerability in Magento's implementation of PayPal

PUF Physical Unclonable Functions

10 steps to better secure your Mac laptop from physical data theft

Data recovery from a drive with physical defects within the firmware Service Area, unrecoverable using

FareONE-Health Smart Card Presentation

Secure Data Exchange Solution

Secure recharge of disposable RFID tickets

RFID MODULE Mifare Reader / Writer SL032 User Manual Version 1.5 Nov 2012 StrongLink

Hacking the NFC credit cards for fun and debit ;) Renaud Lifchitz BT Hackito Ergo Sum 2012 April 12,13,14 Paris, France

RFID MODULE Mifare Reader / Writer SL025B User Manual Version 1.4 Nov 2012 StrongLink

NVT (Network Virtual Terminal) description

AFA CYBER ETHICS MODULE

Encoding Text with a Small Alphabet

MF0ICU2. 1. General description. MIFARE Ultralight C. 1.1 Contactless energy and data transfer. 1.2 Anticollision. Rev May

Access Control, Ticketing and Booking System for Sports Halls

1.2 Using the GPG Gen key Command

Secure My-d TM and Mifare TM RFID reader system by using a security access module Erich Englbrecht (info@eonline.de) V0.1draft

The virtual safe: A user-focused approach to data encryption

Pre-authentication XXE vulnerability in the Services Drupal module

RFID Penetration Tests when the truth is stranger than fiction

Online Backup by Mozy. Common Questions

Into The Droid. Gaining Access to Android User Data DEF CON 20

WHITE PAPER AUGUST Preventing Security Breaches by Eliminating the Need to Transmit and Store Passwords

Securing Host Operations with a Dedicated Cryptographic IC - CryptoCompanion

Absolute Backdoor Revisited. Vitaliy Kamlyuk, Kaspersky Lab Sergey Belov, Kaspersky Lab Anibal Sacco, Cubica Labs

(General purpose) Program security. What does it mean for a pgm to be secure? Depends whom you ask. Takes a long time to break its security controls.

Gemalto Mifare 1K Datasheet

ACR122 NFC Contactless Smart Card Reader

WhatWorks: Blocking Complex Malware Threats at Boston Financial

Attacking Obfuscated Code with IDA Pro. Chris Eagle

Penetration Testing Walkthrough

Binary Numbers. Binary Octal Hexadecimal

Attacking the Traveling Salesman Point-of-sale attacks on airline travelers DEFCON 2014

Module 8 Increase Conversions by 29% for EACH Branch through Technology! What You'll Learn in this Module...

Budget Main Window (Single Bank Account) Budget Main Window (Multiple Bank Accounts)

E-Blocks Easy RFID Bundle

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

How to use PGP Encryption with iscribe

USING MIFARE CLASSIC TAGS VERSION

Pointsec Enterprise Encryption and Access Control for Laptops and Workstations

mcard CPK Supported Solutions

Wireless Security: Secure and Public Networks Kory Kirk

SD Card Hacking. The Exploration and Exploitation of an SD Memory Card. bunnie & xobs 30c3

Counter Expertise Review on the TNO Security Analysis of the Dutch OV-Chipkaart. OV-Chipkaart Security Issues Tutorial for Non-Expert Readers

Pryvate App User Manual

Mobile Application Security

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

EMV and Chip Cards Key Information On What This Is, How It Works and What It Means

SATA SSD Series. InnoDisk. Customer. Approver. Approver. Customer: Customer. InnoDisk. Part Number: InnoDisk. Model Name: Date:

Software Card Emulation in NFC-enabled Mobile Phones: Great Advantage or Security Nightmare?

The Security Gap. Philip Young aka Soldier of

White Paper Preventing Man in the Middle Phishing Attacks with Multi-Factor Authentication

Samsung Drive Manager FAQ

Today. Important From Last Time. Old Joke. Computer Security. Embedded Security. Trusted Computing Base

NewNet 66 Network Security

How To Get A Credit Card From The Irs

Internet Banking Attacks. Karel Miko, CISA DCIT, a.s. (Prague, Czech Republic)

New Tricks For Defeating SSL In Practice. Moxie Marlinspike

TechTarget Enterprise Applications Media. Pocket E-Guide

Using RFID Techniques for a Universal Identification Device

VON BRAUN LABS. Issue #1 WE PROVIDE COMPLETE SOLUTIONS ULTRA LOW POWER STATE MACHINE SOLUTIONS VON BRAUN LABS. State Machine Technology

How To Use Powerhell For Security Research

Apptix Online Backup by Mozy

Introduction to Open Atrium s workflow

AN1305. MIFARE Classic as NFC Type MIFARE Classic Tag. Application note COMPANY PUBLIC. Rev October Document information

YOU WILL NOT BE EFFECTIVE READING THIS.

10 Golden Rules of Project Risk Management

Security Principles. Related to. Handset Theft

PowerShell. It s time to own. David Kennedy (ReL1K) Josh Kelley (Winfang) Twitter: dave_rel1k

Encrypted PostgreSQL

@ChrisJohnRiley > whoami

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

Transcription:

OTP circumventing in MIFARE ULTRALIGHT: Who says free rides? bughardy bughardy@cryptolab.net Eagle1753 eagle1753@onenetbeyond.org Introduction RFID technologies are becoming more and more prevalent in our lives. This motivated us to study them, and in particular to study the MIFARE ULTRALIGHT chips, which are widely used in public/mass transport systems. We focused on multiple-ride tickets, and were surprised that MIFARE ULTRALIGHT chips do not seem to store any type of encrypted data. NFC chips should help transport company to prevent fraud and fake tickets but the scenario we are going to present shows a very different situation. In 2012 a security team from U.S.¹ found a bad implementation of transport ticket checking system. Each time a traveler made use of one of his ride, each ultralight card can store several rides, the system write the rides left on the DATA bytes of the ticket. It was enough to erase everything in data area to get a brand new ticket. After that several transport company started to use a security features of Mifare Ultralight ticket, OTP ( One-Time-Pad ) area. This area is composed o 32 bits. At the beginning each bit is set to zero, after each ride one bit is set to 1. In this area you can't turn bit back to zero. In this paper, and in the accompanying talk, we will discuss how bypass OTP features to gain again free rides using Mifare Ultralight transport tickets. And we will also show an easy script that displays ticket

informations and help us to get free rides. ¹Corey Benninger and Max Sobell, security researchers at the Intrepidus Group MIFARE ULTRALIGHT Sectors Let's give a look to how a Mifare Ultralight chip is made. We have 5 s: Sector UID Ticket's serial number Internal byte, written by manufacturer Lock bytes OTP bytes Data bytes Memory 9 bytes 1 byte 2 bytes 4 bytes 48 bytes In OTP all bits are set to 0 after production; if you want to write some bits in this area, they will be ORed with the existing, thus making impossible to turn a 1 bit into 0. This security features is used to prevent abuse of NFC chips in transport systems, so that it would be useless to erase the data area in order to get a brand new ticket. How the system works As we have already seen, each ride implies that a bit is set to 1 in OTP. But there are also others relevant data written on the ticket. For example transport type ( metro, bus, etc ) or the time of last stamp. All this data are written on DATA. As soon as you your ticket, you have 90 minutes to use your ride. Then you have to stamp again. The ticket is valid in any transport system, such as subway, bus or whatever and it doesn't matter where you stamp it: you can do it on a bus and then take subway if you are within 90 minutes; however, you can't get subway more than once for each ride. This means that ticket must store also data to identify metro station.

Vulnerabilities After much thinking we found two possible vulnerability. Decoding time data The first vulnerability we discover involve decoding the time written on the ticket. After acknowledging how it is encoded and written in data anyone can write it to the ticket avoiding to write OTP data, so you won't remove rides from your ticket but it looks like a validated one. Unfortunately we are still not able to decode data, we will provide some dumps for anyone who would like help us. There is also a second way to use this vulnerability: a MiTM attack. Using a NFC emulator, android phone or proxymark, an attacker could sniff the communication between the stamping machine and the chip and write only DATA bytes on the ticket. In that way you can validate the ticket for 90 minutes without knowing how time data is encoded. We didn't test it cause we don't have a proxymark. (ab)using lock bytes The most interesting vulnerability requires another : lock bytes. This is made of two bytes, each bit is used to freeze others bytes: First byte bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 Lock first 4 bytes in DATA Lock second 4 bytes in DATA Lock OTP Freeze lock bits for second half of data Freeze lock bits for first half of data Freeze lock bit for OTP Second byte locks only bytes in data, so at the moment is useless. Using bit 4 of first byte of lock we can lock the OTP, making impossible to machine turn it's bits to 1. This create an unlimited-

rides ticket. Our test shows the following lock bytes structure for our ticket: HEX F2 03 BIN 11110010 00000011 Analyzing it we saw that there are several bytes in DATA which are locked and them can't be unlocked anymore due the bit 6 of first byte. So, by turning bit 4 of first byte to 1, we locked the OTP, getting our free ticket for life. HEX FA 03 BIN 11111010 00000011 This makes the ticket endless Tool We're developing a tool to check ticket status and make it endless. It is really at alpha stage and we wish to rewrite it in C/C++. It's written in python and requires nfc-tool installed in the computer. Its functions are: Check dumps state Edit rides left and endless functionality Write dumps on HDD Write dumps on ticket It is not really optimized but it works and it is okay as a first release.

bughardy@cryptolab:~$ python nfc.py dump.mfd Looking for dump... Printing ticket infos... SERIAL NUMBER: 04d3e1be32782680ec INTERNAL BIT: 48 LOCK BYTES: fa03 FREE RIDES ENABLED! OTP BYTES: 3ffffffe RIDES LEFT: 1 DATA BYTES: 01040000020102be4011960000ae10a061040af32cbb244e43671f000 4f8000043671f00000d0004f8ae107a2f12e5f The main function is the dumpparser function which extracts infos from ticket dump: def dumpparser(content): SERIAL_NUMBER = content[0:18] INTERNAL_BIT = content[18:20] LOCK_BYTES = content[20:24] OTP_BYTES = content[24:32] DATA_BYTES = content[32:-1] INFOS_LIST = [SERIAL_NUMBER, INTERNAL_BIT, LOCK_BYTES, OTP_BYTES, DATA_BYTES] return INFOS_LIST The dumpedit function is used to change number of rides left on the ticket: def dumpedit(rides,path,content): otpdata = content[24:32] ticketpayload1, ticketpayload2 = 0,0 rides = 5 - int(rides) while rides!= 0: ticketpayload1 += 10**(2+rides) ticketpayload2 += 10**(1+rides) rides -= 1 In ticketpayload1 stores values of first 2 bytes of OTP data and ticketpayload2 the second half. The function of course can only decrease the rides number. As you can see code is very simple and we didn't set up everything yet. It is a sort of proof-of-concept.

Fix Fix the OTP vulnerability should be quite easy; it would be enough to release a firmware update in order to check if lock is locking OTP area or not, and if so, refuse to validate the ticket. The MiTM attack and the decoding attack would be more difficult to be fixed, indeed, as regards our opinion, there is not fix to that. The problem could be fixed by using NFC chips with encrypted communication. But the encryption should change the time data for each ticket, for example using UID as IV, otherwise a man with one ticket could validate several other tickets just copying his time data to their. bughardy aka Matteo Beccaro Eagle1753 aka Matteo Collura