Académique Documents
Professionnel Documents
Culture Documents
Ahmed Serhrouchni
Telecom ParisTech
as@enst.fr
Plan
• 1. CONTEXTE
– 1.1 Historique, Standardisation
– 1.2 Contexte: configuration et outils
• 2. Architecture et fonctionnalités
– 2.1 Services et mécanismes cryptographiques
– 2.2 Composantes protocolaires et services
– 2.3 Distribution de TLS
• 3. Protocoles TLS
– 3.1 Handshake
– 3.2 Record, Alert, CCS
• 4. Protocole TLS1.3
– 4.1 Apports et mécanismes
– 4.2 Handshake
– 4.3 Scénarios
• 4. Analyse et perspectives
– 4.1 Gestion des certificats
– 4.2 Faiblesses et attaques
– 4.3 Conclusion
2
Contexte: Historique, Standardisation
3
Contexte: Historique, Standardisation
4
Contexte: Historique, Standardisation
5
Contexte: Historique, Standardisation
6
Contexte: Historique, Standardisation
• WTLS (2001)
– Wireless Transport Layer Security
– Standard au sein du WAP Forum
– Automate semblable à SSL V3.0
• Pas d’interopérabilité avec TLS V1.0
• Taille de quelques paramètres diffèrent
• Des certificats spécifiques «légers»
– WTLS devenu «End-to-end Transport Layer
Security Specification »
7
Contexte: Historique, Standardisation
• TLS1.2 RFC5246
– Surtout AEAD (Authenticated Encryption with Associeted Data)
– Mode opératoire CCM et GCM RFC5116
– Inclusion des extensions dans le standard et d’autres RFC
– Ajout de suites cryptographiques HMAC SHA2,
AES-GCM, AES-CCM, Chacha20-Poly1305,
ECDHE
– …..mais maintien les anciennes « cipher suites »
8
Contexte: Historique, Standardisation
9
Contexte: Historique, Standardisation
10
Contexte: configuration et outils
11
Contexte: configuration et outils
• Firefox
– about:config ensuite un filtre sur security
• IE (configuration du module FIPS140-2)
– HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy\Enabled 1
– [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders
\SCHANNEL\Ciphers\RC4 128/128] "Enabled"=dword:00000000
– [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders
\SCHANNEL\Ciphers\RC4 40/128] "Enabled"=dword:00000000
– [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders
\SCHANNEL\Ciphers\RC4 56/128] "Enabled"=dword:00000000
• Chrome
– chrome.exe --cipher-suite-blacklist=0x0004,0x005
• 0x0004 = RSA-RC4128-MD5
• 0x0005 = RSA-RC4128-SHA
12
Contexte: configuration et outils
13
Contexte: distribution de TLS
• Openssl
– https://www.openssl.org
• GnuTLS
– https:// www.gnutls.org/
• LibreSSL: fork de OpenSSL (OpenBSD)
– https:// www.libressl.org/
• BoringSSL: fork de Openssl, intégré à Chrome
– https://boringssl.googlesource.com/boringssl
• Schannel Microsoft
– HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings
• PolarSSL, Transport de Apple, NSS de Netscape, …
14
Architecture et fonctionnalités:
Services et mécanismes cryptographiques
15
Architecture et fonctionnalités:
Services et mécanismes cryptographiques
NFS
TCP UDP
IP
16
Architecture et fonctionnalités:
Services et mécanismes cryptographiques
Protocole Port Protocole non Application
sécurisé sécurisé
HTTPS 443 HTTP Transactions requête-
réponse sécurisées
SSMTP 465 SMTP Messagerie électronique
18
Architecture et fonctionnalités:
Services et mécanismes cryptographiques
• Authentification
– Serveur (obligatoire), client (optionnel)
– Utilisation de certificat X509 V3
– A l’établissement de la session.
• Confidentialité
– Algorithme de chiffrement symétrique négocié, clé
généré à l’établissement de la session.
• Intégrité
– Fonction de hachage avec clé secrète
– hmac(clé secrète, h, Message)
• Non Rejeu
– Numéro de séquence
19
Architecture et fonctionnalités: RFC5246
Services et mécanismes cryptographiques
Appendix C. Cipher Suite Definitions
20
Architecture et fonctionnalités: RFC5246
Services et mécanismes cryptographiques
• Suite …
TLS_DH_DSS_WITH_AES_128_CBC_SHA DH_DSS AES_128_CBC SHA
TLS_DH_RSA_WITH_AES_128_CBC_SHA DH_RSA AES_128_CBC SHA
TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE_DSS AES_128_CBC SHA
TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE_RSA AES_128_CBC SHA
TLS_DH_anon_WITH_AES_128_CBC_SHA DH_anon AES_128_CBC SHA
TLS_DH_DSS_WITH_AES_256_CBC_SHA DH_DSS AES_256_CBC SHA
TLS_DH_RSA_WITH_AES_256_CBC_SHA DH_RSA AES_256_CBC SHA
TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE_DSS AES_256_CBC SHA
TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE_RSA AES_256_CBC SHA
TLS_DH_anon_WITH_AES_256_CBC_SHA DH_anon AES_256_CBC SHA
TLS_DH_DSS_WITH_AES_128_CBC_SHA256 DH_DSS AES_128_CBC SHA256
TLS_DH_RSA_WITH_AES_128_CBC_SHA256 DH_RSA AES_128_CBC SHA256
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 DHE_DSS AES_128_CBC SHA256
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 DHE_RSA AES_128_CBC SHA256
TLS_DH_anon_WITH_AES_128_CBC_SHA256 DH_anon AES_128_CBC SHA256
TLS_DH_DSS_WITH_AES_256_CBC_SHA256 DH_DSS AES_256_CBC SHA256
TLS_DH_RSA_WITH_AES_256_CBC_SHA256 DH_RSA AES_256_CBC SHA256
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 DHE_DSS AES_256_CBC SHA256
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 DHE_RSA AES_256_CBC SHA256
TLS_DH_anon_WITH_AES_256_CBC_SHA256 DH_anon AES_256_CBC SHA256
21
Architecture et fonctionnalités:
Composantes protocolaires et services
Application
TLS&SSL
Handshake
Alert CCS
Record
TCP
22
Architecture et fonctionnalités:
Composantes protocolaires et services
struct { ContentType type;
ProtocolVersion version;
uint16 length;
opaque fra[TLSPlaintext.length];
} TLSPlaintext;
struct {
uint8 major, minor;
} ProtocolVersion;
enum { change_cipher_spec(20),
alert(21),
handshake(22),
application_data(23),
(255)
} ContentType;
23
Architecture et fonctionnalités:
Composantes protocolaires et services
Application Protocol
Handshake Protocol
CCS Protocol
Alert Protocol
24
Protocole TLS: Handshake
25
Protocole TLS: Handshake
Ouverture d'une
session TLS
Client Serveur
Client Hello
Serveur Hello
Certificate
(Serveur Key Exchange)
(Certificate Request)
Server Hello Done
(Certificate)
Client Key Exchange
(Certificate Verify)
ChangeCipherSpec
Finished
ChangeCipherSpec
Finished
Application Data
Application Data
26
Protocole TLS: Handshake
Ouverture d'une
connexion
Client Serveur
Client Hello
Serveur Hello
ChangeCipherSpec
Finished
ChangeCipherSpec
Finished
Application Data
27
Protocole TLS: Handshake
PDU du protocole Handshake
struct{
HandshakeType msg_type;
uint24 length;
select (HandshakeType) {
case hello_request: HelloRequest;
case client_hello: ClientHello;
case server_hello: ServerHello;
case certificate: Certificate;
case server_key_exchange: ServerKeyExchange;
case certificate_request: CertificateRequest;
case server_hello_done: ServerHelloDone;
case certificate_verify: CertificateVerify;
case client_key_exchange: ClientKeyExchange;
case finished: Finished;
} body;
} Handshake;
28
Protocole TLS: Handshake
PDU du protocole Handshake
struct {
ProtocolVersion client_version;
Random random;
SessionID session_id;
CipherSuite cipher_suites<2..2^16-1>;
CompressionMethod compression_methods<1..2^8-1>;
Extension client_hello_extension_list<0..2^16-1>;
} ClientHello;
struct {
ProtocolVersion server_version;
Random random;
SessionID session_id;
CipherSuite cipher_suite;
CompressionMethod compression_method;
Extension server_hello_extension_list<0..2^16-1>;
} ServerHello;
29
Protocole TLS: Handshake
enum {
server_name(0), max_fragment_length(1),
client_certificate_url(2),trusted_ca_keys(3),
truncated_hmac(4), status_request(5), …
(65535)
} ExtensionType;
30
Protocole TLS: Handshake
• Extensions (suite)
client_cert_url 2 RFC 6066 2011
trusted_ca_keys 3 RFC 6066 2011
truncated_hmac 4 RFC 6066 2011
status_request 5 RFC 6066 2011
user_mapping 6 RFC 4681 2006
client_authz 7 RFC 5878 2010
server_authz 8 RFC 5878 2010
cert_type 9 RFC 6091 2011
elliptic_curves 10 RFC 4492 2006
ec_pt_formats 11 RFC 4492 2006
31
Protocole TLS: Handshake
• Extensions (suite)
srp 12 RFC 5054 2007
signature_alg 13 RFC 5246 2008
use_srtp 14 RFC 5764 2010
heartbeat 15 RFC 6520 2012
appli prot_nego 16 Draft-friedl-tls- 2013
status_req_v2 17 RFC-ietf-tls- 2013
multiple-cert[…]
signed_certe_ti 18 RFC-laurie- 2013
enum {
rsa_sign(1), dss_sign(2), rsa_fixed_dh(3),
dss_fixed_dh(4),rsa_ephemeral_dh_RESERVED(5),
dss_ephemeral_dh_RESERVED(6),
fortezza_dms_RESERVED(20),(255)
} ClientCertificateType;
34
Protocole TLS: Handshake
struct {
select (KeyExchangeAlgorithm) {
case rsa:
EncryptedPreMasterSecret;
case dhe_dss:
case dhe_rsa:
case dh_dss:
case dh_rsa:
case dh_anon:
ClientDiffieHellmanPublic;
} exchange_keys;
} ClientKeyExchange;
35
Protocole TLS: Handshake
struct {
ProtocolVersion client_version;
opaque random[46];
} PreMasterSecret;
struct {
public-key-encrypted PreMasterSecret
pre_master_secret;
} EncryptedPreMasterSecret;
struct {
opaque verify_data[verify_data_length];
} Finished;
36
Protocole TLS: Handshake
37
Protocole TLS: Handshake
38
Protocole TLS: Handshake
39
Protocole TLS: Record, Alert, CCS
• Après application de :
- la fragmentation des données en blocs de taille
maximum de 214 octets
- la compression des données, fonction prévue mais non
supportée actuellement
- la génération d’un condensât pour assurer le service
d’intégrité
- le chiffrement des données pour assurer le service de
confidentialité
40
Protocole TLS: Record, Alert, CCS
• Le protocole Record
assure:
– La fragmentation
– La compression
– Le MAC
– Le chiffrement, et
– La transmission des
données.
41
Protocole TLS: Record, Alert, CCS
42
Protocole TLS: Record, Alert, CCS
enum {
warning(1), fatal(2), (255) } AlertLevel;
enum {
close_notify(0),
unexpected_message(10),
bad_record_mac(20),
decryption_failed(21),
record_overflow(22),
decompression_failure(30),
handshake_failure(40),
no_certificate_RESERVED (41),
bad_certificate(42),
unsupported_certificate(43),
certificate_revoked(44),
43
Protocole TLS: Record, Alert, CCS
/* suite …
certificate_unknown(46),
illegal_parameter(47),
unknown_ca(48),
access_denied(49),
decode_error(50),
decrypt_error(51),
export_restriction_RESERVED(60),
protocol_version(70),
insufficient_security(71),
internal_error(80),
user_canceled(90),
no_renegotiation(100),
(255)
} AlertDescription; 44
Protocole TLS: Record, Alert, CCS
45
Analyse et perspectives:
Perspectives avec TLS1.3
enum {
server_name(0), /* RFC 6066 */
max_fragment_length(1), /* RFC 6066 */
status_request(5), /* RFC 6066 */
supported_groups(10), /* RFC 8422, 7919 */
signature_algorithms(13), /* RFC 8446 */
use_srtp(14), /* RFC 5764 */
heartbeat(15), /* RFC 6520 */
app_layer_proto_nego (16), /* RFC 7301 */
signed_cert_timestamp(18), /* RFC 6962 */
client_certificate_type(19), /* RFC 7250 */
server_certificate_type(20), /* RFC 7250 */
padding(21), /* RFC 7685 */
…. } ExtensionType;
47
TLS1.3: les extensions (suite)
enum {
…
pre_shared_key(41), /* RFC 8446 */
early_data(42), /* RFC 8446 */
supported_versions(43), /* RFC 8446 */
cookie(44), /* RFC 8446 */
psk_key_exchange_modes(45), /* RFC 8446 */
certificate_authorities(47), /* RFC 8446 */
oid_filters(48), /* RFC 8446 */
post_handshake_auth(49), /* RFC 8446 */
signature_algorithms_cert(50), /* RFC 8446 */
key_share(51), /* RFC 8446 */
(65535) } ExtensionType;
48
TLS1.3: les suites de chiffrement
(obligatoires)
49
TLS1.3: les suites de chiffrement
(obligatoires)
50
TLS1.3: les algorithmes asymétriques
(obligatoires)
• Pour la signature:
• rsa_pkcs1_sha256
• rsa_pss_rsae_sha256
• ecdsa_secp256r1_sha256.
51
Modèle de chiffrement des données
Source: wikipedia
52
Modèle de chiffrement des données
Source: wikipedia
53
Modèle de chiffrement des données
Source: wikipedia
54
AES-GCM (NIST SP800-38D) Chiffrement
m1 m2 mn-1 mn
C1 C2 Cn- Cn
1
AuthTA
55 G
AES-GCM (NIST SP800-38D)
Déchiffrement + Authentification
m1 m2 mn-1 mn
C1 C2 Cn- Cn
1
H Mult
AuthTA
56 G
AES-GCM (NIST SP800-38D)
Application au protocole ModBus
7 253
Bytes Bytes
TransID
UnitID
Protocol ID Len
FC Data
2 2 2 1 1 252 Byte
Bytes Bytes Bytes Byte Byte
AES-128-
k
GCM
12 Bytes
7
Bytes
12
Bytes
253
Bytes 57
Record Protocol
• AEADEncrypted =
AEAD-Encrypt(write_key, nonce, additional_data, plaintext)
• PlainText =
AEAD-Decrypt(peer_write_key, nonce, additional_data, AEADEncrypted)
58
Protocole Handshake
struct {
HandshakeType msg_type; /* handshake type */
uint24 length; /* bytes in message */
select (Handshake.msg_type) {
case client_hello: ClientHello;
case server_hello: ServerHello;
case end_of_early_data: EndOfEarlyData;
case encrypted_extensions: EncryptedExtensions;
case certificate_request: CertificateRequest;
case certificate: Certificate;
case certificate_verify: CertificateVerify;
case finished: Finished;
case new_session_ticket: NewSessionTicket;
case key_update: KeyUpdate; };
} Handshake;
59
Handshake:
Etablissement de session avec partage du PSK
Client Server
Initial Handshake:
ClientHello
+ key_share -------->
ServerHello
+ key_share
{EncryptedExtensions}
{CertificateRequest*}
{Certificate*}
{CertificateVerify*}
{Finished}
<-------- [Application Data*]
{Certificate*}
{CertificateVerify*}
{Finished} -------->
<-------- [NewSessionTicket]
[Application Data] <-------> [Application Data]
60
Handshake:
Etablissement de session avec 0-RTT
Client Server
ClientHello
+ early_data
+ key_share*
+ psk_key_exchange_modes
+ pre_shared_key
(Application Data*) -------->
ServerHello
+ pre_shared_key
+ key_share*
{EncryptedExtensions}
+ early_data*
{Finished}
<-------- [Application Data*]
(EndOfEarlyData)
{Finished} -------->
[Application Data] <-------> [Application Data]
61
Handshake:
Reprise de session avec PSK
Client Server
ClientHello
+ key_share*
+ pre_shared_key -------->
ServerHello
+ pre_shared_key
+ key_share*
{EncryptedExtensions}
{Finished}
<-------- [Application Data*]
{Finished} -------->
[Application Data] <-------> [Application Data]
62
Analyse et perspectives:
Gestion des certificats
63
Analyse et perspectives:
Gestion des certificats
64
Analyse et perspectives:
Faiblesses et attaques
• RFC 7457:
– Summarizing Known Attacks on TLS and DTLS
• Attaque sur la crypto: (LUCKY 13, RC4 biases, BEAST)
• Attaque sur la compression: (CRIME, BREACH)
– Compression Ratio Info-leak Made Easy
– Browser Reconnaissance and Exfiltration via Adaptive
Compression of Hypertext
• Attaque sur l’implantation: Heartbleed RFC6520
struct {
HeartbeatMessageType type;
uint16 payload_length;
opaque payload[HeartbeatMessage.payload_length];
opaque padding[padding_length];
} HeartbeatMessage;
65
Analyse et perspectives:
Faiblesses et attaques
Phase 1 Phase 2
66
Conclusion