Raúl Siles Founder & Senior Security Analyst [email protected] www.dinosec.com @ dinosec March 4, 2017 WhatsApp End To End Encryption Demystified 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com Outline • Secure / Private messaging and WhatsApp • Crypto introduction and properties • Signal protocol – X3DH and Prekeys – Double Ratchet • Backdoor, vulnerability, bug or feature? • Conclusions • References 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 2 Secure Messaging & Private Communications https://www.eff.org/secure-messaging-scorecard 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 3 Alice & Bob 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 4 WhatsApp Evolution 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 5 WhatsApp E2E Encryption • WhatsApp E2E encryption is based on the Signal protocol • The app uses Noise Pipes (transport) to communicate with WhatsApp servers • WhatsApp servers can know messages exist (even if content is unknown) – To, From, When, etc. • Registration process (SMS), contacts, etc. • Verify the other party key – View contact info - Encryption: Security code https://www.whatsapp.com/security/ 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 6 Signal Protocol • Previously named Axolotl protocol • WhatsApp: End-to-End (E2E) encryption – Since March 31, 2016 • Other apps: TextSecure (Android), Signal (iOS/ Android), Facebook Messenger, Google Allo… – Variants of Signal protocol (Double Ratchet): Wire (Proteus), Matrix (Olm), Pond, Conversations, ChatSecure, Cryptocat: OMEMO (XMPP)… • Limit the damage of a compromise • Minimize trust in the messaging infrastructure (servers) Main features/protocols: X3DH, prekeys & Double Ratchet 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 7 Who Is Behind This Protocol? • Moxie Marlinspike and Trevor Perrin • Open Whisper Systems (OWS) https://whispersystems.org 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 8 Crypto Introduction 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com Diffie-Hellman (DH) • Or how to exchange a shared secret key (in a secure way) over an insecure channel • Discrete logarithm (or elliptic curve discrete logarithm) • "# %&' ( = * • # = log∝ * %&' ( – ( is a prime >≈ 1.024 bits • Non-authenticated – Vulnerable to MitM attacks "Diffie-Hellman" (THOTH - Píldora 38): http://www.criptored.upm.es/thoth/ http://www.criptored.upm.es/thoth/material/texto/pildora038.pdf 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 10 Diffie-Hellman (DH) Exchange Alice p, " Bob Agreement: (mod p) p is a prime number " is a primitive root mod p 0 SECRETS 1 "0 %&' 2 = 3 "1 %&' 2 = 4 56 %&' 2 = "1 0 %&' 2 78 %&' 2 = "0 1 %&' 2 "10 %&' 2 = S = "01 %&' 2 Shared Secret 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 11 DH Nomenclature • DH (Diffie-Hellman) • DHE (DH Ephemeral) • ECDHE (Elliptic Curve DHE) – Key agreement protocol to exchange a shared secret key (in a secure way) over an insecure channel using key pairs (public & secret/private) – Both parties have a pair of (elliptic curve) keys • Public and secret/private keys – Reference ECDH functions: X25519 & X448 Long-term keys (static) vs. Ephemeral keys (temporary) 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 12 Elliptic Curve Diffie-Hellman (ECDH) • Curve25519 function (Daniel J. Bernstein, 2005) – Curve25519 (elliptic curve) or X25519 (DH exchange function) – 32-byte public & secret/private keys and 32-byte shared secret – Shared secret can be used to authenticate (hash of the shared secret) & encrypt messages – Very high speed function offering ≈128 bits of security 255 – 9(;<=), where p is the prime number 2 − 19 and E is the elliptic curve y2 = x3 + 486662x2 + x (using the base point x=9) – Validate public keys off-line • Vulnerable to MitM attacks 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 13 Elliptic Curve Diffie-Hellman (ECDH) Exchange Alice 9 Bob Agreement: (base point) 9 is a public value 0 SECRET/PRIVATE KEYS 1 ?@ABC25519 0, 9 = 3 PUBLIC ?@ABC25519(1, 9) = 4 KEYS ?@ABC25519 0, 4 ?@ABC25519(1, 3) ?@ABC25519 0, ?@ABC25519(1, 9) = S = ?@ABC25519 1, ?@ABC25519(0, 9) Shared Secret (32-byte) 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 14 Crypto Properties 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com Crypto Properties • (Perfect) Forward Secrecy (PFS) • Plausible deniability or plausibly deniable encryption • Break-in recovery or future secrecy Provided by the Signal protocol 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 16 (Perfect) Forward Secrecy (PFS) • "Property of secure communication protocols in which compromise of long-term keys does not compromise past session keys." – "Encrypted communications and sessions recorded in the past cannot be retrieved and decrypted should long-term secret keys or passwords be compromised in the future." • (Perfect) Forward secrecy or security (PFS) • Provided by SCIMP (Silent Circle Instant Messaging Protocol) – Usage of ephemeral (temporary per-message) keys & KDF • "Pre-Compromise Security" BREAK PAST PRESENT FUTURE https://en.wikipedia.org/wiki/Forward_secrecy 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 17 Plausible Deniability or Cryptographic Deniability • Parties can convincingly deny that a message is encrypted, that it (or its associated plaintext) even exists or that it is able to decrypt it – A party can be absolutely sure a message was sent by the other party (it was not forged by an adversary), but… – A party can not prove to anyone else that a given message was written by the other party (digital signatures) • Provided by OTR (Off-The-Record) vs. GPG/PGP – Keys derived from (ephemeral) shared secrets & renewed https://whispersystems.org/blog/simplifying-otr-deniability/ 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 18 Break-in Recovery or Future Secrecy • "Property of secure communication protocols in which compromise of current keys does not compromise future session keys." – Current key material can not be used to calculate the key material for future subsequent messages (DH exchanges) – Self-healing (Axolotls) • Provided by OTR (Off-The-Record) • Post-Compromise Security (PCS) – https://eprint.iacr.org/2016/221 BREAK PAST PRESENT FUTURE https://whispersystems.org/blog/advanced-ratcheting/ 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 19 X3DH 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com X3DH • X3DH or "Extended Triple Diffie-Hellman" • Key agreement protocol – Parties mutually authenticate each other based on public keys – Provides forward secrecy and cryptographic deniability • Establishing long-term encrypted sessions between users – Establish a shared session key or secret key (SK) – Asynchronous sessions, when a party (Bob) can be offline but has previously published / cached some info to a server – The other party (Alice) wants to send an encrypted message to Bob, and also share a secret key for future communications 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 21 Pre-generated or Pre-loaded Keys (Prekeys) • Forward secrecy in asynchronous messaging scenarios – Asynchronous messaging uses long-live sessions – Initial key exchange for the first message • Initialization of messaging sessions without the presence of the remote party (asynchronous communication) – A key exchange is required to send a message – A key exchange requires messages from both parties • Sender has to wait for the recipient to respond… blocked! – Pre-generate keys and submit (pre-load) them to the messaging server: One-time prekeys (OPK) https://whispersystems.org/blog/asynchronous-security/ 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 22 X3DH Pre-Requisites • Stateful protocol: First message creates the session state – Bob's "prekey bundle" can be considered as the 1st message • Once the session has been established, the session key must be renewed (forward secrecy) using a ratchet • Key directory (e.g. WhatsApp servers) • X3DH must define three parameters: – Curve: X25519 (or Curve25519) – Hash: SHA256 ("HmacSHA256") – Info: string value identifying the app using X3DH ("WhisperText") 2017 © Dino Security S.L. All rights reserved. Todos los derechos reservados. www.dinosec.com 23 X3DH Phases 1. User registration and key publication – Bob publishes his identity key and prekeys to a server 2. X3DH key exchange and initial message submission – Alice fetches a “prekey bundle” for Bob from the server, and uses it to calculate the shared session key or secret key, and sends an initial message to Bob 3. Initial message reception – Bob receives and processes Alice’s initial message, and uses it to calculate the same shared session key or secret key 2017 © Dino
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages106 Page
-
File Size-