转自: http://www.backtrack-linux.org/wiki/index.php/RFID_Cooking_with_Mifare_Classic

Contents

[hide]

  • 1 RFID Cooking with Mifare Classic
  • 2 0x00 - Preface
    • 2.1 Dependencies
  • 3 0x01 - Hardware
    • 3.1 Touchatag - ACR122U
  • 4 0x02 - Software
    • 4.1 ACR122U driver
    • 4.2 Open Source Near Field Communication (NFC) Library /LIBNFC/
    • 4.3 MFOC -Mifare Classic Offline Cracker
  • 5 0x03 - Dumping & Cooking
  • 6 0x04 – ISIC Issue
  • 7 0x06 – Conclusion
  • 8 0x07 – What's next?
  • 9 0x08 – Thanks
  • 10 0x09 – References & Links
  • 11 0x0A - About

RFID Cooking with Mifare Classic

DISCLAIMER: The information and reference implementation is provided:

  • For informational use only as part of academic or research study, especially in the field of informational security, cryptography and secure systems
  • As-is without any warranty, support or liability - any damages or consequences obtained as a result of consulting this information if purely on the side of the reader
  • NOT to be used in illegal circumstances (for example to abuse, hack or trick a system which the reader does not have specific authorizations to such as ticketing systems, public transport, University/ISIC cards, building access systems or whatsoever systems using Mifare Classic as core technology)

NOTES:

  • This article contain no original research. All the research and implementation was made by other people and communities and is publicly available. We made this two cents just for fun and because we love BackTrack.
  • This is not A-Z guide so try harder!

0x00 - Preface

Some of you may have read that the proprietary symmetric key cryptographic algorithm of the MIFARE Classic card has been broken. The MIFARE Classic card is used in physical access control systems (PACS) and contact less payment systems (including tollway and public transportation systems). By some estimates, there are 500 million MIFARE cards deployed worldwide, and the majority of them are MIFARE Classic cards.

Mifare Classic is a inexpensive, entry-level chip, based on ISO/IEC 14443 Type A, 1kB or 4kB. Uses 13.56 Mhz contactless smartcard standard, proprietary CRYPTO1 with 48 bits keys. There is no protection against cloning or modifications. Anyone with 50 € reader can use this weakness against your infrastructure. At least one sector is always encrypted with default key. After cracking all keys, hackers are able to change name, students university number, expiration date... This cookbook is proof of concept how easy that can be done. Chosen ingredients: Backtrack | Touchatag starter package Tested on: BackTrack 4 R2, BackTrack 5 Final, (32bit)

Dependencies

 root@bt:~# apt-get install flex libpcsclite-dev libusb-dev checkinstall

0x01 - Hardware

Touchatag - ACR122U

Touchatag is ACS ACR122(U) NFC Reader USB RFID reader. The USB reader works at 13.56MHz (High Frequency RFID) and has a readout distance of about 4 cm (1 inch) when used with the Touchatag RFID tags. This product is made by Advanced Card Systems Limited and seems to be available in different layouts but hardware doesn't differ so much. They are all using a PN532 NFC Controller chip and a ST7 microcontroler unit.

0x02 - Software

ACR122U driver

root@bt:~# wget http://www.acs.com.hk/drivers/eng/ACR122U_driver_Lnx_Mac10.5_10.6_1.02_P.zip
root@bt:~# unzip -d acr122u ACR122U_driver_Lnx_Mac10.5_10.6_1.02_P.zip
root@bt:~# cd acr122u
root@bt:~# tar -jxvf acsccid-1.0.2.tar.bz2
root@bt:~# cd acsccid-1.0.2
root@bt:~# ./configure
root@bt:~# make
root@bt:~# checkinstall -D -y --install

Open Source Near Field Communication (NFC) Library /LIBNFC/

Libnfc is the first free NFC SDK and Programmers API released under the GNU Lesser General Public License.

root@bt:~# apt-get install -y debhelper libtool && wget http://libnfc.googlecode.com/files/libnfc-1.4.2.tar.gz
root@bt:~# tar xfvz libnfc-1.4.2.tar.gz &&cd libnfc-1.4.2
root@bt:~# svn checkout http://libnfc.googlecode.com/svn/tags/libnfc-1.4.2/debian
root@bt:~# dpkg-buildpackage -rfakeroot
root@bt:~# dpkg -i ../libnfc*.deb

Check your reader / target with nfc-list.

root@bt:~# nfc-list
nfc-list use libnfc 1.4.2 (r891)
Connected to NFC device: ACS ACR122U 00 00 / ACR122U103 - PN532 v1.6 (0x07)
1 ISO14443A passive target(s) was found:ATQA(SENS_RES):00 02 UID (NFCID1): xx xx xx xxSAK (SEL_RES): 18

If your reader is rejected because of the firmware (log message: „Firmware (x.y) is bogus!“) just disable version checking. All you need to do is change ifdDriverOptions (line 55 in Info.plist) to skip version checking like this:

root@bt:~# nano /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
ifdDriverOptions
0×0005

