Upgrade to Pro — share decks privately, control downloads, hide ads and more …

End-to-end encryption with BEAM and Elixir

End-to-end encryption with BEAM and Elixir

Mrinal Wadhwa

May 28, 2021
Tweet

More Decks by Mrinal Wadhwa

Other Decks in Programming

Transcript

  1. Messages, within modern applications, rarely flows over a single, direct,

    point-to-point transport connection. Client Server TCP
  2. Client Microservice Externa l Message Broke r as a service

    External Service Microservice Microservice Microservice
  3. Client Microservice Microservice Microservice Microservice Message Broker Edge Message Broker

    Microservice Microservice Microservice Microservice Data Center
  4. THREAT DESIRED PROPERTY S Spoo fi ng identity Identi fi

    cation, Authentication T Tampering with data Integrity R Repudiation Non-repudiability (some applications desire the opposite) I Information disclosure Con fi dentiality D Denial of service Availability E Elevation of privilege Authorization Note that this model is very high level, there is massive amounts of nuance in dealing with each of the rows. The STRIDE threat model can help us evaluate every message.
  5. • The network is always assumed to be hostile. •

    External and internal threats exist on the network at all times. • Network locality is not sufficient for deciding trust in a network. • Every device, user, and network flow is authenticated and authorized. • Policies must be dynamic & calculated from as many sources of data as possible. Zero Trust in network perimeters. A zero trust network is built upon five fundamental assertions:
  6. Principle of Least Privilege Every program and every privileged user

    of the system should operate using the least amount of privilege necessary to complete the job.” — Jerome Saltzer, Communications of the ACM, 1974 “
  7. Initiator Responder Shared Secret Shared Secret M1 M2 M3 The

    shared secret is then used as a key in Symmetric Key Cryptography to maintain con fi dentiality and integrity of application data. Application Data - Authenticated Encryption The entities involved use Public Key Cryptography to authenticate each other and agree on a shared secret. Authenticated Key Exchange D Secure Channel
  8. THREAT DESIRED PROPERTY S Spoo fi ng identity Identi fi

    cation, Authentication T Tampering with data Integrity R Repudiation Non-repudiability (some applications desire the opposite) I Information disclosure Con fi dentiality D Denial of service Availability E Elevation of privilege Authorization Note that this model is very high level, there is massive amounts of nuance in dealing with each of the rows. The STRIDE threat model can help us evaluate every message.
  9. The phone may not be online all the time so

    the service also caches this data to deliver it later … Heart Rate Monitor Heart Rate Service 80 bpm Heart Rate Application
  10. Heart Rate Monitor Heart Rate Service Transport Layer Security Transport

    Layer Security Since these devices have direct access to the internet, with TLS … Heart Rate Application
  11. Heart Rate Monitor Heart Rate Service 80 bpm Transport Layer

    Security Transport Layer Security Heart Rate Application
  12. Heart Rate Monitor Heart Rate Service 80 bpm 0x217c5111… Transport

    Layer Security Transport Layer Security Heart Rate Application
  13. Heart Rate Monitor Heart Rate Service 80 bpm 0x217c5111… 80

    bpm Transport Layer Security Transport Layer Security Heart Rate Application
  14. Heart Rate Monitor Heart Rate Service 80 bpm 0x217c5111… 80

    bpm 0x8621f842… Transport Layer Security Transport Layer Security Heart Rate Application
  15. Heart Rate Monitor Heart Rate Service 80 bpm 0x217c5111… 80

    bpm 0x8621f842… 80 bpm This type of setup is industry best practice. Transport Layer Security Transport Layer Security Heart Rate Application
  16. Heart Rate Monitor Heart Rate Service 80 bpm 0x217c5111… 80

    bpm 0x8621f842… 80 bpm But even when we manage to setup the channels correctly the data is still exposed to the service. 
 The service doesn’t need to know the contents of the message to route and cache messages (its primary job). Transport Layer Security Transport Layer Security Heart Rate Application
  17. Route/Cache sensor data, alerts and videos. Camera Door Bell Camera

    Door Bell Application Camera Door Bell Service
  18. Gateway Flood Warning Sensor Multiple transport protocols in the path

    of one message. TCP TCP Flood Monitoring System Sensors Vendor’s Service LPWAN
  19. Gateway Flood Warning Sensor Flood Monitoring System Sensors Vendor’s Service

    Various protocols have various different secure channel designs. TLS TLS LPWAN
  20. Gateway Flood Warning Sensor A secure channel that is decoupled

    from the transport layer connections. 
 The gateway and sensor vendor shouldn’t be exposed to application data. Flood Monitoring System Sensors Vendor’s Service
  21. D D D … Devices … … Gateways … Lighting

    HVAC Water Monitoring Elevators Access Control Fire Safety Waste Parking … Vendor IoT Backends … System Integrator 1 Building Management System … SI IoT Backends … System Integrator 2 G G D D D D D D D D D D D D D D D D D D D D D G G G G G G G G G G G G G G Complexity & attack surfaces grow to be unmanageable. Proprietary data is leaked. Security becomes untenable.
  22. D D D … Devices … … Gateways … Lighting

    HVAC Water Monitoring Elevators Access