SSL Troubleshooting with Wireshark and Tshark



Similar documents
Communication Systems SSL

Communication Systems 16 th lecture. Chair of Communication Systems Department of Applied Sciences University of Freiburg 2009

Managing and Securing Computer Networks. Guy Leduc. Chapter 4: Securing TCP. connections. connections. Chapter goals: security in practice:

Real-Time Communication Security: SSL/TLS. Guevara Noubir CSU610

Outline. Transport Layer Security (TLS) Security Protocols (bmevihim132)

Overview of CSS SSL. SSL Cryptography Overview CHAPTER

SBClient SSL. Ehab AbuShmais

SECURE SOCKETS LAYER (SSL)

Overview. SSL Cryptography Overview CHAPTER 1

Cryptography and Network Security Sicurezza delle reti e dei sistemi informatici SSL/TSL

CSC 474 Information Systems Security

CSC Network Security

NOTE: This is not a official Cisco document and you use it on your own risk.

NetApp Storage Encryption: Preinstallation Requirements and Procedures for SafeNet KeySecure

Network Security Web Security and SSL/TLS. Angelos Keromytis Columbia University

How To Understand And Understand The Ssl Protocol ( And Its Security Features (Protocol)

Web Security Considerations

Security Protocols and Infrastructures. h_da, Winter Term 2011/2012

Lecture 7: Transport Level Security SSL/TLS. Course Admin

Announcement. Final exam: Wed, June 9, 9:30-11:18 Scope: materials after RSA (but you need to know RSA) Open books, open notes. Calculators allowed.

Security Engineering Part III Network Security. Security Protocols (I): SSL/TLS

Secure Socket Layer. Security Threat Classifications

Communication Security for Applications

Secure Socket Layer (SSL) and Transport Layer Security (TLS)

Secure Sockets Layer (SSL ) / Transport Layer Security (TLS) Network Security Products S31213

SSL Secure Socket Layer

Secure Socket Layer (SSL) and Trnasport Layer Security (TLS)

SSL Secure Socket Layer

[SMO-SFO-ICO-PE-046-GU-

MobileIron Tunnel v1.0.1 update requirements. Tech Series. 6/17/2014 Written by Ulrik Van Schepdael Mobco bvba

Einführung in SSL mit Wireshark

Some solutions commonly used in order to guarantee a certain level of safety and security are:

Secure Socket Layer. Carlo U. Nicola, SGI FHNW With extracts from publications of : William Stallings.

Software Engineering 4C03 Research Project. An Overview of Secure Transmission on the World Wide Web. Sean MacDonald

SSL Certificates in IPBrick

CS 356 Lecture 27 Internet Security Protocols. Spring 2013

Transport Level Security

Chapter 17. Transport-Level Security

Whitepaper : Using Unsniff Network Analyzer to analyze SSL / TLS

3.2: Transport Layer: SSL/TLS Secure Socket Layer (SSL) Transport Layer Security (TLS) Protocol

Displaying SSL Certificate and Key Pair Information

HTTPS: Transport-Layer Security (TLS), aka Secure Sockets Layer (SSL)

Lecture 4: Transport Layer Security (secure Socket Layer)

Learning Network Security with SSL The OpenSSL Way

Network Security Essentials Chapter 5

ISA 562 Information System Security

SECURE SOCKETS LAYER (SSL) SECURE SOCKETS LAYER (SSL) SSL ARCHITECTURE SSL/TLS DIFFERENCES SSL ARCHITECTURE. INFS 766 Internet Security Protocols

Configuring SSL Termination

Institute of Computer Technology - Vienna University of Technology. L96 - SSL, PGP, Kerberos

The Secure Sockets Layer (SSL)

SSL: Secure Socket Layer

The Beautiful Features of SSL And Why You Want to Use Them?

Interested in learning more about security? SSL/TLS: What's Under the Hood. Copyright SANS Institute Author Retains Full Rights

mod_ssl Cryptographic Techniques

Overview of SSL. Outline. CSC/ECE 574 Computer and Network Security. Reminder: What Layer? Protocols. SSL Architecture

Internet Mail Client Control Library SSL Supplement

Information Security

ERserver. iseries. Securing applications with SSL

Transport Layer Security Protocols

Managing SSL certificates in the ServerView Suite

IIS EPP v3. Create Certificate for IIS EPP v3. IIS Registry EPP Information. Last saved: November 17, 2015

Certificate Management. PAN-OS Administrator s Guide. Version 7.0

Lecture 31 SSL. SSL: Secure Socket Layer. History SSL SSL. Security April 13, 2005

Rocket UniVerse. Security Features. Version April 2014 UNV-1123-SECU-1

Secure Socket Layer/ Transport Layer Security (SSL/TLS)

TLS/SSL in distributed systems. Eugen Babinciuc

SSL Protect your users, start with yourself

Security. Learning Objectives. This module will help you...

Certificates and network security

Authenticity of Public Keys

Security. Contents. S Wireless Personal, Local, Metropolitan, and Wide Area Networks 1

Lab Exercise SSL/TLS. Objective. Step 1: Open a Trace. Step 2: Inspect the Trace

Secure Socket Layer (TLS) Carlo U. Nicola, SGI FHNW With extracts from publications of : William Stallings.

Secure Sockets Layer

Integrated SSL Scanning

Apache Security with SSL Using Ubuntu

WEB SERVICES CERTIFICATE GUIDE

, SNMP, Securing the Web: SSL

TLS-RSA-PSK. Channel Binding using Transport Layer Security with Pre Shared Keys

SSL/TLS. What Layer? History. SSL vs. IPsec. SSL Architecture. SSL Architecture. IT443 Network Security Administration Instructor: Bo Sheng

Using etoken for SSL Web Authentication. SSL V3.0 Overview

WXOS 5.5 SSL Optimization Implementation Guide for Configuration and Basic Troubleshooting

MatrixSSL Developer's Guide Version 3.7

Unifying Information Security. Implementing TLS on the CLEARSWIFT SECURE Gateway

Exinda How to Guide: SSL Acceleration

Binding Security Tokens to TLS Channels. A. Langley, Google Inc. D. Balfanz, Google Inc. A. Popov, Microsoft Corp.

Intro to AppDynamics with SSL

Integrated SSL Scanning

Three attacks in SSL protocol and their solutions

Protocol Rollback and Network Security

Today s Topics SSL/TLS. Certification Authorities VPN. Server Certificates Client Certificates. Trust Registration Authorities

Overview SSL/TLS HTTPS SSH. TLS Protocol Architecture TLS Handshake Protocol TLS Record Protocol. SSH Protocol Architecture SSH Transport Protocol

SSL/TLS: The Ugly Truth

TLS and SRTP for Skype Connect. Technical Datasheet

Authentication applications Kerberos X.509 Authentication services E mail security IP security Web security

Avoid the SSLippery Slope of Default SSL

GNUTLS. a Transport Layer Security Library This is a Draft document Applies to GnuTLS by Nikos Mavroyanopoulos

Low-Level TLS Hacking

Transport Layer Security (TLS)

Lab 7. Answer. Figure 1

Transcription:

SSL Troubleshooting with Wireshark and Tshark Sake Blok Application Delivery Networking Consultant and Troubleshooter sake.blok@syn-bit.nl 1 1

2

3

About you? Who thinks SSL is just about encryption? troubleshooted SSL traffic before? knows the purpose of each handshake message? tried to decrypt SSL traffic before? and ran into problems decrypting? troubleshooted client authentication problems? 4 4

About me? Started SYN-bit in 2009 Application Delivery Networking Consultant & Troubleshooter (F5 Networks, Cisco ACE, Alteon) Have used SSL extensively in customer projects Using Ethereal since 1999, developing since 2006, member core-developers since 2007 Enjoy scuba diving and art-house movies 5 5

Challenges Confidentiality Encryption and Decryption SSL Message Integrity Message Digest and Message Signing Endpoint Authentication & Nonrepudiation Certificates and Certificate Authorities 6 6

Agenda Cryptology overview The SSL protocol Analyzing SSL with Wireshark Analyzing SSL with Tshark Common SSL connection problems Further reading Questions & Discussion 7 7

Agenda Cryptology overview The SSL protocol Analyzing SSL with Wireshark Analyzing SSL with Tshark Common SSL connection problems Further reading Questions & Discussion 8 8

Symetric Encryption Same key for encryption and decryption Computatively "cheap" Short keys (typically 40-256 bits) DES, 3DES, AESxxx, RC4 Confidentiality? One-to-many? 9 9

Asymetric Encryption One key for encryption, second key for decryption (both keys form a pair) Computatively "expensive" Long keys (typically 512-4096 bits) RSA, DSA Confidentiality? Authentication? One-to-many? 10 10

Hashing / Message Digest Irreversible original text not reproducable from the digest Collision-resistance "Not possible" to create a message M' so that it has the same digest as message M MD5, SHA-1, SHA-2 4fe7ad41 11 11

Message Signing Create digest of message Encrypt digest with private key Authenticity and sender of message can be checked with public key 4fe7ad41 4fe7ad41? = 4fe7ad41 3e7bc46a 3e7bc46a 12 12

Digital Certificates "In cryptography, a public key certificate (or identity certificate) is an electronic document which utilizes a digital signature to bind together a public key with an identity." (From http://en.wikipedia.org/wiki/digital_certificate) But who is signing??? 13 13

Certificate Authorities Mutually trusted by sender and receiver "Solves" key exchange problems CA's can be chained Top of chain is "self-signed" (and is called the "Root CA") 14 14

Creating a certificate 4fe7ad41 2 3e7bc46a 3e7bc46a 3e7bc46a 15 15

Agenda Cryptology overview The SSL protocol Analyzing SSL with Wireshark Analyzing SSL with Tshark Common SSL connection problems Further reading Questions & Discussion 16 16

SSL History SSLv1 by Netscape (unreleased, 1994) SSLv2 by Netscape (v2-draft,1994) SSLv3 by Netscape (v3-draft, 1995) TLSv1.0, IETF (RFC 2246, 1999) TLSv1.1, IETF (RFC 4346, 2006) TLSv1.2, IETF (RFC 5246, 2008) Risks and differences explained at: http://www.yaksman.org/~lweith/ssl.pdf 17 17

Place in TCP/IP stack Between transport and application layer Protocol independent HTTP SMTP SSL/TLS TCP handshake change application cipherspec data SSL record layer alert IP 18 18

SSL Record Layer Provides fragmentation (max size 2^14) Multiple SSL messages (of one content type) per SSL Record allowed SSL Record can be split over multiple TCP-segments (2^14 > MSS!) One TCP-segment can contain multiple SSL Records (or fragments) 19 19

SSL Content Types Handshake Protocol (0x16) responsible for authentication and session key setup ChangeCipherSpec Protocol (0x14) Notify start of encryption Alert Protocol (0x15) Reporting of warnings and fatal errors Application Protocol (0x17) Actual encryption and transport of data 20 20

Agenda Cryptology overview The SSL protocol Analyzing SSL with Wireshark Analyzing SSL with Tshark Common SSL connection problems Further reading Questions & Discussion 21 21

Lab setup Client WinXP - Firefox Client-cert 1: Neo Client-cert 2: Trinity Sharkfest Lab Root CA Sharkfest Lab Server CA CN:public.sharkfest.local CN:private.sharkfest.local.1 192.168.3.0/24.3.4 Sharkfest Lab Client CA CN:Neo CN:Trinity (virtual) Server 1 Ubuntu - Apache Server-cert: public.sharkfest.local (virtual) Server 2 Ubuntu - Apache Server-cert: private.sharkfest.local Require Client-Certificate 22 22

Choosing the right settings ip.defragment: TRUE tcp.check_checksum: FALSE tcp.desegment_tcp_streams: TRUE ssl.desegment_ssl_records: TRUE ssl.desegment_ssl_applicaeon_data: TRUE 23 23

Analyzing the SSL record layer (1) 24 24

Analyzing the SSL record layer (2) 0x091c = 2332 bytes??? 25 25

Analyzing the SSL record layer (3) (5+2332) + (5+4) = 2346 26 26

Analyzing the SSL handshake Normal RSA handshake Ephemeral RSA (or DH) handshake SSL session with client authentication Reusing SSL sessions Reused SSL session (partial handshake) Expired SSL session No SSL reuse 27 27

Normal RSA handshake ClientHello ServerHello CerEficate ServerHelloDone Client ClientKeyExchange ChangeCipherSpec Finished (encrypted) Server ChangeCipherSpec Finished (encrypted) 28 28

in Wireshark 29 29

ClientHello 30 30

ServerHello 31 31

Certificate (1) 32 32

Certificate (2) 33 33

Certificate (3) 34 34

Certificate (4) 35 35

ServerHelloDone 36 36

ClientKeyExchange 37 37

ChangeCipherSpec (C) 38 38

Finished (C) Without decrypeon: With decrypeon: 39 39

ChangeCipherSpec (S) 40 40

Finished (S) Without decrypeon: With decrypeon: 41 41

Ephemeral RSA (or DH) handshake ClientHello Client ServerHello CerEficate ServerKeyExchange ServerHelloDone ClientKeyExchange Server ChangeCipherSpec Finished (encrypted) ChangeCipherSpec Finished (encrypted) 42 42

in Wireshark 43 43

ServerKeyExchange 44 44

Client Authentication ClientHello ServerHello CerEficate CerEficateRequest ServerHelloDone Client CerEficate ClientKeyExchange CerEficateVerify ChangeCipherSpec Server Finished (encrypted) 45 ChangeCipherSpec Finished (encrypted) 45

in Wireshark 46 46

CertificateRequest 47 47

Certificate (C) 48 48

CertificateVerify 49 49

Reusing SSL sessions Key negotiation "expensive" Cache session keys and re-use for new TCP sessions SSL session ID is used as Index Timeout on SSL session ID is an "absolute timeout" not an "idle timeout" Old IE: 2 minutes, now 10 hours 50 50

Handshake of a Reused Session ClientHello Client ServerHello ChangeCipherSpec Finished (encrypted) Server ChangeCipherSpec Finished (encrypted) 51 51

SSL session reuse (new, reused and expired) # Inter-Process Session Cache: # Configure the SSL Session Cache: First the mechanism # to use and second the expiring timeout (in seconds). #SSLSessionCache dbm:/var/run/apache2/ssl_scache SSLSessionCache shmcb:/var/run/apache2/ssl_scache(512000) SSLSessionCacheTimeout 60 Par4al Full Handshake 52 52

No SSL session reuse 53 53

TLS session Tickets (1) TLS session tickets (RFC 5077) Do not keep state on server, only on client TLS extension in ClientHello and ServerHello New SSL HandshakeType: NewSessionTicket 54 54

TLS session Tickets (2) ClientHello (ext len=0) Client ServerHello (ext len=0) CerEficate ServerHelloDone ClientKeyExchange ChangeCipherSpec Server Client ClientHello (Ecket) ServerHello ChangeCipherSpec Finished (encrypted) Server Finished (encrypted) ChangeCipherSpec NewSessionTicket ChangeCipherSpec Finished (encrypted) Finished (encrypted) 55 55

TLS session Tickets (3) 56 56

Analyzing SSL Alerts Without decrypeon: With decrypeon: 57 57

Analyzing SSL Application Data 58 58

Decrypting SSL traffic Provide server private key to Wireshark Only works when whole session (including full handshake) is in the tracefile Does not work with Ephemeral RSA or DH ciphers (ServerKeyExchange present) Does works with Client Authentication 59 59

Providing the server private key (1) Wireshark preferences file: ssl.keys_list: 192.168.3.3,443,http,c:\key.pem ssl.debug_file: c:\temp\ssl-debug.log When using Tshark: tshark -r file.cap -o ssl.keys_list:192.168.3.3,443,http,"c:\key.pem" \ -o ssl.debug_file:"c:\ssl-debug.log" -V -R http 60 60

Providing the server private key (2) $ cat ~/.wireshark/ssl_keys # This file is automatically generated, DO NOT MODIFY. "192.168.3.3","443","http","/Users/sake/tmp/ssl-deflate.key","" $ 61 61

Providing the server private key (3) SSL debug log: ssl_init keys string: 192.168.3.3,443,http,c:\temp\public.sharkfest.local.key ssl_init found host entry 192.168.3.3,443,http,c:\temp\public.sharkfest.local.key ssl_init addr '192.168.3.3' port '443' filename 'c:\temp\public.sharkfest.local.key' password(only for p12 file) '(null)' ssl_load_key: can't import pem data PEM keyfile *without* passphrase: -----BEGIN RSA PRIVATE KEY----- MIICXgIBAAKBgQDrHdbb+yGE6m6EZ03bXURpZCjch2H6g97ZAkJVGrjLZFfettBA EYa8vYYxWsf8KBpEZeksSCsDA9MnU2H6QDjzqdOnaSWfeXMAr4OsCOpauStpreq7 q1hk8ioqy+f4kijrrhwplh1qw1a8gtsig137pyuhw+wsfwxkwmzjgic1swidaqab AoGBAMneA9U6KIxjb+JUg/99c7h9W6wEvTYHNTXjf6psWA+hpuQ82E65/ZJdszL6... b6qkmh16r5wd6smq+cmhoenqqyt5aiwwl2rir9gbfiptbtbrqw/ecqocx9wfiefo tgssefi72rhk+dpjqri9akea72gdyxrgpfgos3rfq3dbcimbqvdscba4cuu1xj1/ MO93a8v9Vj87/yDm4xsBDsoz2PyBepawHVlIvZ6jDD0aXw== -----END RSA PRIVATE KEY----- PEM keyfile *with* passphrase: -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,F6C218D4FA3C8B66 FR2cnmkkFHH45Dcsty1qDiIUy/uXn+9m/xeQMVRxtiSAmBmnUDUFIFCDDiDc9yif ERok2jPr2BzAazl5RBxS2TY/+7x0/dHD11sF3LnJUoNruo77TERxqgzOI0W1VDRA... ygw5jslxgin18f36e/cep5rkvvyvfepma6isirhfzk1jlauzihvwc7joddf+6rkv ybxrk/bdtdeih+bonyu+zdvjazvz9ghggcw4qhnbodptxrrypkj5nw== -----END RSA PRIVATE KEY----- 62 62

Converting keys Removing passphrase: root@mgmt# openssl rsa -in encrypted.key -out cleartext.key Enter pass phrase for encrypted.key: <passphrase> writing RSA key root@mgmt# Conver4ng from DER to PEM (and removing passphrase): root@mgmt# openssl rsa -inform DER -in der.key -out pem.key Enter pass phrase for encrypted.key: <passphrase> writing RSA key root@mgmt# Conver4ng from PEM to PKCS12 (and adding passphrase): root@mgmt# openssl pkcs12 -in pem.cert -inkey pem.key -export -out cert.pkcs12 Enter Export Password: <new-passphrase> Verifying - Enter Export Password: <new-passphrase> root@mgmt# 63 63

Decryption in Action 64 64

Decrypting IMAPS ssl.keys_list: 192.168.1.20,993,imap,C:\key.pem 65 65

Decrypting "STARTTLS" (1) ssl.keys_list: 66 66

Decrypting "STARTTLS" (2) ssl.keys_list: 192.168.1.20,25,smtp,C:\key.pem 67 67

Decrypting "STARTTLS" (3) ssl.keys_list: 192.168.1.20,start_tls,smtp,C:\key.pem 68 68

Decrypt-problem I (1) ssl_init keys string: 192.168.3.3,443,http,c:\temp\public.sharkfest.local.key ssl_init found host entry 192.168.3.3,443,http,c:\temp\public.sharkfest.local.key ssl_init addr '192.168.3.3' port '443' filename 'c:\temp\public.sharkfest.local.key' password(only for p12 file) '(null)' Private key imported: KeyID B8:2B:EA:B8:F8:BD:62:50:E3:0C:2D:3D:06:09:91:64:... ssl_init private key file c:\temp\public.sharkfest.local.key successfully loaded association_add TCP port 443 protocol http handle 04086228 69 69

Decrypt-problem I (2) Checking ssl debug log: [...] dissect_ssl enter frame #7 (first time) conversation = 07411870, ssl_session = 07411BC8 record: offset = 0, reported_length_remaining = 496 dissect_ssl3_record: content_type 20 dissect_ssl3_change_cipher_spec association_find: TCP port 18774 found 00000000 packet_from_server: is from server - FALSE ssl_change_cipher CLIENT record: offset = 6, reported_length_remaining = 490 dissect_ssl3_record: content_type 22 decrypt_ssl3_record: app_data len 48 ssl, state 0x17 association_find: TCP port 18774 found 00000000 packet_from_server: is from server - FALSE decrypt_ssl3_record: using client decoder decrypt_ssl3_record: no decoder handshake available and up to the current frame. dissect_ssl3_handshake iteration 1 type 39 offset 11 length 7122572 bytes, remaining 59 record: offset = 59, reported_length_remaining = 437 dissect_ssl3_record: content_type 23 decrypt_ssl3_record: app_data len 432 ssl, state 0x17 association_find: TCP port 18774 found 00000000 packet_from_server: is from server - FALSE decrypt_ssl3_record: using client decoder decrypt_ssl3_record: no decoder available association_find: TCP port 18774 found 00000000 association_find: TCP port 443 found 047AF518 [...] Make sure that the whole SSL session (which can be made out of multiple TCP streams) is in the tracefile. Starting with the 70 70

Decrypt-problem II (1) Checking ssl debug log: ssl_association_remove removing TCP 443 - http handle 04086F30 ssl_init keys string: 192.168.3.3,443,http,c:\temp\public.sharkfest.local.key ssl_init found host entry 192.168.3.3,443,http,c:\temp\public.sharkfest.local.key ssl_init addr '192.168.3.3' port '443' filename 'c:\temp\public.sharkfest.local.key' password(only for p12 file) '(null)' Private key imported: KeyID FA:56:73:A4:38:9C:A1:4F:28:23:88:76:83:42:13:86:... ssl_init private key file c:\temp\public.sharkfest.local.key successfully loaded association_add TCP port 443 protocol http handle 04086F30 [...] ssl_decrypt_pre_master_secret:rsa_private_decrypt pcry_private_decrypt: stripping 0 bytes, decr_len zd decrypted_unstrip_pre_master[128]: 6a f7 2a 4b 45 17 72 47 c2 11 d1 dd ad dc af b6 04 76 cb 3c 32 1c d1 01 57 4a 83 79 af d9 40 af aa a8 71 1f bd 6f 70 d5 cc 49 e6 be 44 42 07 7c 45 b7 5b 5b 52 de 3e 58 d3 42 8d 5f bc 99 3e 13 f5 7d 27 a1 3e 7f b2 3f 8b 9d e5 fb 60 ec 40 26 87 8f 24 41 fb d4 ec f7 0e ea 04 46 c2 d7 5f 7b 4a d2 40 47 07 7b 0d 63 d8 d6 0f e6 9e 98 92 02 58 13 51 72 1b 85 69 04 52 42 74 12 40 e2 a5 bb ssl_decrypt_pre_master_secret wrong pre_master_secret length (128, expected 48) dissect_ssl3_handshake can't decrypt pre master secret 71 71

Decrypt-problem II (2) 72 72

Decrypt-problem II (3) In wireshark preferences: ssl.keys_list: 192.168.3.3,443,http,c:\temp\public.sharkfest.local.key Checking whether cereficate and key match: $ openssl x509 -in cert.der -inform DER -noout -text grep "Subject:" Subject: C=NL, ST=Noord-Holland, O=Sharkfest Lab, CN=public.sharkfest.local/ emailaddress=co@sharkfest.local $ $ openssl x509 -noout -modulus -inform DER -in cert.der openssl md5 a29682af822b4cd064d39d4ccd1e0e6c Make sure that the private key matches the (server) certificate $ that is used in the tracefile. $ openssl rsa -noout -modulus -in public.sharkfest.local.key openssl md5 ce71158d3851a885314c264863142389 $ $ openssl rsa -noout -modulus -in private.sharkfest.local.key openssl md5 a29682af822b4cd064d39d4ccd1e0e6c $ 73 73

Decryption Without The Private Key Using the unencrypted (pre-)master-secret First use: Debug version of Firefox/Chrome (see: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4349) Second use: openssl s_client SSL preferences: (Pre)-Master-Secret log filename RSA db00c2aad79cfda1 92cdc769c670ba6f48cfe756992ad435401a26d023590...f360c108df167ca6b6f443f4d2b118de0ccadb8 RSA Session-ID:fbcf322128ed0a0...61523189639f5ba189a Master-Key:bda6ea472f6c39a9fcfd5dc...228eb85744c9bf7cf2 74 74

openssl s_client $ openssl s_client -cipher AES256-SHA -no_ticket -connect imap.syn-bit.nl:993 tee openssl-s_client.txt depth=1 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO High-Assurance Secure Server CA verify error:num=20:unable to get local issuer certificate verify return:0 CONNECTED(00000003) --- [...] SSL-Session: Protocol : TLSv1 Cipher : AES256-SHA Session-ID: 5EF3E7EDCC46993E51935914ACC1CBE6723259121248F958BC223D54FA84CFA0 Session-ID-ctx: Master-Key: 0665121ADB266864CDEF89E32A6F1A39677D540DB5B362BC351D3B08EE3059800F9A218E6601710CE774AFB2CE3166C9 Key-Arg : None PSK identity: None PSK identity hint: None SRP username: None Compression: 1 (zlib compression) Start Time: 1339857082 Timeout : 300 (sec) Verify return code: 20 (unable to get local issuer certificate) --- * OK IMAP4 ready HELP * BAD $ awk invalid '$1~"Session-ID:" command {printf("rsa %s%s ",$1,$2)} $1~"Master-Key:" {printf("%s%s\n",$1,$2)}' openssls_client.txt > openssl-s_client.keys QUIT DONE $ cat openssl-s_client.keys RSA Session-ID:5EF3E7EDCC46993E51935914ACC1CBE6723259121248F958BC223D54FA84CFA0 Master-Key: 0665121ADB266864CDEF89E32A6F1A39677D540DB5B362BC351D3B08EE3059800F9A218E6601710CE774AFB2CE3166C9 $ 75 75

Export SSL Session Keys Export: File -> Export -> SSL Session Keys (1.6.x) File -> Export SSL Session Keys (1.8.x) Import: SSL preferences: (Pre)-Master-Secret log filename Provide SSL decryption in Wireshark to a 3rd party without having to share the private key! 76 76

Agenda Cryptology overview The SSL protocol Analyzing SSL with Wireshark Analyzing SSL with Tshark Common SSL connection problems Further reading Questions & Discussion 77 77

Analyzing SSL with Tshark (1) -V to show whole tree (and decrypted application data) tshark -G fields fgrep "ssl." tshark -R ssl.alert_message tshark -G currentprefs egrep "^#?ssl." tshark -o ssl.keys_list:<ip>,<port>,<proto>,<keyfile> \ -o ssl.debug_file:<log-file> 78 78

Analyzing SSL with Tshark (2) tshark -r file.cap -o ssl.keys_list:192.168.3.3,443,http,"c:\key.pem" \ -o ssl.debug_file:"c:\ssl-debug.log" -V -R http $ tshark -o ssl.keys_list:192.168.3.3,443,http,"c:\tmp.key" \ -r session-reuse.cap -R ssl.alert_message $ 17 27.530927 192.168.3.3 -> 192.168.3.1 TLSv1 Alert (Level: Warning, Description: Close Notify) 20 32.811207 192.168.3.1 -> 192.168.3.3 TLSv1 Alert (Level: Warning, Description: Close Notify) 32 54.756406 192.168.3.3 -> 192.168.3.1 TLSv1 Alert (Level: Warning, Description: Close Notify) 35 62.809496 192.168.3.1 -> 192.168.3.3 TLSv1 Alert (Level: Warning, Description: Close Notify) 51 126.272833 192.168.3.3 -> 192.168.3.1 TLSv1 Alert (Level: Warning, Description: Close Notify) 54 137.815000 192.168.3.1 -> 192.168.3.3 TLSv1 Alert (Level: Warning, Description: Close Notify) 79 79

Agenda Cryptology overview The SSL protocol Analyzing SSL with Wireshark Analyzing SSL with Tshark Common SSL connection problems Further reading Questions & Discussion 80 80

Common SSL problems I (1) 81 81

Common SSL problems I (2) In apache2: SSLCipherSuite The client and the server have no SSL version in common or there is no cipher that both client and server support. RC4+RSA Reconfigure SSLCipherSuite and/or SSLProtocol on the server or adjust the SSL settings on the client. In apache2: SSLProtocol TLSv1 82 82

Common SSL problems II The client can not validate the certificate as it is not signed by one of the trusted CA's. Configure Intermediate CA in Apache2 with "SSLCertificateChainFile <ca-file>". 83 83

Common SSL problems III (1) The client can not validate the certificate as it is expired. Renew the certificate and attach it to the server. 84 84

Common SSL problems III (2) The client can not validate the certificate as it's clock is not set correctly. Set the correct time on the client. 85 85

Common SSL problems IV The client can not validate the certificate as the common name in the certificate does not match the hostname. Make sure the site you are trying to visit is indeed the site you intended to visit. 86 86

Common SSL problems V (1) 87 87

Common SSL problems V (2) The server can not validate the client certificate as it does not have the Root CA configured. Add the Root Ca to the certificate bundle that is pointed to by "SSLCACertificateFile <trusted-ca-bundle>". [Thu May 21 10:29:45 2009] [error] Certificate Verification: Error (2): unable to get issuer certificate 88 88

Common SSL problems VI The server can not validate the client certificate as the CA chain used is larger than the allowed depth. Configure the correct CA verify depth in Apache2 with "SSLCertificateChainFile <ca-file>". [Thu May 21 10:38:30 2009] [error] Certificate Verification: Certificate Chain too long (chain has 2 certificates, but maximum allowed are only 1) 89 89

Common SSL problems VII The client did not send a certificate as it could not find one that was signed by the presented CA's. Make sure the client has the Intermediate CA in it's certificate store, so it can find a matching certificate. 90 90

Common SSL problems VIII The server rejected the client certificate because it has been revoked by the signing CA. The client needs to request a new certificate. [Thu May 21 10:57:57 2009] [error] Certificate Verification: Error (23): certificate revoked 91 91

Common SSL problems IX The CRL file on the server is expired. This results in revoking all certificates until the CRL is updated. Make sure the CRL file pointed to by "SSLCARevocationFile <crlfile>" stays up to date. [Thu May 21 11:01:15 2009] [warn] Found CRL is expired - revoking all certificates until you get updated CRL [Thu May 21 11:01:15 2009] [error] Certificate Verification: Error (12): CRL has expired 92 92

Agenda Cryptology overview The SSL protocol Analyzing SSL with Wireshark Analyzing SSL with Tshark Common SSL connection problems Further reading Questions & Discussion 93 93

Further Reading about SSL SSL and TLS: Designing and Building Secure Systems by Eric Rescorla SSL and TLS Essentials: Securing the Web by Stephen A. Thomas 94 94

Questions & Discussion?????????????? 95 95

FIN/ACK, ACK, FIN/ACK, ACK! Thank You! If you would like to receive the tracefiles (and keys!) that I used, please mail me: sake.blok@syn-bit.nl 96 96