SEC2 FinalSlides
SEC2 FinalSlides
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 1
Class Objectives
Abstract
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 2
Agenda of this class
• Use-Case example
• Networks
• Specifically, an Access Control network
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 3
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 4
Embedded vs Cyber
a matter of where implemented and what it’s protecting against
Layered Cybersecurity
implemented in software Embedded Security implemented
in firmware/hardware
Rootkits, viruses, worms, & trojans
Unlicensed Programs
Targeted attacks
Embedded Security is a secure boundary made up of
Firmware updates
Hardware & Embedded Firmware.
Identified threats of any type
It is a robust level of persistent security which is
Remnants or threats mostly stopped active for the entire life of the hardware, no matter the
software configuration(s).
Mutating Viruses
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 5
The goal is platform resiliency
These 5 functions work in concert to provide effective high-level risk management
• Identify
• Designers define and prioritize security efforts
against anticipated threats
Embedded • Each element needs a unique identity
Security
• Protect
• Limit the ability of an adversary to cause a security
event
Advised
• Detect & Report
Cyber • Identify the occurrence of a security event
Security
• Respond
• Take action once a security event is detected
• Recover
• Restore capabilities and services that may have
been impaired
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 6
Weaknesses we commonly encounter
Lack of security by design:
Security is too often an afterthought
Lack of education:
Security principles are not well understood and consequently incorrectly implemented
Mishandling of keys:
Keys are not securely contained and often left in vulnerable system memories
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 7
The Security Thought Process
Risk assessment and strategies for addressing those risks
• It begins with a risk assessment and strategies for addressing those risks
• Get your “ducks in a row” from the very start
• Learn the mindset and foundations of designing secure hardware
• Know what needs protection, why it needs protection, and who the adversaries are
• By understanding your adversaries, you’ll know what they are capable of doing and what
they will most likely do
• We highly recommend our lecture dedicated to understanding the risks and potential solutions:
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 8
Why do Adversaries Attack?
• Gain access to your valuable data and/or infrastructure
• Identity, bank accounts, competitive data, cloning, etc…
• Opportunists
• Clever people who defeat minor defenses to gain something for themselves
• Limited knowledge – Often use “canned” hacks from the internet
• The internet instructions for hacking early versions of Amazon’s Fire TV Stick is a great example
• Rarely innovative - If we leave the door unlocked, they think they have every right to go inside
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 10
What can we do about them?
• Opportunists
• Implementing just the vital foundations of security will keep them out
• Removing the opportunity = removing the opportunists
• Defense against these nearly unstoppable “killer whales” is not a subject of this presentation
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 11
A multilayered methodology:
“Defense in Depth”
You may hear this referred to as the “Castle Approach”, which was the old term for it
• Defense in depth minimizes the probability that the efforts of malicious hackers will succeed
• Defense in depth is the coordinated use of multiple layers of security
• Like the layers of an onion, it extends from the hardware based foundation of a device and exists throughout the
entire ecosystem
This also includes…
• …why certain data is collected
• …how the data is stored
• …and behavior of users
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 12
The way to think about Security
• Modern computing system architectures can also be thought of in layers
• The top layers are software
• composed of the operating system and applications
• Various security schemes, which are also structured in layers, need to be implemented
• Physical security – Its name implies its function
• Embedded security – Hardware enforced persistent security for keys and critical primitives
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 13
Cybersecurity –
Use Secure Coding Practices!
• Great place to start: Open Web Application Security Project (OWASP)
• The OWASP Secure Coding Practices Quick Reference Guide
• https://www.owasp.org/images/0/08/OWASP_SCP_Quick_Reference_Guide_v2.pdf
• Everything you
need to start:
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 14
Embedded Security
Key/Secret Management Lifecycle
• “Key management” describes the operations needed to create, maintain, protect, and control
the use of keys.
• Keys have a life cycle; they’re “born,” live useful lives, and are retired
• Each phase of life may require different protections
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 15
Best Security Practices for Handling
Keys & Secrets
Isolate keys & secrets from users
Humans are the most unpredictable security risk
Keep critical crypto-primitives where the keys & secrets are: isolated
If algorithms dealing with keys can be hacked, adversaries can bypass the keys
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 16
Select Truly Secure Devices
Two “Must-Have” properties
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 17
When to use Symmetric or
Asymmetric Cryptography
The most important question is:
• Does your system need to interoperate with any other vendor’s equipment?
• If your ecosystem will only contain devices you create, Symmetric is a great solution
• The security of a symmetric system relies on how well the key is protected
• If Alice shares her key with Bob, she cannot be assured Bob is protecting the key adequately
• If Alice is creating an enclosed system with no interoperability, there is no Bob
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 18
When to use Encryption
Encryption is optional – Ask yourself “Is the payload valuable?”
• If we can be assured a message has both authenticity and integrity that’s enough
for more than half of all security use-cases
• We use confidentiality (encryption) only if the message itself has value
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 19
Where to use encryption - when needed
Encryption is needed only when the data is valuable in some way
Potential Places
Layers for Encryption
Application
• When needed, it should be implemented it everywhere
Application possible
TLS
• Whatever level you encrypt only protects that layer and lower
Transport
• Most attacks are on the application layer, including most
malware and advanced persistent threat (APT) attacks
Network / IP IPsec (VPN) • Security in the application layer is, by far, the most effective to these
serious threats. TLS, VPN, and lower level encryptions connect defend
data in the application layer
Network
• Ironically, these lower layer encryptions are the most used
Link Encryption
Access
forms today, meaning few are protecting themselves against
the most serious threats they face
Full Disk
Encryption (FDE)
Mass Storage
Transparent Data
Encryption (TDE)
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 20
Back to defense in depth:
The Three “Vital 3”
• The application of security schemes are layered
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 21
Defense in depth: The Three “Vital 3”
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 22
Uses for Random #s in Cryptography
High-Entropy Random Number Generator
• Keys and Challenges
• Random number generation is used to create unguessable symmetric keys
• Random numbers are used to derive new unique keys from symmetric keys
• They are also used as the foundation for the private key in PKI
• The public key is calculated from the private key
• During authentication, random numbers are used as challenges to prove identity
• Initialization vectors and Nonce (numbers used once) for communications are typically
random numbers
• A good example of this would be the cipher mode AES-CBC, where both a session key and IV
are needed.
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 23
High-Entropy
Random Number Generator (RNG)
• Needed for the Generation of Unique and/or Random Numbers
• Uses a high entropy noise source feeding a deterministic RNG and a “whitening” function.
• Depends on unpredictable quantum variations in the operation of very small devices.
• Must pass the “Next Bit Test”
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 24
We should mention
Physically Unclonable Functions (PUFs)
PUF is a mechanism to generate a stable unique number used for identity
• PUF is based on process variations
Each of these die will receive near identical process treatment
How much variation do we actually have? …2128? …2127? Or is it more like 264 or
less (insecure)?
Nobody knows – This is not a quantified value for semiconductor processing
This is one reason NIST refuses certification for PUF based identity
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 25
More on PUFs
There are usually 2 reasons given to consider PUF
• “No need to inject”? - a private key has no value by itself and is only useful with a certificate endorsing the
corresponding public key. This requires an injected certificate and its signature to be strictly immutable.
• “No need for an RNG”? - if you need to authenticate anything, how is that done without an RNG?
• If only used as a serial number, indeed – nothing needs to be injected,
But there are FAR cheaper ways of providing unique serial numbers
PUF requires dedicated silicon real estate AND requires a license fee
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 26
Hardware-Enforced Persistent-Secure
Protected Environment
Hardware-Enforced Persistent-Secure Protected Environment
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 27
An Immutable Portion of
Application Code
• Another “must have” feature to achieve security
• There needs to be a area of code which can be relied upon to be guaranteed genuine
• This area needs to be unchangeable, but not necessarily ROM
• This immutable, guaranteed genuine, area of code will call the cryptographic functions
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 28
Defense in depth: The Three “Vital 3”
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 29
Secure Boot
Secure Boot is one form of Attestation
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 30
Asymmetric Secure Boot Sequence
Using Signature verification for code authentication
Boot Loader
KPUB • Public keys are not
AI
Digest secret, but the OEM
public key needs to
Verify be secured and
The AI Digest and the therefore trusted.
AI Signature (signed • If an adversary were
by OEM private key) able to plant their
are sent into the public key here, they
secure area would have hijacked
An immutable boot loader must drive this your device
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 31
Secure Image Updates
Secure updates are another form of attestation
• Secure update assures only genuine images are accepted by the device
• The code is from the OEM or an OEM-approved source… and no other
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 32
Asymmetric Secure DFU Sequence
Using Signature verification for newly received code authentication
Installed System
New
Firmware
Application
Code
Image (AI) Persistent-secure
area
AI Signature
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 33
More on Secure Boot and Secure
Image Updates
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 34
Authenticated and Unique Messaging
• Authentication and Integrity must be established between communicators
• Entities should authenticate upon initial contact with other entities
• All messaging and data transfers should be authenticated
• Here’s an easy 2-step solution requiring very little memory and no synchronization
1. Ask the other side for a nonce before compiling a message payload
2. This ephemeral number will be used by both sides in the authentication of the message
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 35
Symmetric Message Uniqueness
Bob wants authentication of a message from Alice
Alice & Bob know and trust each other and share a secret key
Alice Bob
CheckMAC
MAC Alice now has information
she can use to make her
message unique
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 36
Symmetric Message Uniqueness
Bob wants authentication of a message from Alice
Alice & Bob know and trust each other and share a secret key
Alice Bob
Alice generates a message
and random# Bob stores the
message
Random #
MAC Function Bob sent MAC Function
Shared Key Shared Key Message
Uniqueness
is achieved
CheckMAC
No long-term
memory required
MAC
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 37
Encrypt or not, we still need to
authenticate
Let’s talk about proper hashing. Admittedly, this is an oversimplification
State21 State0
Initialization
• Hash is a “Compression Function”
• A one-way function that transforms two fixed-length inputs
into one output of the same fixed-length
Compression
Function
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 38
“Length Extension Attack” on simple
MACs
More oversimplification. Msg length, padding, etc… all need to be considered.
BWAH HA StateHA
4 StateHA!!!
Digest
Initialization 0
Compression
Compression
Function
Function
State3 State5
Digest New “Authentic” Digest
Message23
Simple MAC Function Same MAC Function
Message0 = “The money transfer was received.” Message0 = “The money transfer was received.”
Message1 = “Many thanks for your effort!” Message1 = “Many thanks for your effort!”
Message2 = “Please send the same amount again.”
Message3 = “This time to Joe Schmoe in Idaho.”
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 39
HMAC and CMAC are not susceptible to
Length Extension Attacks
• HMAC – Hash-based Message Authentication Code
• Lots of confusion – “Isn’t a simple MAC also hash-based?” Yes, but…
• Uses two passes of hash computation
• The secret key is first used to derive two keys – inner and outer
• The first pass of the algorithm produces an internal hash derived from the message and the
inner key
• The second pass produces the final HMAC code derived from the inner hash result and the
outer key
• The algorithm thwarts Length Extension Attacks
Alice Bob
Sign
Bob Bob’s
KPRIV Private Key
Verify
Digital Alice now has information
Bob Bob’s Signature she can use to make her
KPUB Public Key
message unique
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 41
Asymmetric Message Uniqueness
Alice wants to send a message to Bob
Alice & Bob know and trust each other and have their own public/private key pairs
Alice Bob
Bob stores the
message
Random #
HASH HASH
Bob sent
Digital Alice’s
Alice’s Sign Verify
Signature Public Key
Private Key Alice
KPRIV Alice
KPUB
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 42
Defense in depth: The Three “Vital 3”
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 43
Identification ≠ Authentication ≠ Authorization
Three required elements of any secure connection are often confused with each other
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 44
Review of the Three “Vital 3”
• The “Vital 3” of Hardware Requirements
• High-Entropy Random Number Generator
• Hardware-Enforced Persistent-Secure Protected Environment
• An Immutable Portion of Application Code
• The “Vital 3” of Cryptographic Functions
• Secure Boot
• Secure Image Updates
• Authenticated and Unique Messaging
• The “Vital 3” of Connection Requirements
• Identification
• Authentication
• Authorization
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 45
Address other common vulnerabilities
This is more for advanced systems
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 46
Use-Case Example
Symmetric Cryptography
Captive Network – One OEM, no interoperability
P2P Star
Mesh Radio
MCU/MPU
Sensors
and/or
Secure Enclave or
Relays Element
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 47
This is a generic network
But, for a moment, let’s think of it as an access control network to a building
• Ecosystem considerations for the access control use case
• Who will have access? Why do they need access? Where will they have access?
• During what times will they have access? Who can grant access? Etc…
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 48
Thinking security from the beginning
Applying the three “Vital 3” to every design from the start
• The “Vital 3” of Hardware Requirements
✓ High-Entropy Random Number Generator
✓ Hardware-Enforced Persistent-Secure Protected Environment
✓ An Immutable Portion of Application Code
• The Parent key is only used for system setup and never used directly
• Each device will have a unique key derived from the Parent key
• Very few devices will actually contain the parent key
• Let’s see how we can construct a robust ecosystem with animated graphics
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 50
How we Provision in the Factory
How nodes and Network coordinators are prepared in the factory
Parent Key
From HQ
Hardware
Security
Module
Node
Secure area
Manufacturing
Line HASH Unique SN#
Parent
Key
Unique
Derived Device Key
Secure area
Network Coordinator
Parent
or
Key
Installation Tool
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 51
The Auth Process during installation
The Network Coordinator wants assurance the Node is genuine
Network Coordinator Node
Random
HASH RNG HASH
Challenge
Digest
Digest
Calculate genuine
=?
response and
compare
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 52
Sharing a unique key during installation
Assures each installed network has a unique key so one compromised network will not compromise others
This is performed with each node until the entire network has the key
Session Key
New Unique Network Key New Unique Network Key
Cipher Cipher
Cipher Text
(Encrypt) (Decrypt)
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 54
The network key must remain secure
The common network key is never used directly
Session keys are generated from random seeds from the Network Coordinator
Cipher Cipher
Plain Text Cipher Text Plain Text
(Encrypt) (Decrypt)
• If the network needed to support more than one vendor’s equipment, PKI
certificates are used to allow interoperability with other vendor’s equipment
• Easy to do… just share the authority public keys for all participating vendors
• Allows multiple chains of trust to be supported
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 56
How to distribute a common network key with PKI
This is performed with each node until the entire network has the key
Network Coordinator Node
Private Key Public Key Public Key Private Key
Session Key
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 57
OEM Specific Intermediate Certificate Authorities
CA = Certificate Authority
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 58
Did we meet our objectives?
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 59
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 60
Legal Notice
SOFTWARE:
You may use Microchip software exclusively with Microchip products. Further, use of Microchip software is subject to the copyright notices, disclaimers, and any license terms
accompanying such software, whether set forth at the install of each program or posted in a header or text file.
Notwithstanding the above, certain components of software offered by Microchip and 3rd parties may be covered by “open source” software licenses – which include licenses that require that
the distributor make the software available in source code format. To the extent required by such open source software licenses, the terms of such license will govern.
MICROCHIP DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING ANY IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND
FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY DIRECT OR INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL, OR CONSEQUENTIAL LOSS,
DAMAGE, COST, OR EXPENSE OF ANY KIND RELATED TO THESE MATERIALS OR ACCOMPANYING INFORMATION PROVIDED TO YOU BY MICROCHIP OR OTHER THIRD PARTIES, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBLITY OF SUCH DAMAGES OR THE DAMAGES ARE FORESEEABLE. PLEASE BE AWARE THAT IMPLEMENTATION OF INTELLECTUAL
PROPERTY PRESENTED HERE MAY REQUIRE A LICENSE FROM THIRD PARTIES.
TRADEMARKS:
The Microchip name and logo, the Microchip logo, Adaptec, AnyRate, AVR, AVR logo, AVR Freaks, BesTime, BitCloud, chipKIT, chipKIT logo, CryptoMemory, CryptoRF, dsPIC, FlashFlex,
flexPWR, HELDO, IGLOO, JukeBlox, KeeLoq, Kleer, LANCheck, LinkMD, maXStylus, maXTouch, MediaLB, megaAVR, Microsemi, Microsemi logo, MOST, MOST logo, MPLAB, OptoLyzer,
PackeTime, PIC, picoPower, PICSTART, PIC32 logo, PolarFire, Prochip Designer, QTouch, SAM-BA, SenGenuity, SpyNIC, SST, SST Logo, SuperFlash, Symmetricom, SyncServer, Tachyon,
TempTrackr, TimeSource, tinyAVR, UNI/O, Vectron, and XMEGA are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
APT, ClockWorks, The Embedded Control Solutions Company, EtherSynch, FlashTec, Hyper Speed Control, HyperLight Load, IntelliMOS, Libero, motorBench, mTouch, Powermite 3,
Precision Edge, ProASIC, ProASIC Plus, ProASIC Plus logo, Quiet-Wire, SmartFusion, SyncWorld, Temux, TimeCesium, TimeHub, TimePictra, TimeProvider, Vite, WinPath, and ZL are
registered trademarks of Microchip Technology Incorporated in the U.S.A.
Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BlueSky, BodyCom, CodeGuard, CryptoAuthentication, CryptoAutomotive, CryptoCompanion,
CryptoController, dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial Programming, ICSP, INICnet, Inter-Chip Connectivity, JitterBlocker,
KleerNet, KleerNet logo, memBrain, Mindi, MiWi, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient Code Generation, PICDEM, PICDEM.net, PICkit,
PICtail, PowerSmart, PureSilicon, QMatrix, REAL ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI, SuperSwitcher, SuperSwitcher II, Total Endurance, TSHARC, USBCheck,
VariSense, ViewSpan, WiperLock, Wireless DNA, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
The Adaptec logo, Frequency on Demand, Silicon Storage Technology, and Symmcom are registered trademarks of Microchip Technology Inc. in other countries.
GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their respective companies.
© 2019, Microchip Technology Incorporated, All Rights Reserved.
© 2019 Microchip Technology Incorporated. All Rights Reserved. 23064 SEC2 Slide 61