trust no one

61
Trust No One Saúl Ibarra Corretgé @saghul

Upload: saul-ibarra-corretge

Post on 21-Jun-2015

421 views

Category:

Technology


1 download

DESCRIPTION

Slides from my talk at ElastixWorld 2014, on how securing SIP, RTP and IM work.

TRANSCRIPT

Page 1: Trust No One

Trust No One Saúl Ibarra Corretgé

@saghul

Page 2: Trust No One

AG ProjectsSIP Infrastructure Experts

¡Hola!

• @saghul

• AG Projects

• Mi 4º ElastixWorld!

Page 3: Trust No One

AG ProjectsSIP Infrastructure Experts

AG Projects

Page 4: Trust No One

!EL

STATUS QUO

Page 5: Trust No One

¿Quién usa SRTP?

Page 6: Trust No One

¿TLS?

Page 7: Trust No One

¿Entendemos cómo funcionan?

Page 8: Trust No One

#captainCrypto

Page 9: Trust No One

AG ProjectsSIP Infrastructure Experts

SIP 101

Page 10: Trust No One

AG ProjectsSIP Infrastructure Experts

🔓SIP + TLS

• No ofrece garantías end-to-end

• Otros sistemas asumen que esto funciona

• SIP Identity (RFC 4474), ¿Alguien?

Page 11: Trust No One

AG ProjectsSIP Infrastructure Experts

SIP + TLS

Page 12: Trust No One

AG ProjectsSIP Infrastructure Experts

SIP + TLS

Page 13: Trust No One

🔒TLS

Page 14: Trust No One

Page 15: Trust No One

AG ProjectsSIP Infrastructure Experts

SSL?, TLS?

• 1995: SSL 2.0 (Netscape)

• 1996: SSL 3.0 (Netscape)

• 1999: TLS 1.0 (IETF)

• 2006: TLS 1.1

• 2008: TLS 1.2

Page 16: Trust No One

90s CALLED

THEY WANT THEIR CRYPTO BACK

Page 17: Trust No One

AG ProjectsSIP Infrastructure Experts

TLS 101

Page 18: Trust No One

AG ProjectsSIP Infrastructure Experts

SIP + TLS

• Habilitar SIP sobre TLS en DNS

• Validar certificados (servidor, y cliente si se puede)

• Versión de TLS a utilizar

Page 19: Trust No One
Page 20: Trust No One

AG ProjectsSIP Infrastructure Experts

OpenSIPS + TLS• tls_ca_list

• tls_certificate

• tls_private_key

• tls_method

• tls_ciphers_list

• tls_ec_curve

• …%

Page 21: Trust No One

AG ProjectsSIP Infrastructure Experts

Método TLS (en OpenSSL)

• SSLv2, SSLv3

• TLSv1

• No utiliza TLS v1.1 / v1.2!

• SSLv23

• SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3

Page 22: Trust No One
Page 23: Trust No One

tls_method = TLSv1

Page 24: Trust No One

tls_method = SSLv23

Page 25: Trust No One
Page 26: Trust No One

AG ProjectsSIP Infrastructure Experts

Cipher Suites

• Combinación de elementos para negociar una conexión TLS

• autenticación

• cifrado

• algoritmo de key-exchange

&

Page 27: Trust No One

AG ProjectsSIP Infrastructure Experts

Mecanismo Diffie-Hellman

• Protocolo de establecimiento de claves

• Las partes no han tenido contacto previo

• No proporciona autenticación

• Se suele utilizar para establecer una clave de sesión

&

Page 28: Trust No One

AG ProjectsSIP Infrastructure Experts

(Perfect) Forward Secrecy

• Garantía de que comprometer una clave ahora no compromete las usadas anteriormente

• Protección frente a ataques de escucha pasiva

&

Page 29: Trust No One

AG ProjectsSIP Infrastructure Experts

Cipher Suites

ECDHE-RSA-AES128-GCM-SHA256

Intercambiode claves

Firma

Cifrado

Derivación declaves / hashpara HMAC

Page 30: Trust No One

AG ProjectsSIP Infrastructure Experts

&Cipher Suites

• Forward Secrecy

• DHE o ECDHE

• Integridad + autenticación: AES-GCM

• Es necesaria una versión reciente de OpenSSL (>= 1.0.1c)

Page 31: Trust No One

📞SRTP

Page 32: Trust No One

AG ProjectsSIP Infrastructure Experts

SRTP 101

• Proporciona cifrado, autenticación e integridad para RTP / RTCP

• Se utiliza una clave maestra y una función de derivación para cifrar los datos con AES

Page 33: Trust No One

AG ProjectsSIP Infrastructure Experts

SRTP 101

• Obtención de la master key

• SDES

• ZRTP

• DTLS

Page 34: Trust No One

AG ProjectsSIP Infrastructure Experts

SDES

• La clave va en el SDP

• Mecanismo muy simple

