A Practical Attack on the MIFARE Classic_김성수

Download Report

Transcript A Practical Attack on the MIFARE Classic_김성수

Sung-Soo Kim
[email protected]
2010. 11. 19. Fri
Network Security Laboratory
Graduate School of Soongsil University
2
Network Security Laboratory
Graduate School of Soongsil University
 RFID
(Radio-Frequency Identification)
 라디오 주파수를 이용해 먼 거리에서 정보를 인식하는 기술
 Tag와 Reader가 필요
Server
Reader
Authentication
Secure
Tag
Request,
Response
Insecure
3
Network Security Laboratory
Graduate School of Soongsil University
 Mifare
 네덜란드 Phillips의 NXP 반도체에서 생산
 전세계적으로 약 2억개 사용으로 전체 85%차지
 Mifare



512byte 메모리
보안기능 없음
용도: 1회용 티켓
 Mifare





Classic
메모리 크기에 따라 1K, 4K, Mini로 분류
보안기능 제공
용도: 교통카드, 출입카드 등
 Mifare

Ultralight
DESFire
스마트카드 표준 ISO/IEC 7816 지원
DES 및 3-DES 사용으로 높은 보안기능 제공
용도: 고비도 금융 카드
4
Network Security Laboratory
Graduate School of Soongsil University
 Mifare Classic
 Mifare의 제품중의 하나, ISO 14443 A 표준
 인증으로 시작하여 이후 모든 통신은 암호화
 무결성 체크를 위해 각 8비트마다 패리티 비트가 계산됨
5
Network Security Laboratory
Graduate School of Soongsil University
 Logical Structure
6
Network Security Laboratory
Graduate School of Soongsil University
 Block Contents
Never Readable
Key A (6 bytes)
Address byte stored four times
Undefined byte,
Can be used for storage
AC (3 bytes)
Defines Access Conditions for every
data block and the sector trailer
U
Key B (6 bytes)
Might be readable
depending on AC
(a) Sector Trailer
VALUE
VALUE
VALUE
A A A A
The 4-byte signed value
is stored three times
(b) Value Block
7
Network Security Laboratory
Graduate School of Soongsil University
 Hardware
(1/2)
 Reverse-Engineering a Cryptographic RFID Tag
 하드웨어
역공학을 이용한 게이트 분석
8
Network Security Laboratory
Graduate School of Soongsil University
 Hardware
(2/2)
 Crypto-1 Algorithm
 역공학을
이용해 Mifare Classic의 Crypto-1 알고리즘 복원
9
Network Security Laboratory
Graduate School of Soongsil University
 Mifare Classic Analysis Tools
 Proxmark III
 카드와
리더간의 통신을 도청할 수 있는 하드웨어
 리더를 완벽하게 제어하고 리더로 가장 하는 것 또한 가능
 안테나로부터 온 신호는 Field Programmable Gate Array(FPGA)를 통
해 보냄
 FPGA는 신호를 마이크로 제어기에 전달하고 작업 전달 전에 필터링으
로 사용
10
Network Security Laboratory
Graduate School of Soongsil University
 Security Features
 스트림 암호 방식
 Crypto-1에 의해 스트림키 생성
 인증과정에 사용되는 48bit 키는 각각의 섹터 트레일러에 저장
 리더와 태그간의 대칭키 방식
 Authentication Protocol
 ISO 9798-2을 기반으로 상호 3 패스 프로토콜을 사용
 리더는 태그에게 인증요구를 보내고 태그는 32-bit nonce로 응답
 리더는 8-byte 응답 메시지를 보냄
 태그는 그에 대한 4-byte 응답을 보냄
11
Network Security Laboratory
Graduate School of Soongsil University
 Authentication Protocol Characteristics
12
Network Security Laboratory
Graduate School of Soongsil University
 Weakness in Mifare Classic
 카드의 비표(nonce)를 생성하는 Random Number Generation
(RNG)에 취약점이 존재
 시간당 600,000개의 비표를 요구함
 비표는 9.44μs마다 한 비트씩 이동하는 Linear Feedback Shift
Register(LFSR)에 의해 생성
 한 시간 안에 적어도 4번 같은 nonce값이 나타남
13
Network Security Laboratory
Graduate School of Soongsil University
 Keystream Recovery
 사전에 리더와 태그 사이의 통신을 기록하여 사용했던 키스트림을
찾는 방법을 사용
 키스트림은 리더의 응답과 비표의 조합에 의해 결정됨
 RNG의 취약점을 이용
 RNG의
취약점 때문에 이전 통신에서 기록한 것을 재전송 가능
 평문은 단지 키스트림과 XOR 비트연산만 수행
14
Network Security Laboratory
Graduate School of Soongsil University
 Method
 리더와 카드 사이의 통신을 도청
 통신내용을 기록하여 카드가 같은 키스트림을 사용하는지 확인
 카드는 적절한 시간에 같은 비표를 반복하기 때문에 가능
 제어하고 있는 리더로 평문을 변경하여 응답을 받음
 평문에 대해 응답하는 키스트림 부분을 계산
 처음의 기록한 부분을 암호화 하기 위해 이 키스트림을 이용
 명령을 바꾸면서 더 많은 키스트림 bits를 찾음
15
Network Security Laboratory
Graduate School of Soongsil University
 Authentication Replay
 카드와 리더 사이의 성공적인 인증을 기록
 이전의 기록에서 얻은 같은 nonce값을 얻을 때 까지 인증 요구
 이전에 기록된 응답 보냄
 카드의 응답값을 되돌려 받음
 이 과정이 끝나면 동일한 명령 또는 변경된 명령을 재시도 가능
16
Network Security Laboratory
Graduate School of Soongsil University
 LFSR Rollback
 nT를 가지고 aR과 aT를 알아냄
 aR과 aT로 Ks2, Ks3 알아냄
 리더의 값인 nR을 임의로 생성해서 Ks1을 알아냄
 Seed key를 알아냄 (key A, key B)
nR
nT
UID
Network Security Laboratory
17
Graduate School of Soongsil University
 결론
 이전에 리더와 카드사이의 통신에서 Keystream을 찾는데 성공
 명령 byte와 Keystream을 안다면 어떤 작업이라도 수행 가능
 카드에 있는 모든 데이터들은 더 이상 비밀이 될 수 없음
 개인정보는 프라이버시 침해로 이어짐
 카드에 저장된 데이터간의 무결성과 인증 또한 더 이상 신뢰성 없음
18
Network Security Laboratory
Graduate School of Soongsil University
 권고사항
 어떤 섹터라도 처음 6byte에는 민감한 정보를 넣지 않음
 하나의 통신에서 다수의 섹터들을 인증하여야 함
 데이터 블록의 승인되지 않은 변조를 막기 위해 새로운 인증이 필요
 Mifare Classic과 같은 폐쇄적 설계보단 더 진보된 개방적 설계의 카
드가 필요
19
Network Security Laboratory
Graduate School of Soongsil University