Getting to know your card: Reverse-Engineering the Smart-Card Application Protocol Data Unit for PKCS#11 Functions



Similar documents
Smart Card Application Standard Draft

Attacking and Fixing PKCS#11 Security Tokens

PKCS. PKCS: Public Key Cryptography Standards. Apple, Digital, Lotus, Microsoft, MIT, Northern Telecom, Novell, Sun

The Implementation of Signing e-document by Using the Wireless Identity Module in Cellular Phone

PKCS. PKCS: Public Key Cryptography Standards

CALIFORNIA SOFTWARE LABS

Public Key Infrastructure for a Higher Education Environment

Secure APIs and Simulationbased. Exposé thésard

RVS Seminar Deployment and Performance Analysis of JavaCards in a Heterogenous Environment. Carolin Latze University of Berne

Smart Card APDU Analysis

Deep-Secure Mail Guard Feature Guide

Measurement and Analysis Introduction of ISO7816 (Smart Card)

Java Card. Smartcards. Demos. . p.1/30

Reverse engineering smart cards

JCCM : Flexible Certificates for smartcards with Java Card

ETSI TS V1.2.1 ( )

The SmartLogic Tool: Analysing and Testing Smart Card Protocols

cipher: the algorithm or function used for encryption and decryption

PrivateServer HSM EKM Provider for Microsoft SQL Server

Functional Specification of the OpenPGP application on ISO Smart Card Operating Systems

Information Security

ISM/ISC Middleware Module

Cryptography and Network Security Chapter 1

Introduction on Low level Network tools

Security for Computer Networks

EMV (Chip-and-PIN) Protocol

Report to WIPO SCIT Plenary Trilateral Secure Virtual Private Network Primer. February 3, 1999

Introducing etoken. What is etoken?

PrivyLink Cryptographic Key Server *

Cryptography and Network Security

Microsoft Identity Lifecycle Manager & Gemalto.NET Solutions. Jan 23 rd, 2007

Attestation and Authentication Protocols Using the TPM

Cryptographic Modules, Security Level Enhanced. Endorsed by the Bundesamt für Sicherheit in der Informationstechnik

Secure recharge of disposable RFID tickets

Extending EMV payment smart cards with biometric on-card verification

RF-Enabled Applications and Technology: Comparing and Contrasting RFID and RF-Enabled Smart Cards

Government Smart Card Interoperability Specification

Secure Automated Document Delivery

SafeNet KMIP and Google Cloud Storage Integration Guide

Secure Over the Air (OTA) Management Of Mobile Applications

Table: Security Services (X.800)

YubiKey PIV Deployment Guide

CERTIFICATE REVIEW RECORD

Neutralus Certification Practices Statement

AN2598 Application note

GlobalPlatform. Card Specification. Version 2.2

PkBox Technical Overview. Ver

SSL A discussion of the Secure Socket Layer

White Paper. Digital signatures from the cloud Basics and Applications

Public Key Infrastructure (PKI)

WebService Security. A guide to set up highly secured client-server communications using WS-Security extensions to the SOAP protocol

Web Application Entity Session Management using the eid Card Frank Cornelis 03/03/2010. Fedict All rights reserved

