Secure application programming in the presence of side channel attacks. Marc Witteman & Harko Robroch Riscure 04/09/08 Session Code: RR-203



Similar documents
Side Channel Analysis and Embedded Systems Impact and Countermeasures

Side Channels: Hardware or Software threat?

SENSE Security overview 2014

CryptoFirewall Technology Introduction

Horst Görtz Institute for IT-Security

Hardware Trojans Detection Methods Julien FRANCQ

Introduction Page 4. Inspector SCA Page 6. Inspector FI Page 10. Service & Product support Page 13. Inspector Hardware Matrix Page 14

Sleuth: Automated Verification of Software Power Analysis Countermeasures

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

Advances in Smartcard Security

Adversary Modelling 1

How To Manage Security On A Networked Computer System

πωχ Notes on Domino Black Hat Las Vegas 2003 Aldora Louw PricewaterhouseCoopers

CMSC 421, Operating Systems. Fall Security. URL: Dr. Kalpakis

Practical Online Filesystem Checking and Repair

Security testing of hardware product

PUF Physical Unclonable Functions

Cyber Attacks: An Emerging Threat to Satellites

Where every interaction matters.

Threat Modeling. Frank Piessens ) KATHOLIEKE UNIVERSITEIT LEUVEN

CSE331: Introduction to Networks and Security. Lecture 32 Fall 2004

ICTN Enterprise Database Security Issues and Solutions

Security Controls for the Autodesk 360 Managed Services

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 6

Application Intrusion Detection

Chapter 11 Security+ Guide to Network Security Fundamentals, Third Edition Basic Cryptography

CHASE Survey on 6 Most Important Topics in Hardware Security

Penetration Testing Windows Vista TM BitLocker TM

Introduction to Information Security

Data Security Incident Response Plan. [Insert Organization Name]

Malicious Code on Java Card Smartcards: Attacks and Countermeasures

Computer Systems Structure Main Memory Organization

CrashPlan Security SECURITY CONTEXT TECHNOLOGY

User s Guide. Security Operations Ver. 1.02

90% of data breaches are caused by software vulnerabilities.

CHAPTER 7: The CPU and Memory

CIS 551 / TCOM 401 Computer and Network Security. Spring 2006 Lecture 7

Secure Network Communications FIPS Non Proprietary Security Policy

INTRUSION PROTECTION AGAINST SQL INJECTION ATTACKS USING REVERSE PROXY

Software License Management using the Polymorphic Encryption Algorithm White Paper

Criteria for web application security check. Version

Secure Hardware PV018 Masaryk University Faculty of Informatics

The Trivial Cisco IP Phones Compromise

Test vehicle tool to assess candidate ITSEF s competency

Mobile Security Framework; Advances in Mobile Governance in Korea. TaeKyung Kim

Pervasive Computing und. Informationssicherheit

Chapter 15 Operating System Security

More effective protection for your access control system with end-to-end security

The Misuse of RC4 in Microsoft Word and Excel

CIS 551 / TCOM 401 Computer and Network Security

CMPT 471 Networking II

Monitoring Conditional Access Systems

MovieLabs Specification for Enhanced Content Protection Version 1.0

AMI security considerations

A Secure Software Implementation of Nonlinear Advanced Encryption Standard

- Table of Contents -

Information Security Basic Concepts

Oracle Solaris Security: Mitigate Risk by Isolating Users, Applications, and Data

Chapter 12 Network Administration and Support

Security in ST : From Company to Products

MXMedia CipherStream. Preliminary Assessment. Copyright 2012 Farncombe 1.0. Author: T F

Java Card Applet Firewall Exploration and Exploitation

Wireless security (WEP) b Overview

Acano solution. Security Considerations. August E

Broadcasting encryption or systematic #FAIL? Phil

Security+ Guide to Network Security Fundamentals, Third Edition. Chapter 7 Access Control Fundamentals

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Plain English Guide To Common Criteria Requirements In The. Field Device Protection Profile Version 0.75

Patterns for Secure Boot and Secure Storage in Computer Systems

