IoT Secure Bootsrapping : ideas

48
I T Bootstrapping & Security : An 8-weeks-internship view

Transcript of IoT Secure Bootsrapping : ideas

Page 1: IoT Secure Bootsrapping : ideas

I TBootstrapping & Security : An 8-weeks-internship view

Page 2: IoT Secure Bootsrapping : ideas

It's all about ...

cloud !

But that's covered :

...

Page 3: IoT Secure Bootsrapping : ideas

What can I do with theses clouds?

REST APIs

MQTTAMQP

CoAP

Page 4: IoT Secure Bootsrapping : ideas

Security ?

REST APIs

MQTTAMQP

CoAP

Page 5: IoT Secure Bootsrapping : ideas

Today answer

REST APIs

MQTTAMQP

CoAP

Let's TLS all the things !!

Page 6: IoT Secure Bootsrapping : ideas

Provisioning

REST APIs

MQTTAMQP

????

Brand new connected lightbulb !

Page 7: IoT Secure Bootsrapping : ideas

Provisioning

Provide Light-bulbMAC

Client certificate

Bake client + servercertificates in the light bulb

Page 8: IoT Secure Bootsrapping : ideas

Provisioning

It works !

Page 9: IoT Secure Bootsrapping : ideas

Provisioning

Brand new connected light-bulbs !

1000x

Page 10: IoT Secure Bootsrapping : ideas

Provisioning

Brand new connected light-bulbs !

1000x

Page 11: IoT Secure Bootsrapping : ideas

Use DNS Service Discovery

Hello world, I am bulb !Where is security service ?

RFC 6763

To DNS serverOR 224.0.0.251 OR FF02::FB

Here you go : CertificatesServer =

IPA + Port A

Open Source JAVA implementation : Eclipse TIAKI project

Page 12: IoT Secure Bootsrapping : ideas

DNS SD : how does it works ? RFC 6763

- Designed to help with resources discovery.- The DNS server send you a list of the services available for the domain you asked.

jibou@issodake:~$ dig PTR _printer._tcp.dns­sd.org.printer._tcp.dns­sd.org. 45 IN PTR Sales._printer._tcp.dns­sd.org._printer._tcp.dns­sd.org. 45 IN PTR Marketing._printer._tcp.dns­sd.org.

jibou@issodake:~$ dig SRV Sales._printer._tcp.dns­sd.org.Sales._printer._tcp.dns­sd.org. 10 IN SRV 0 0 49152 pretend­server.cheshire.org.

- 3 DNS records :- PTR : gives all the SRV records for a given service.

- SRV : Gives details for an instance of a service. Name of the server + port.- TXT : use to give additional details that doesn't fit in the SRV record.

Page 13: IoT Secure Bootsrapping : ideas

Oh wait ! DNS spoofing !

Hello world, I am bulb !Where is security service ?

Here you go : CertificatesServer =

IPA + Port A CertificatesServer =

rogueIP + Port A

Huehuehue... Little light-bulb, come to my serverz...

Page 14: IoT Secure Bootsrapping : ideas

DNS SEC to the rescue

Hello world, I am bulb !Where is security service ?

RFCs 4033 4035-

Signed DNS answer

Spoofed DNS answer

X

Page 15: IoT Secure Bootsrapping : ideas

DNS SEC to the rescue

Example : Twitter got blocked in TurkeyIn 2014

RFCs 4033 4035-

Page 16: IoT Secure Bootsrapping : ideas

DNS SEC : how does it works ? RFCs 4033 4035-

- Each record is signed with the the Zone Signing Key (ZSK).- The signature of each record is sent along the record.- You can verify the signature by decrypt it with the zone's public key.

jibou@issodake:~$ dig +short RRSIG trystram.netA 7 2 3600 20151217181123 20151117181123 45314 trystram.net. HxqTctoCvq[...]00ozFTvFHylLdYYr6cYciSeQBK1mG FBQ=

- There is one public/private key pair for each zone.- Signing a zone can be delegated : the Key Signing Key authenticate the delegation.

- A query on a non-existent domain results on a NSEC record, authenticating that no domain exists.

Page 17: IoT Secure Bootsrapping : ideas

DNS SEC in brief

Root Key Signing Key

Only one key to bake into the bulb !

Eclipse Tiaki project supports DNSSEC as well

Page 18: IoT Secure Bootsrapping : ideas

Good, but not enough

I can still do MIM with my dodgyCA.com cert !

Page 19: IoT Secure Bootsrapping : ideas

The Public Key Infrastructure issue