Afterwards, restart the pcscd daemon and your Touchatag reader should be recognized and ready.

MFOC -Mifare Classic Offline Cracker

Mifare Classic Offline Cracker is a tool that can recover keys from Mifare Classic cards. Thanks to Norbert Szetei and Pavol Luptak for their attack's implementation. MFOC is utility to compute (crack) all keys (A and B) to all sectors, providing at least one of the keys is already known. Keys file is the file, where mfoc will store cracked keys. Format of that file is compatible with nfc-mfclassic, so you can then use it to dump the card into file, or write a dump onto the card.

root@bt:~# wget http://nfc-tools.googlecode.com/files/mfoc-0.10.2.tar.gz && tar -xvzf mfoc-0.10.2.tar.gz
root@bt:~# cd mfoc-0.10.2
root@bt:~# autoreconf -vis
root@bt:~# ./configure
root@bt:~# make
root@bt:~# checkinstall -D -y --install

0x03 - Dumping & Cooking

psscd coordinates the loading of drivers for card readers. It allows applications to access smart cards and readers without knowing details of the card or reader. It is a resource manager that coordinates communications with smart card readers and smart cards and cryptographic tokens that are connected to the system. I prefer start pcscd in foreground (no daemon) with pcscd -f. Then it's time to start mfoc. Use high number of probes, because default number of probes for a key recovery for one sector is 20. Whole cracking could take from 30 minutes to 30 hours.

You can also use the -k key parameter, to add a key to the list of known keys, which is being tried against your card in the initial phase. The -k option somehow didn't work for me, so I always compile my known keys directly into mfoc.c Search for “Array with default Mifare Classic keys” Not sure about other countries, but in country where I live keys are the same. Once you have keys from all sectors, you should be able to use RFID-Fu against other cards, which is epic fail.

root@bt:~# nfc-mfclassic --help
Usage: nfc-mfclassic r|w a|b <dump.mfd> [<keys.mfd>]
r|w - Perform read from (r) or write to (w) card
a|b - Use A or B keys for action
<dump.mfd>    - MiFare Dump (MFD) used to write (card to MFD) or (MFD to card)
<keys.mfd>    - MiFare Dump (MFD) that contain the keys (optional)
Or: nfc-mfclassic x <dump.mfd> <payload.bin> x  - Extract payload (data blocks) from MFD <dump.mfd>   - MiFare Dump (MFD) that contains wanted payload <payload.bin> - Binary file where payload will be extracted

Keep in mind that card UID will be not affected (not changed) with this process. Buy some blank card or Proxmark III if that is what you want. If you are now thinking about dumping your electronic wallet right after recharge and when credit comes to zero, writing content back, then please don't do it. What can stop you from doing that? Well, probably only your conscience, but if the card gets blocked in 24 hours after first use then don't complain. Yes, there are online checking and billing systems out there for basic cards.

0x04 – ISIC Issue

With ISIC- International Student Identity Card attacker can abuse around ten service not only one. ISIC cards are widely used for entrance, transportation, dining payments and various others services or discounts. According to homepage there are 4.5 million cardholders in 120 countries. Cards should be replaced with more secure types ASAP. It is possible to do much more than that, but sufficient for demonstration let's play a little...

At some universities, there is only one entry security check – ISIC. As you can see this is trivial to bypass. We did many tests with public transportation systems and with university systems. Results are all the same – those systems are easily hackable.

0x06 – Conclusion

Finally, when will people learn their lesson? Cryptographic algorithms should be public so that they can be scrutinized and tested. Secret algorithms aren’t more valuable because they are secret. Anyone needing a highly secure smart card should make sure there's layered security and not just depend on the chip's encryption.

0x07 – What's next?

  • Since i have access to Proxmark III which is universal RFID hacking tool which can be used for 100% accurate cloning (even UID), i may once write second edition about c00king with Mifare Classic and HID Prox...
  • Arming BackTrack with GSM attack suite?

0x08 – Thanks

This cookbook was made with great help from h4f guys, many thanks to Vulcano and Back.

0x09 – References & Links

For further reading about this topic please see following:

  • http://www.cs.virginia.edu/~kn5f/pdf/K.Nohl.PhD Implementable.Privacy.for.RFID.Systems.pdf
  • http://events.ccc.de/congress/2007/Fahrplan/events/2378.en.html
  • http://packetstorm.rlz.cl/papers/wireless/2008-esorics.pdf
  • http://www.nethemba.com/mifare-classic-slides.pdf
  • http://code.google.com/p/nfc-tools/wiki/mfoc

0x0A - About

MI1 is a "full time security enthusiast" with university degree in the field of informatics. Recently focusing his passion to USRP and RFID stuff.