• Confiamos en que nadie puede ver la clave (usando SIP sobre TLS)

Page 35: Trust No One

v=0o=- 3622367834 3622367834 IN IP4 192.168.99.54s=Blink 0.9.1 (Linux)t=0 0m=audio 50014 RTP/AVP 113 9 0 8 101c=IN IP4 192.168.99.54a=rtcp:50015a=rtpmap:113 opus/48000a=fmtp:113 useinbandfec=1a=rtpmap:9 G722/8000a=rtpmap:0 PCMU/8000a=rtpmap:8 PCMA/8000a=rtpmap:101 telephone-event/8000a=fmtp:101 0-16a=crypto:1 AEAD_AES_256_GCM inline:pf5+f55JuFhnw1JWVZGOIDQUwdZauReTk08PyzUxNXkcCooQnIphDhVkqZc=a=crypto:2 AEAD_AES_128_GCM inline:iJqlErJI4C5aMZ+atLaFCI+wb7da25qJT2BWcA==a=crypto:3 AEAD_AES_256_GCM_8 inline:adURgA4rN8vD72umdxYd7vMHIFDLQAE6CkOzt+PcLGHww+rsO5GqoGKdudA=a=crypto:4 AEAD_AES_128_GCM_8 inline:rI0VsovgqVI4VUNgYseUJx16I81aGu57TW8y1g==a=crypto:5 AES_256_CM_HMAC_SHA1_80 inline:KUrzE6XiYo2c3y0lmnKm/hpHDEKcqwzwiAZSeui/P2QhyJEZVpzNegR9S5f4+w==a=crypto:6 AES_192_CM_HMAC_SHA1_80 inline:fJpjh8Hr7rRlUrImVMm3BneGeCuFYVIEGcaJlN8l01fSXkSrPUg=a=crypto:7 AES_CM_128_HMAC_SHA1_80 inline:jkmG7Rq2hqoRbGw2NEK/t7lZutJXCytFSC1Lhs7Sa=crypto:8 AES_256_CM_HMAC_SHA1_32 inline:Ci/vj7yG8i5pTxSO81vrj5n8rznpY+ArDycCtQV58gGMvaYk1V06YXaRLcQYEg==a=crypto:9 AES_192_CM_HMAC_SHA1_32 inline:LHg/QVrJrgJnT0NSMjYIfNOnQwQyhXGKHvdK8iq6jj2KvX6WQmg=a=crypto:10 AES_CM_128_HMAC_SHA1_32 inline:eqx9hJlzRWBnYmctFaIeat31IDv2no4Ik7ArXpfza=sendrecv

Page 36: Trust No One

AG ProjectsSIP Infrastructure Experts

Problemas con SDES

• Nos tenemos que fiar de que nadie pueda ver las claves

• No garantiza el intercambio de claves end-to-end

• No hay Forward Secrecy

Page 37: Trust No One

AG ProjectsSIP Infrastructure Experts

B2B SRTP

Page 38: Trust No One

AG ProjectsSIP Infrastructure Experts

ZRTP

• Sistema de negociación de clavesend-to-end

• Utiliza Diffie-Hellman “dentro” del RTP

• Autenticación mediante SAS

Page 39: Trust No One

AG ProjectsSIP Infrastructure Experts

ZRTP: Mitigando ataques MiTM

• SAS: Short Authentication String

• Comprobación verbal de una palabra

• Si coinciden no hay MiTM

• Sólo necesario la primera vez

Page 40: Trust No One

AG ProjectsSIP Infrastructure Experts

ZRTP: Mitigando ataques MiTM

• Continuidad de claves (como SSH)

• TOFU: Trust On First Use

Page 41: Trust No One

v=0o=- 3622958388 3622958388 IN IP4 192.168.99.54s=Blink 0.9.1 (Linux)t=0 0m=audio 50000 RTP/AVP 113 9 0 8 101c=IN IP4 192.168.99.54a=rtcp:50001a=rtpmap:113 opus/48000a=fmtp:113 useinbandfec=1a=rtpmap:9 G722/8000a=rtpmap:0 PCMU/8000a=rtpmap:8 PCMA/8000a=rtpmap:101 telephone-event/8000a=fmtp:101 0-16a=zrtp-hash:1.10 8d4ddc401e82c9f7b6daba77f5c907c5c6334f9e2724355d679a3b01b2eb3b51a=sendrecv

Page 42: Trust No One

AG ProjectsSIP Infrastructure Experts

DTLS-SRTP• Uso de DTLS para intercambiar claves

• Mismo puerto que RTP

• Certificados auto firmados (WebRTC)

• Requiere de integridad del signaling, pero no de confidencialidad

• Comparación del fingerprint a modo de SAS

Page 43: Trust No One