REGULATIONS FOR THE SECURITY OF INTERNET BANKING

elearning for Secure Application Development

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT,

EPASSPORT WITH BASIC ACCESS CONTROL AND ACTIVE AUTHENTICATION

VASCO Data Security International, Inc. DIGIPASS GO-7. FIPS Non-Proprietary Cryptographic Module Security Policy

What is Web Security? Motivation

Section 12 MUST BE COMPLETED BY: 4/22

Storing Encrypted Plain Text Files Using Google Android

CS52600: Information Security

Wireless LAN Security Mechanisms

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

Healthcare Security Vulnerabilities. Adam Goslin Chief Operations Officer High Bit Security

Exploiting Transparent User Identification Systems

Yaffs NAND Flash Failure Mitigation

ADVANCED IC REVERSE ENGINEERING TECHNIQUES: IN DEPTH ANALYSIS OF A MODERN SMART CARD. Olivier THOMAS Blackhat USA 2015

Software based Finite State Machine (FSM) with general purpose processors

Rfid Authentication Protocol for security and privacy Maintenance in Cloud Based Employee Management System

SHORT MESSAGE SERVICE SECURITY

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

picojava TM : A Hardware Implementation of the Java Virtual Machine

Dr. Alexander Walsch IN 2244 Part V WS 2013/14 Technische Universität München

UNCLASSIFIED Version 1.0 May 2012

SECURITY PRACTICES FOR ADVANCED METERING INFRASTRUCTURE Elif Üstündağ Soykan, Seda Demirağ Ersöz , ICSG 2014

Information Technology Security Evaluation Criteria. ITSEC Joint Interpretation Library (ITSEC JIL)

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

Secure Web Development Teaching Modules 1. Security Testing. 1.1 Security Practices for Software Verification


FIPS Non-Proprietary Security Policy. IBM Internet Security Systems SiteProtector Cryptographic Module (Version 1.0)

Introduction. What is an Operating System?

Confinement Problem. The confinement problem Isolating entities. Example Problem. Server balances bank accounts for clients Server security issues:

SSH Secure Shell. What is SSH?

Transcription:

Secure application programming in the presence of side channel attacks Marc Witteman & Harko Robroch Riscure 04/09/08 Session Code: RR-203

Attacks in the field Survey 2007*, Hong Kong: Asia-Pacific Pay-TV piracy losses top US$1.5 billion for 2007 Unlooper: $100 Fault injection attack * Source: Cable & Satellite Broadcasting Association Asia & Standard Bank 2

Side channel attack on a standard 3-DES implementation (gnu-crypto) 1 0 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0x45 0x08 0xEF 0x23 Time-power analysis Note: Generated with our Side Channel Test Platform Inspector 3

Outline Introduction What are side channel attacks? How to assess the risk? Secure programming patterns Conclusion 4

Objectives of this presentation Familiarize you with side channel threats Provide guidance for side channel protection at application level 5

Problem definition Are you making a Set-top box? Cell phone? Printer? Gaming console? And focusing on logical security? You leave the device vulnerable to side channel attacks 6

Change your protection strategy Common paradigm Do not trust input Preserve confidentiality and integrity in output Local: at input / output But we also need to Beware of leakage Protect run-time integrity Pervasive: throughout code Code 7

Outline Introduction What are side channel attacks? Side channel analysis Fault injection How to assess the risk? Secure programming patterns Conclusion 8

Side channel attacks Leakage - Side channel analysis 1. Timing 2. Power consumption 3. Electro-magnetic emission Fault - Side channel injection of faults 1. Power glitches 2. Optical pulses 9

Impact on your device Leakage 1. Key retrieval 2. Password / PIN retrieval Fault injection 1. Change a program decision E.g. unauthorized firmware update 2. Key retrieval E.g. trigger computational fault 10

Side channel analysis PC Probe $100 - $20K Oscilloscope $1K - $20k Amplifier (optional) $1K 10K Analysis and control software Fault injection PC Signal Generator $1K - $20K Glitch device $100 - $50K Analysis and control software Side channel attack equipment 11