Example : The DigiNotar hackIn 2011

XGmail.com

Page 20: IoT Secure Bootsrapping : ideas

DNS-based Authentication for Named Endpointsa.k.a DANE RFC 6698

Rogue X509 cert

App server

DNS serverIs the cert I got from _443._ttcp.myapp.com. Supposed to be signed by dodgyCA.com ?

Page 21: IoT Secure Bootsrapping : ideas

DNS-based Authentication for Named Endpointsa.k.a DANE RFC 6698

Rogue X509 cert

App server

DNS serverNope. Supposed to be Verisign.com

X

Page 22: IoT Secure Bootsrapping : ideas

DANE : how does it works ? RFC 6698

- A TLSA record is added in the DNS zone.- TLSA = TLS Authentication- Contains details about the certificate the server is supposed to send.- Signed with DNSSEC

- The TLSA allow to specify : - Which CA's signature the certificate should contain- Which CA + which signature the certificate should contain- A CA certificate (if unknown by the client)- Which public key the certificate should contain

jibou@issodake:~$ dig +dnssec +noall +answer +multi _443._tcp.trystram.net. TLSA_443._tcp.trystram.net. 3600 IN TLSA 3 1 2 ( 02D4B2B6 [… ] EDBA03FB5FA )

Page 23: IoT Secure Bootsrapping : ideas

Sounds better !

X

Page 24: IoT Secure Bootsrapping : ideas

Obtaining credentials

Hello world, I am bulb !I am brand new, where do I get identity ?

Certificate Server found via DNS-SD

DNS server

Page 25: IoT Secure Bootsrapping : ideas

Enrolment over Secure Transport RFC 7030

EST server

Client certificate requestwith Pre-Shared Key Authentication

Page 26: IoT Secure Bootsrapping : ideas

EST RFC 7030

EST server

Bulb number 007 needs a certificate

Red Hat CA

This PSK belongs to Red Hat...

Generate the CSR in behalf of the light-bulb

Page 27: IoT Secure Bootsrapping : ideas

EST RFC 7030

EST server

Signed X509 certificate

Red Hat CA

New certificate to replace the manufacturer PSK

Page 28: IoT Secure Bootsrapping : ideas

EST : how does it works ? RFC 7030

- Over HTTPS- EST client & server need to be provided with authentication data (e.g. PSK)- A client can get a CA public certificate without being authenticated

- The client can ask for a certificate when authenticated via : - Another certificate (e.g. refreshing an old certificate)- Pre-Shared Key- HTTP-based auth (i.e. username & password)

- Based on HTTP URIs- Accept standard Certificate Signing Requests & others (Cryptographic Message Syntax compliant )

* Java implementation : github.com/jscep/jester* Cisco implementation : github.com/cisco/libest  

+ test server at https://testrfc7030.cisco.com:8443/(http://testrfc7030.cisco.com/ for instructions)

Page 29: IoT Secure Bootsrapping : ideas

OverviewDNS serverInitial Situation

Light application

EST server

Red Hat CA

MAC ADDRESS Serial number

Root dns key

Page 30: IoT Secure Bootsrapping : ideas

OverviewDNS serverDNS Service

Discovery

Light application

DNS SD request for EST service

EST server

Red Hat CA

DNSSEC signed answer.

MAC ADDRESS Serial number

Root dns key

1

Page 31: IoT Secure Bootsrapping : ideas

OverviewDNS server

Light application

Initiate HTTPS connection

EST server

Red Hat CA

X509 certificate

DNS DANE

TLSAquery

TLS details in TLSA

MAC ADDRESS Serial number

Root dns key

23

Page 32: IoT Secure Bootsrapping : ideas

OverviewDNS server

Light application

Auth with PSKQuerry certificate

EST server

Red Hat CA

X509 client-side certificate

EST

Client X509 Certificate

Root dns key

4

5

6

6Insert TLSA record

Page 33: IoT Secure Bootsrapping : ideas

OverviewDNS serverDNS Service

Discovery

Light application

DNS SD request for Lighting application service at iot.redhat.com.

EST server

Red Hat CA

DNSSEC signed answer.

Root dns keyX509 Certificate

7

Page 34: IoT Secure Bootsrapping : ideas

OverviewDNS serverDNS DANE

Light application

Initiate HTTPS connectionClient X509 Certificate

EST server

Red Hat CA X509 certificate

Root dns keyX509 Certificate

TLSA request for _5671._tcp.light.iot.redhat.com

TLSA request for _5671._tcp.bulb007.iot.redhat.com