v=0o=- 7518264307715983377 2 IN IP4 127.0.0.1s=-t=0 0a=group:BUNDLE audio videoa=msid-semantic: WMS CCJALAcas2qVJgyxxWGmq2zKZNLF0XnQq2Gum=audio 39664 RTP/SAVPF 111 103 104 0 8 106 105 13 126c=IN IP4 192.168.1.117a=rtcp:1 IN IP4 0.0.0.0a=candidate:319969617 1 udp 2113937151 192.168.1.117 39664 typ host generation 0a=candidate:1569826209 1 tcp 1509957375 192.168.1.117 0 typ host generation 0a=ice-ufrag:Qg33c7pBulT0cCdya=ice-pwd:RNfxxKFEXdpCPsUZ2YYZyKWFa=fingerprint:sha-256 C3:82:98:81:9D:B5:E5:5F:EF:65:CC:A6:A2:6D:87:BA:60:BC:38:D3:6B:E1:95:B4:38:43:18:9B:FD:F6:39:FEa=setup:activea=mid:audioa=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-levela=sendrecva=rtcp-muxa=rtpmap:111 opus/48000/2a=fmtp:111 minptime=10a=rtpmap:103 ISAC/16000a=rtpmap:104 ISAC/32000a=rtpmap:0 PCMU/8000a=rtpmap:8 PCMA/8000a=rtpmap:106 CN/32000a=rtpmap:105 CN/16000a=rtpmap:13 CN/8000a=rtpmap:126 telephone-event/8000a=maxptime:60a=ssrc:1104846898 cname:uBYN/T5ZOYpyjSKNa=ssrc:1104846898 msid:CCJALAcas2qVJgyxxWGmq2zKZNLF0XnQq2Gu a31bf8b7-fd0f-4d64-8b01-2b7c8a70ac13a=ssrc:1104846898 mslabel:CCJALAcas2qVJgyxxWGmq2zKZNLF0XnQq2Gua=ssrc:1104846898 label:a31bf8b7-fd0f-4d64-8b01-2b7c8a70ac13m=video 39664 RTP/SAVPF 100 116 117c=IN IP4 192.168.1.117a=rtcp:1 IN IP4 0.0.0.0a=candidate:319969617 1 udp 2113937151 192.168.1.117 39664 typ host generation 0a=candidate:1569826209 1 tcp 1509957375 192.168.1.117 0 typ host generation 0a=ice-ufrag:Qg33c7pBulT0cCdya=ice-pwd:RNfxxKFEXdpCPsUZ2YYZyKWFa=fingerprint:sha-256 C3:82:98:81:9D:B5:E5:5F:EF:65:CC:A6:A2:6D:87:BA:60:BC:38:D3:6B:E1:95:B4:38:43:18:9B:FD:F6:39:FEa=setup:activea=mid:videoa=extmap:2 urn:ietf:params:rtp-hdrext:toffseta=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-timea=sendrecv

Page 44: Trust No One
Page 45: Trust No One

AG ProjectsSIP Infrastructure Experts

¿Cuál elegir?

• SDES si no hay más remedio

• ZRTP no está muy desplegado pero es más “oportunista”

• Autenticación / identidad en DTLS-SRTP

• ZRTP y DTLS-SRTP ofrecen Forward Secrecy

Page 46: Trust No One

AG ProjectsSIP Infrastructure Experts

libSRTP 1.5.0

• Puede usar OpenSSL como backend

• Soporta AES-GCM

• Aceleración hardware: AES-NI

&

Page 47: Trust No One

(OTR

Page 48: Trust No One

AG ProjectsSIP Infrastructure Experts

OTR 101

• Cifrado para mensajes de chat

• Diffie-Hellman para key-exchange

• AES para cifrado

Page 49: Trust No One

AG ProjectsSIP Infrastructure Experts

OTR

• Proporciona Forward Secrecy

• Autenticación denegable

• Proporciona protección contra ataques MiTM usando autenticación mediante SMP

Page 50: Trust No One
Page 51: Trust No One
Page 52: Trust No One

AG ProjectsSIP Infrastructure Experts

SMP

• “Problema del Socialista Millonario”

• Mecanismo de autenticación sobre Diffie-Hellman

• Se basa en mezclar DH con un secreto compartido por ambas partes

Page 53: Trust No One
Page 54: Trust No One

♥Demo

Page 55: Trust No One

Call secure.

beta.icanblink.com

Page 56: Trust No One

*Resumiendo

Page 57: Trust No One

AG ProjectsSIP Infrastructure Experts

+Resumiendo

• Cifra todo siempre que se pueda

• Usa mecanismos con Forward Secrecy

• Mantente actualizado

• No te fíes de nadie

• #moreCrypto

Page 58: Trust No One
Page 59: Trust No One
Page 60: Trust No One

AG ProjectsSIP Infrastructure Experts

“Trust is like a mirror, you can fix it if it's broken, but you can still see the crack in that mother f*cker’s reflection.” !

Lady Gaga

Page 61: Trust No One

AG ProjectsSIP Infrastructure Experts

¿Preguntas?

bettercallsaghul.com