Outline Introduction What are side channel attacks? How to assess the risk? Secure programming patterns Conclusion 12

Applicability to your device If side channel threats apply, depends on Physical access? Access time window? Interfacing and control? Exploitation equipment $? First mitigate easier threats! 13

How to identify weaknesses in your code Leakage Where you process a secret Processing access, use, verify Note: also data that depends on a secret Fault Security critical decision point Example: access control, branches (if, switch) Where you manipulate sensitive data Example: state, key-dependent data 14

Outline Introduction What are side channel attacks? How to assess the risk? Secure programming patterns Conclusion 15

Approach Countermeasures at each level of the device Application Operating Hardware System Hardware C r y p t o Here, we focus on the application 16

Patterns Philosophy: find repeatable solutions for common problems that are optimal rather than perfect Design Patterns Book from 1994 Recurring patterns in software design 17

Side channel protection patterns We define 15 related patterns KEY.INTEGRITY CRYPTO KEY.ACCESS DEFAULTFAIL BRANCH FLOW LEAKAGE CRYPTO.USER FAULT CONST.CODING ACCESS CLEARING BRANCH VERIFY DETECT DOUBLECHECK RESPOND 18

Side channel protection patterns KEY.INTEGRITY KEY.ACCESS BRANCH Use of a key value can cause data leakage Only use pointers to keys LEAKAGE CRYPTO.USER ACCESS CLEARING VERIFY 19

Side channel protection patterns KEY.INTEGRITY KEY.ACCESS LEAKAGE ACCESS BRANCH CRYPTO.USER CLEARING Checking Parity checking key integrity can leak is also the tricky key 1) Use Make pointers time-constant to keys + randomize checking order Or don t check the parity VERIFY 20

A standard implementation (Gnu Crypto) public static boolean checkparity ( byte[]key, int offset) { for (int i = 0; i < DES_KEY_LEN; i++) { // for all key bytes byte keybyte = key[i + offset]; int count = 0; while (keybyte!= 0) { // loop till no 1 bits left if ((keybyte & 0x01)!= 0) { count++; // increment for every 1 bit } keybyte >>>= 1; // shift right } if ((count & 1) == 0) { // not odd return false; // parity not adjusted } } return true; // all bytes were odd } 21

Power profile of parity check (Gnu Crypto) 1 0 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 22

Make time-constant (OpenSSL)???????? Why would you now have to randomize the order? 23

Side channel protection patterns KEY.INTEGRITY KEY.ACCESS LEAKAGE ACCESS VERIFY BRANCH CRYPTO.USER CLEARING if and switch statements leak information Avoid confidential branches Confidential decisions must be time-constant and in identical instruction sequence 24

Side channel protection patterns KEY.INTEGRITY KEY.ACCESS LEAKAGE ACCESS VERIFY BRANCH CRYPTO.USER CLEARING Checking Implementing key crypto integrity is is very also tricky 1) Usepointers - don t implement to keys - crypto in an application The O/S and hardware take care of this 25

Side channel protection patterns KEY.INTEGRITY KEY.ACCESS LEAKAGE BRANCH CRYPTO.USER Checking Accessing key an array integrity is prone is also to tricky differential analysis 1) Use pointers dynamic to offset keysto traverse array ACCESS CLEARING VERIFY 26

Side channel protection patterns KEY.INTEGRITY KEY.ACCESS LEAKAGE ACCESS VERIFY BRANCH CRYPTO.USER CLEARING Verification of e.g. password leaks data on the stored value Compare entire data value and use LEAKAGE.ACCESS Better: compare encrypted / hashed value strcmp and memcmp are sequential 27

Side channel protection patterns KEY.INTEGRITY KEY.ACCESS LEAKAGE BRANCH CRYPTO.USER Checking Clearing an key array integrity leaks is also tricky information 1) Use Overwrite pointers with to random keys data, and then clear it ACCESS CLEARING VERIFY 28

Side channel protection patterns Differential fault analysis reveals secret key CRYPTO Verify ciphered data before transmitting it Don t transmit if inconsistent FAULT DEFAULTFAIL FLOW CONST.CODING BRANCH DETECT DOUBLECHECK RESPOND 29