8

9

9

Page 35: IoT Secure Bootsrapping : ideas

OverviewDNS serverApplication

Light application

Sends ambient light data

EST server

Red Hat CA Switch on or/off

Root dns keyClient X509 Certificate

10

Page 36: IoT Secure Bootsrapping : ideas

Then what ?

Client

Remote control

Light application

Nice secured TLS connection- Encrypted- Authenticated- Tamper-proof

I can switch off kitchen light from my bed !!

Page 37: IoT Secure Bootsrapping : ideas

Let's have a closer look

Light application

TLS Handshake Then Data

Page 38: IoT Secure Bootsrapping : ideas

TLS Handshake

Light application

Client Hello ~ Supported ciphersServer Hello ~ Chosen cipher + cert

Negotiate security parametersClient certificateIntegrity check

4 messages + ACKs = 8 TCP messages !

Page 39: IoT Secure Bootsrapping : ideas

Then data.

Light application

Please turnthe light off

4 messages + ACKs = 8 TCP messages !

Handshake

Done.

Page 40: IoT Secure Bootsrapping : ideas

Then data.

Light application

Great, let's quit

4 messages + ACKs = 8 TCP messages !

4 messages + ACKs = 8 TCP messages !

Handshake

Data + quit

OK, Bye.

Page 41: IoT Secure Bootsrapping : ideas

That's a lot

Light application

At least 16 TCP messages to switch a light off

TLS Handshake with RSA mutual authentication :

2388 bytes [1]

[1] : with 1024 bits lengths keys ­ Comparison Studies between PSK and PKE Mechanisms for TLS (Fabian Meyer et al. 2006)

Page 42: IoT Secure Bootsrapping : ideas

A few ideas- Use Pre-Shared Keys Authentication Method (~ 500 bytes handshake, see RFC4279)- Use Eliptic Curve Cryptography (Certificates are much lighter due to short keys)- Use session resumption (handshake down to 3 TCP messages + ACKs)

- Tune TLS to fit your application requirements : - Use NULL cipher-suites (see RFC 4785)- Use Raw Public Keys (see RFC 7250)- TLS 1.3...

- Write good implementations of DTLS- TinyDTLS fits in 100KB flash and requires 10KB RAM[2]

[2] : A Hitchhiker's Guide to the DTLS Protocol for Smart Objects and Constrained Node Networks (2014)tools.ietf.org/html/draft­ietf­lwig­tls­minimal­01

Page 43: IoT Secure Bootsrapping : ideas

TLS handshake with PSK authentication

Source : Comparison Studies between PSK and PKE Mechanisms for TLS (Fabian Meyer et al. 2006)

Amount of transited data Processing time

Page 44: IoT Secure Bootsrapping : ideas

Elliptic Curve Certificates

jibou@issodake:~$ openssl speed[...]

sign/s verify/sRSA 2048 bits 1 403.5 43 197.7256 bit ecdsa (nistp256) 22 996.8 10 164.9

(early 2015 laptop Intel i5)

Faster signing Key Length comparison [3]

Symmetric Key Elliptic Curve RSA

64 128 816

72 144 1008

80 160 1248

96 192 1776

112 224 2432

128 256 3248

256 512 15424

Source : ECRYPT II recommendations (2012)

Page 45: IoT Secure Bootsrapping : ideas

TLS session resumption

Source : Tim Taubert - Mozilla

Full RSA handshake Session resumption

Page 46: IoT Secure Bootsrapping : ideas

TLS v1.3 handshakes

Full handshake

0-RTT resumption

For more details : Tim Taubert blog (timtaubert.de), see 16/11/15 article.

Page 47: IoT Secure Bootsrapping : ideas

Some other things to think about- Time matters.

- Are sensors vulnerable to DDos ?

- PSK doesn't always provide Forward Secrecy (neither do RSA-auth).

- Raspberry-Pi Zero is £4 and full TLS capable.

- What about IPSec in IPv6 devices?

- Initial key provisioning in factory? How can you trust the factory?

- What happen if the building is sold and you need to send data to another cloud provider?

- Firmware management & update without failure (LightWeight M2M maybe).

- Data security in the device.

Page 48: IoT Secure Bootsrapping : ideas

Thanks

● Dave Ingham for answering my questions● Everyone at Red Hat for being nice and paying for the beers● IETF for writing understandable RFCs● Google for finding awesome things to read● Tim Taubert from Mozilla for the TLS handshake drawings● Freepik for providing a lot of the icons used in there