RFID Cooking with Mifare Classic相关推荐

  1. RFID入坑初探——Mifare Classic card破解(一)

    redrain有节操 · 2014/05/25 14:29 0x00 前言 之前一直想要玩无线安全,旺财大牛说门槛低(哪里低啦=.=web狗表示我很笨啊,汪汪),于是乎入手了ACR122u,想从NFC ...

  2. 谈谈 Mifare Classic 破解

    谈谈 Mifare Classic 破解 2008 年的时候,荷兰恩智浦(NXP)公司开发的 RFID 产品 Mifare Classic 就被破解了,黑历史在这里就不在具体说了,想详细了解可以自己 ...

  3. NFC NFC手机 兼容的标签 支持Mifare Classic 手机列表

    NFC标签 传输格式 协议是否开放 常见芯片 定义协议的公司.组织 小米2A 小米3 三星S4是否支持 NFC Forum Type 1 是 Topaz NFC Forum.Broadcom 是 是 ...

  4. MIFARE Classic S50技术详解

    Mifare Classic 简介 MIFARE Classic是恩智浦半导体开发的可用于非接触式智能卡,符合ISO/IEC 14443 A类标准.用于公共交通票证等应用,还可用于各类其他应用有S20 ...

  5. 破解mifare Classic(M1)非接触式射频IC卡--Mifare crack Hack 笔记二

    光说不练假把式,昨天一咬牙一跺脚入手了一块PN532开发板,看了几天的PN532C106 Application Note.User Manual,感觉这个芯片还行.关键是只有这个芯片的开发板比较便宜 ...

  6. Mifare Classic漏洞原理之一

    本期TIP:最默契莫过于我们存在于同一个时钟周期. 以下技术细节内容完全来源于文章Dismantling MIFARE Classic,原文链接:http://www.cs.ru.nl/~flavio ...

  7. 物理渗透-Mifare Classic S50(IC)卡分析

    前言 我们不管是在小区里还是公司里,都可能会使用过门禁卡,比如乘坐电梯需要刷工牌才使用,而且只能去特定的楼层.生活中还有很多地方用到过IC卡,商铺的会员卡.交通的公交卡等等.关于IC.ID卡的基础.本 ...

  8. 破解mifare Classic(M1)非接触式射频IC卡--Mifare crack Hack 笔记一

    最近对NFC有点感兴趣,找资料时发现mifare Classic的卡已经被破解了(包括s50.s70),从网上下了Mifare crack Hack开始啃,一个LFSR(线性反馈位移寄存器)就把我弄晕 ...

  9. mifare classic 2.2.3中文_Adobe Lightroom Classic CC 2019 v8.4.1 中文完整直装版

    Adobe Lightroom Classic CC 是 Adobe 公司开发的一款图片后期处理软件,也是史上首个专为专业摄影师和摄影爱好者提供了全套照片服务的应用程序.很适合摄影师拍摄照片的后期制作 ...

最新文章

  1. 数据库系统概论:第八章 数据库编程
  2. 0.0 目录-深度学习第四课《卷积神经网络》-Stanford吴恩达教授
  3. ML之Xgboost:利用Xgboost模型对数据集(比马印第安人糖尿病)进行二分类预测(5年内是否患糖尿病)
  4. 在项目里交叉使用Swift和OC
  5. 实时平台在趣头条的建设实践
  6. 元器件大一点好,还是小一点好?
  7. Spring Boot细节挖掘(Redis的集成)
  8. 高并发大流量专题---3、前端优化(减少HTTP请求次数)
  9. Scrapy框架实现持久化存储
  10. python input函数详解_对Python3中的input函数详解
  11. 如何用adb链接手机,并异常情况下的处理(转)
  12. LeetCode 33——搜索旋转排序数组
  13. 论文写作总结(软件工程专业相关)
  14. 安卓自动化实战项目(AutoJs)-抖音自动取关脚本
  15. Golang中使用Qt库(therecipe/qt)+QtDesigner + Goland (二) UI继承
  16. 开源python语音助手_python实现语音助手小思同学
  17. android加法计算器代码,Android实现简单加法计算器
  18. Unity笔记-29-ARPG游戏项目-01-第三人称相机
  19. 9. 成功解决:Driver class ‘org.gjt.mm.mysql.Driver‘ could not be found
  20. 关于ORA-12505, TNS:listener does not currently know of SID given in connect descript的一个解决思路

热门文章

  1. 关于ASP.NET给产品分类,分页,详情页生成静态页面
  2. (十二)通过Opencv blobFromImage实现数据标准化
  3. Linux C编程之流操作fopen函数的mode
  4. flash相册制作软件模板_儿童照片相册模板 怎么制作炫酷视频相册
  5. php5 mysql 源_thinkphp6:访问多个mysql数据源(thinkphp6.0.5 / php 7.4.9)
  6. vue实现5秒后自动隐藏_王者荣耀:玩家选中单妲己被5楼疯狂嘲讽,发出战绩后,秒变舔狗...
  7. docker pull 私有_Docker系列教程03Docker私有仓库搭建(registry)
  8. NEAT(NeuroEvolution of Augmenting Topologies)算法详解与实践(基于NEAT-Python)
  9. csv解析java_Java CSV解析器
  10. struts2登录注册示例_Struts 2控制标签示例教程