Side channel protection patterns Assuming a parameter has a value eases fault injection CRYPTO Also verify the last possible value when verifying conditions By default, a comparison should lead to a failure FAULT DEFAULTFAIL FLOW CONST.CODING BRANCH DETECT DOUBLECHECK RESPOND 30

Side channel protection patterns Program flow can be manipulated code hi-jacking CRYPTO Use a shadow stack and program counter Verify these after branches FAULT DEFAULTFAIL FLOW CONST.CODING BRANCH DETECT DOUBLECHECK RESPOND 31

Side channel protection patterns Simple data values are easy to manipulate CRYPTO Use non-trivial values Preferably with maximal hamming distance FAULT DEFAULTFAIL FLOW CONST.CODING STATE_INIT = 0 0x3C DETECT RESPOND BRANCH DOUBLECHECK 32

Side channel protection patterns A Boolean is easy to corrupt Use non-trivial values for sensitive decisions CRYPTO FAULT DEFAULTFAIL FLOW CONST.CODING BRANCH DETECT DOUBLECHECK RESPOND 33

Side channel protection patterns Detect if you get hit Keep checksums and verify each time data is used Use integrity-controlled objects CRYPTO FAULT DEFAULTFAIL FLOW CONST.CODING BRANCH DETECT DOUBLECHECK RESPOND 34

Side channel protection patterns A wrong decision can be enforced CRYPTO Verify data used in a decision twice 2 nd check should be complementary to 1 st FAULT DEFAULTFAIL FLOW CONST.CODING BRANCH DETECT DOUBLECHECK RESPOND 35

Side channel protection patterns Immunity is hard; respond after you detect it CRYPTO Log incidents Disable functionality Wipe secrets FAULT DEFAULTFAIL FLOW CONST.CODING BRANCH DETECT DOUBLECHECK RESPOND 36

Outline Introduction What are side channel attacks? How to assess the risk? Secure programming patterns Conclusion Discussion Developer checklist Further research Concluding 37

Discussion Relationship with hardware & O/S protection? Underlying level OK Excellent, apply all patterns Underlying level not OK Prioritize what patterns to apply Application Operating Hardware System Hardware Cr yp to 38

Discussion (cont.) Implementing sufficient protection is a challenge A compiler may undo countermeasures Weakness identification requires experience Protecting sensitive decisions is tedious Incident response may conflict with reliability requirements Trade off between secure programming and maintainability 39

Device developer checklist Does the device need protection? Understand the resistance of the hardware & O/S Identify potential weaknesses in design Apply the patterns Understand your compiler Code it Test the resistance of the device 40

Further research Generic code solutions for patterns Secure comparison of arrays Integrity-controlled objects Shadow stack and program counter Traps Computer-aided inspection & protection Find weaknesses in code Explore flow alternatives and privilege handling Conversion to machine language (compiler) 41

Concluding Be aware that most existing software has little side channel resistance On our experience, these patterns improve the side channel resistance of devices Read more on this in our paper (www.riscure.com) 42

References & resources 1. Design patterns: elements of reusable object-oriented software, ISBN 0-201-63361-2 2. Advances in smart card security, www.riscure.com/1_general/articles/isb0707mw.pdf 3. Differential power analysis, www.cryptography.com/resources/whitepapers/dpa.pdf 4. Power analysis attacks: revealing the secrets of smart cards, ISBN 978-0-387-30857-9 5. OpenSSL, www.openssl.org 6. GNU Crypto, www.gnu.org/software/gnu-crypto/ 7. Smart Card Alliance, http://www.smartcardalliance.org/ 8. Secure application programming in the presence of side channel attacks, www.riscure.com 43

Thank you. More questions? Marc Witteman Chief Technology Officer witteman@riscure.com Harko Robroch Managing Director robroch@riscure.com Riscure B.V. Rotterdamseweg 183c 2629 HD Delft The Netherlands Phone: +31 (0)15 2682664 Http://www.riscure.com Visit Riscure at booth 2838 44