[SMO-SFO-ICO-PE-046-GU-

Smart Card. Smart Card applications

Independent Security. Prepared for:

Key & Data Storage on Mobile Devices

Security (II) ISO : Security Architecture of OSI Reference Model. Outline. Course Outline: Fundamental Topics. EE5723/EE4723 Spring 2012

Strong Authentication Protocol using PIV Card with Mobile Devices

Digital Certificates (Public Key Infrastructure) Reshma Afshar Indiana State University

SEZ SEZ Online Manual Digital Signature Certficate [DSC] V Version 1.2

Securing Card-Not-Present Transactions through EMV Authentication. Matthew Carter and Brienne Douglas December 18, 2015

OWASP Mobile Top Ten 2014 Meet the New Addition

Authentication Applications

Information System Security

Key Management and Distribution

USB Portable Storage Device: Security Problem Definition Summary

/ Preparing to Manage a VMware Environment Page 1

Contactless Smart Cards vs. EPC Gen 2 RFID Tags: Frequently Asked Questions. July, Developed by: Smart Card Alliance Identity Council

WhiteHat Security White Paper. Top 11 PCI DSS 3.0 Changes That Will Affect Your Application Security Program

Cryptography and Network Security Overview & Chapter 1. Network Security. Chapter 0 Reader s s Guide. Standards Organizations.

SBClient SSL. Ehab AbuShmais

Certification Report

Smart Cards and their Operating Systems

Efficient Padding Oracle Attacks on Cryptographic Hardware

Intended status: Informational January 15, 2014 Expires: July 19, 2014

Introduction...3 Terms in this Document...3 Conditions for Secure Operation...3 Requirements...3 Key Generation Requirements...

Systematization of Knowledge Lessons Learned From SSL/TLS Attacks

A Survey on Untransferable Anonymous Credentials

Integration Guide. SafeNet Authentication Service. SAS Using RADIUS Protocol with Microsoft DirectAccess

Adversary Modelling 1

Rapid Security Framework (RSF) Taxonomie, Bewertungsparameter und Marktanalyse zur Auswahl von Fuzzing-Tools

Criteria for web application security check. Version

Overview of Contactless Payment Cards. Peter Fillmore. July 20, 2015

An Overview of Common Adversary Models

HMRC Secure Electronic Transfer (SET)

Security Analysis of PLAID

Database security issues PETRA BILIĆ ALEXANDER SPARBER

Applying Cryptography as a Service to Mobile Applications

Public Key Cryptography in Practice. c Eli Biham - May 3, Public Key Cryptography in Practice (13)

The Ultimate Authentication Technology

EMV (Chip and PIN) Project. EMV card

Whitepaper on identity solutions for mobile devices

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

The basic groups of components are described below. Fig X- 1 shows the relationship between components on a network.

FIPS Non Proprietary Security Policy: IBM Internet Security Systems Proventia GX Series Security

SecureDoc Disk Encryption Cryptographic Engine

CA Certificate Policy. SCHEDULE 1 to the SERVICE PROVIDER AGREEMENT

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

Public-Key Infrastructure

Transcription:

: Reverse-Engineering the Smart-Card Application Protocol Data Unit for PKCS#11 Functions 1, Fiona McNeill 2, Alan Bundy 1, Graham Steel 3 Riccardo Focardi 4, Claudio Bozzato 4 1 University of Edinburgh 2 Heriot-Watt 3 Cryptosense 4 Ca Foscari

Smart-cards secure, trusted, tamper-resistant identification, authentication, data storage and application processing financial, communication, security and data management purposes

Smart-cards secure, trusted, tamper-resistant identification, authentication, data storage and application processing financial, communication, security and data management purposes third-party communication

Smart-cards secure, trusted, tamper-resistant identification, authentication, data storage and application processing financial, communication, security and data management purposes third-party communication black-box

Smart-cards secure, trusted, tamper-resistant identification, authentication, data storage and application processing financial, communication, security and data management purposes third-party communication black-box is your card breaking bad?

Cryptographic protocols RSA PKCS# 11 Cryptographic Token Interface Standard functions key management, signing, encryption, decryption etc. ensure sensitive data remain secure API-Level Attacks E.g., Clulow, J., On the security of PKCS# 11. CHES 2003 Bortolozzo, M., Centenaro, M., Focardi, R., & Steel, G. Attacking and fixing PKCS# 11 security tokens. CCS 2010

Cryptographic protocols RSA PKCS# 11 Cryptographic Token Interface Standard functions key management, signing, encryption, decryption etc. ensure sensitive data remain secure API-Level Attacks E.g., Clulow, J., On the security of PKCS# 11. CHES 2003 Bortolozzo, M., Centenaro, M., Focardi, R., & Steel, G. Attacking and fixing PKCS# 11 security tokens. CCS 2010 PKCS#11 Low-level Implementation has been kept in the dark

Smart-card communication Smart-card Communication How is PKCS#11 implemented at the lowest-level communication? Is it secure? Function call PKCS#11 API low-level communication APDU layer Smart-card

Smart-card communication

The REPROVE system REPROVE reverse-engineering system: no API access - no card access - implementation indepedent communication REPROVE PKCS#11 ISO 7816 APDU semantics On-card operations PKCS#11 function translation generic assumptions

ISO/IEC 7816 Defines the communication layer between the card and the reader:15 Parts Part 4: Organisation, security and commands for interchange Part 8: Commands for security operations Part 9: Commands for card management.

APDU command structure >00 a4 08 0c 04 50154400 01 <08 9000

APDU command structure >00 a4 08 0c 04 50154400 01 Cla: Instruction Class <08 9000

APDU command structure >00 a4 08 0c 04 50154400 01 Cla: Instruction Class Ins: Instruction Code <08 9000

APDU command structure >00 a4 08 0c 04 50154400 01 Cla: Instruction Class Ins: Instruction Code P1-P2: Instruction Parameters <08 9000

APDU command structure >00 a4 08 0c 04 50154400 01 Cla: Instruction Class Ins: Instruction Code P1-P2: Instruction Parameters Lc: Length of sent data D: Sent data <08 9000

APDU command structure >00 a4 08 0c 04 50154400 01 Cla: Instruction Class Ins: Instruction Code P1-P2: Instruction Parameters Lc: Length of sent data D: Sent data Le: Length of expected data <08 9000

APDU command structure >00 a4 08 0c 04 50154400 01 Cla: Instruction Class Ins: Instruction Code P1-P2: Instruction Parameters Lc: Length of sent data D: Sent data Le: Length of expected data <08 9000 D: Response data

APDU command structure >00 a4 08 0c 04 50154400 01 <08 9000 Cla: Instruction Class Ins: Instruction Code P1-P2: Instruction Parameters Lc: Length of sent data D: Sent data Le: Length of expected data D: Response data SW1-SW2: Command processing status

APDU command structure >00 a4 08 0c 04 50154400 01 >80 21 08 0c 04 50154400 01 <08 9000 Cla: Instruction Class Ins: Instruction Code P1-P2: Instruction Parameters Lc: Length of sent data D: Sent data Le: Length of expected data D: Response data SW1-SW2: Command processing status

APDU command structure >00 a4 08 0c 04 50154400 01 Cla: Instruction Class Ins: Instruction Code P1-P2: Instruction Parameters Lc: Length of sent data D: Sent data Le: Length of expected data >80 21 08 0c 04 50154400 01 Analysis Challenge How can we infer the semantics of the proprietary command? e.g., 21 a4? <08 9000 D: Response data SW1-SW2: Command processing status

Methodology ISO 7816 models Command precondition models Command categorization Card operations models Patterns Hierarchy of card operations PKCS#11 functions models: C_login, C_generateKey, C_sign, C_findObjectsInit, C_findObjects, C_getAttributeValue, C_setAttributeValue, C_wrapKey, C_encrypt, C_unwrapKey Inference Problem Given a set of models derive the meaning of the actual implementation.

APDU modelling operation decomposed into steps implemented as APDU layer commands characterised by data exchange and role properties sub-functionality 1 command a command b YY, core NY, core command x YY, core functionality sub-functionality 2 command y NY, additional command z YN, additional sub-functionality 3 command a YY, additional command x NN, dummy

APDU modelling PKCS#11 functions are expressed as sets of functionalities E.g., C_logIn : inputs/outputs specified by PKCS#11 authentication as defined by ISO 7816 with key; with PIN; using internal data; data encipherment additional operations secondary authentication data retrieval

Reverse-engineering main idea Step 1: Semantics of APDU Step 2: On-card operations Step 3: PKCS#11 function valid mappings valid paths sub-functionalities functionalities paths paths PKCS#11 functionalities path

Inferred model 3 abstractions of the protocol 3 levels of attacks

Inferred model 3 abstractions of the protocol 3 levels of attacks Commands semantics of the exchanged commands identify sensitive data, inject commands, blind reply sessions

Inferred model 3 abstractions of the protocol 3 levels of attacks Commands semantics of the exchanged commands identify sensitive data, inject commands, blind reply sessions On-card operations which/how on-card operations are executed perform unauthorised operations

Inferred model 3 abstractions of the protocol 3 levels of attacks Commands semantics of the exchanged commands identify sensitive data, inject commands, blind reply sessions On-card operations which/how on-card operations are executed perform unauthorised operations PKCS#11 interconnection how a specific cryptographic function is executed at the APDU layer PKCS#11 attacks bypass API restrictions

Inferred model: example Sniffed trace: >00a4080c0450154400 >9000 >800a0200ea >Response >00a4080c08501550724b025502 >9000 >80bb01b803840102 >9000 >80aa808602ffff >Response

Inferred model: example

Experiments Sniffed APDUs from 5 commercially available smart-cards; 9 PKCS#11 functions C_logIn C_generateKey C_sign C_encrypt C_findObjects C_getAttributeValue C_setAttributeValue C_wrapKey C_unwrapKey

Experiments evaluation on:

Experiments evaluation on: functional success

Experiments evaluation on: functional success successfully inferred at least 1 model

Experiments evaluation on: functional success successfully inferred at least 1 model quality of the results

Experiments evaluation on: functional success successfully inferred at least 1 model quality of the results apart from 3 cases; a unique model that matched exactly 3 cases: correct on-card operations; 2 suggested models; 1 matched exactly

Experiments evaluation on: functional success successfully inferred at least 1 model quality of the results apart from 3 cases; a unique model that matched exactly 3 cases: correct on-card operations; 2 suggested models; 1 matched exactly search-space restriction

Experiments evaluation on: functional success successfully inferred at least 1 model quality of the results apart from 3 cases; a unique model that matched exactly 3 cases: correct on-card operations; 2 suggested models; 1 matched exactly search-space restriction no explosion

Search-space sample Function Total B.CC R.CC R.SFC R.FC R.Model Card 2 C_logIn 32000 12 4 2 2 C_findObjects 400 3 1 1 1 C_generateKey 540x86 8 512 69 8 1 C_setAttributeValue 86 14 3 1 1 C_encrypt 20 3 4 2 1 Card 4 C_logIn 7396 65 39 21 1 C_findObjects 7396 6 1 1 1 C_getAttributeValue 54700816 3 1 1 1 C_sign 86 1 1 1 1 Card 5 C_logIn 1 1 1 1 1 C_sign 12322 53 7 4 2 C_setAttributeValue 1 1 1 1 1 B.CC: baseline algorithm command combinations. R.CC: REPROVE command combinations. R.SFC: REPROVE sub-functionality combinations, R.FC: REPROVE functionality combinations. R.Model is the final model(s) suggested by REPROVE.

Results: Violations found c_login function No session handles all cards No verification 1 card PIN sent in plaintext 2 cards c_wrapkey function executed library side sensitive key sent in plaintext 1 card

Results: Violations found c_generatekey function executed library side sensitive key sent in plaintext 2 cards c_encrypt function executed library side sensitive key sent in plaintext 1 cards The location of the sensitive data and the related information (eg., attributes) was located for all cards.

Conclusion REPROVE: fully automated system for reverse-engineering APDUs and discovering interconnection with PKCS#11 functions it does not requires access to the card s code nor the API check if the card respects the standard 2 tested cards did nothing! access PKCS#11 objects from the low-level - bypass API restrictions