ssl_association_remove removing TCP 443 - http handle 0000000003D911A0
Private key imported: KeyID 52:53:3d:d3:ce:ce:cd:2e:29:ab:0b:c8:0b:ca:78:ba:...
ssl_init IPv4 addr 'IPaddressofmyserver' (IPaddressofmyserver) port '443' filename 'c:\\BckUP\\server.pem' password(only for p12 file) ''
ssl_init private key file c:\\BckUP\\server.pem successfully loaded.
association_add TCP port 443 protocol http handle 0000000003D911A0
dissect_ssl enter frame #3 (first time)
ssl_session_init: initializing ptr 0000000005871BC0 size 680
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 141
packet_from_server: is from server - FALSE
ssl_find_private_key server IPaddressofmyserver:443
client random len: 16 padded to 32
dissect_ssl2_hnd_client_hello found CLIENT RANDOM -> state 0x01
dissect_ssl enter frame #9 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 267
dissect_ssl3_record found version 0x0301 -> state 0x11
dissect_ssl3_record: content_type 22
decrypt_ssl3_record: app_data len 262, ssl state 0x11
packet_from_server: is from server - FALSE
decrypt_ssl3_record: using client decoder
decrypt_ssl3_record: no decoder available
dissect_ssl3_handshake iteration 1 type 16 offset 5 length 258 bytes, remaining 267
ssl_decrypt_pre_master_secret key exchange 0 different from KEX_RSA (16)
dissect_ssl3_handshake can't decrypt pre master secret
dissect_ssl enter frame #10 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 6
dissect_ssl3_record: content_type 20
dissect_ssl3_change_cipher_spec
packet_from_server: is from server - FALSE
ssl_change_cipher CLIENT
dissect_ssl enter frame #11 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 37
dissect_ssl3_record: content_type 22
decrypt_ssl3_record: app_data len 32, ssl state 0x11
packet_from_server: is from server - FALSE
decrypt_ssl3_record: using client decoder
decrypt_ssl3_record: no decoder available
dissect_ssl3_handshake iteration 1 type 187 offset 5 length 4019139 bytes, remaining 37
dissect_ssl enter frame #13 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 340
dissect_ssl3_record: content_type 23
decrypt_ssl3_record: app_data len 335, ssl state 0x11
packet_from_server: is from server - FALSE
decrypt_ssl3_record: using client decoder
decrypt_ssl3_record: no decoder available
association_find: TCP port 31891 found 0000000000000000
association_find: TCP port 443 found 00000000057ABA10
dissect_ssl enter frame #14 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 1448
dissect_ssl3_record: content_type 23
decrypt_ssl3_record: app_data len 1565, ssl state 0x11
packet_from_server: is from server - FALSE
decrypt_ssl3_record: using client decoder
dissect_ssl enter frame #15 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 122
dissect_ssl enter frame #16 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 29
dissect_ssl3_record: content_type 23
decrypt_ssl3_record: app_data len 24, ssl state 0x11
packet_from_server: is from server - FALSE
decrypt_ssl3_record: using client decoder
decrypt_ssl3_record: no decoder available
association_find: TCP port 31891 found 0000000000000000
association_find: TCP port 443 found 00000000057ABA10
dissect_ssl enter frame #19 (first time)
conversation = 0000000005871880, ssl_session = 0000000005871BC0
record: offset = 0, reported_length_remaining = 23
dissect_ssl3_record: content_type 21
decrypt_ssl3_record: app_data len 18, ssl state 0x11
packet_from_server: is from server - FALSE
decrypt_ssl3_record: using client decoder
decrypt_ssl3_record: no decoder available
dissect_ssl enter frame #11 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 37
dissect_ssl3_record: content_type 22
dissect_ssl3_handshake iteration 1 type 187 offset 5 length 4019139 bytes, remaining 37
dissect_ssl enter frame #13 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 340
dissect_ssl3_record: content_type 23
association_find: TCP port 31891 found 0000000000000000
association_find: TCP port 443 found 00000000057ABA10
dissect_ssl enter frame #14 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 1448
dissect_ssl enter frame #15 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 122
dissect_ssl enter frame #16 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 29
dissect_ssl3_record: content_type 23
association_find: TCP port 31891 found 0000000000000000
association_find: TCP port 443 found 00000000057ABA10
dissect_ssl enter frame #19 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 23
dissect_ssl3_record: content_type 21
dissect_ssl enter frame #10 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 6
dissect_ssl3_record: content_type 20
dissect_ssl3_change_cipher_spec
dissect_ssl enter frame #9 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 267
dissect_ssl3_record: content_type 22
dissect_ssl3_handshake iteration 1 type 16 offset 5 length 258 bytes, remaining 267
dissect_ssl enter frame #3 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 141
dissect_ssl enter frame #11 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 37
dissect_ssl3_record: content_type 22
dissect_ssl3_handshake iteration 1 type 187 offset 5 length 4019139 bytes, remaining 37
dissect_ssl enter frame #11 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 37
dissect_ssl3_record: content_type 22
dissect_ssl3_handshake iteration 1 type 187 offset 5 length 4019139 bytes, remaining 37
dissect_ssl enter frame #11 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 37
dissect_ssl3_record: content_type 22
dissect_ssl3_handshake iteration 1 type 187 offset 5 length 4019139 bytes, remaining 37
dissect_ssl enter frame #9 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 267
dissect_ssl3_record: content_type 22
dissect_ssl3_handshake iteration 1 type 16 offset 5 length 258 bytes, remaining 267
dissect_ssl enter frame #11 (already visited)
conversation = 0000000005871880, ssl_session = 0000000000000000
record: offset = 0, reported_length_remaining = 37
dissect_ssl3_record: content_type 22
dissect_ssl3_handshake iteration 1 type 187 offset 5 length 4019139 bytes, remaining 37
No ,as you said i didn't captured both sides conversation.So do i need to capture conversation from both sides,if i do that ,how can we merge the two log files?Can you kindly let me?
'IPaddressofmyserver' is modifed by me..
To decrypt SSL, Wireshark needs to see both sides of the conversation, that is packets from both the client and the server from the start of the conversation.
You can try using mergecap to merge the two captures. See the manual page here and info from the documentation here
Maybe "sides" is a bit misleading. You need both flows (client->server and server->cient) of the TCP session in the trace.
It is OK to capture only on one location (at the client, at the server or somewhere in between).
currently i am capturing at one location atclient..i used a command called tcpflow and captured the conversation in a .log file.Is there any command line option to do the same in wireshark ?Also after decode of the SSL, will i be albe to see/capture the atual payload(soap xml in my case) that is getting exchanged between the client and server ?
Yes, in Wireshark you can use "Follow SSL stream" to get a dump of the decrypted data from the SSL session.
You might be able to reconstruct the whole ssl session by merging two matching flows saved by tcpflow. When you loaded x.x.x.x:a->y.y.y.y:443, you can merge with:
(or something like that, I don't know how tcpflow names the individual files for each flow)
ok..i am aware of Follow ssl stream(GUI option)..but i wanted to know the command line..please let me know if we have command line option for the same..wat i want is to decode ssl messges(live) and write to a file..
Hi, I used the tshark command mentioned below and opened the log(vik24_01.log ) using wireshark in GUI.and when i click on Follow SSL stream,new window that comes up is blank and says conversation bytes zero.
tshark -o "ssl.desegment_ssl_records: TRUE" -o "ssl.desegment_ssl_application_data: TRUE" -o "ssl.keys_list: MYSERVERIP,443,http,server.pem" -o "ssl.debug_file: wireshark01.log" -i eth1 -R "tcp.port == 443" -w vik24_01.log
unable to understand why i am not able to see decrypted (should be a XML message in my case) message.
I see the below output in ssl debug file..it looks like this time..tshark is able to decode the ssl..but still i see the data in some hexdecimal formart (it should be xml in my case after decode) eg:- pre master encrypted[256]: 65 8c f3 c2 07 7f ba dc 36 e9 b6 ab ce 37 85 9a not sure if the above is the data the is decrypted and exchanged between the applications ?
From your log:
ssl_decrypt_pre_master_secret wrong pre_master_secret length (222, expected 48) dissect_ssl3_handshake can’t decrypt pre master secret
There’s still something wrong, hence the lack of decryption.
The log message “ssl_decrypt_pre_master_secret wrong pre_master_secret length (222, expected 48)” usually indicates that the private key does not match the certificate. Although recently I have seen it also happening with a specific version of the GnuTLS library. Which Wireshark version are you using and which library versions (see “About Wireshark”)
1.) please post the new debug file.
2.) did you capture the WHOLE frame? This is only important if you did not capture with tshark/wireshark. Other sniffers might limit the packet size to 60-100 byte per default. If you don’t change that, you’ll be unable to decrypt SSL. For tcpdump use -s0.
3.) Is the given private key encrypted? Look for lines with the string “ENCRYPTED” in the pem file.
4.) Just by chance: Can you please verify that your SSL connection is NOT using any DH (Diffie Hellman) algorithms - look for DH or DHE in the cipher suite name (Cipher Suites in Server HELO). If DH is used, there is no (known) way to decrypt the session.
Regards
Kurt
Hi Kurt, Please find my asnwers as below
1) debug file
2) I used tshark.
3) Private key is not encrypted
4) I see only one Cipher suite used for “server hello” and it is
TLS_RSA_WITH_RC4_128_MD5
i am still having the issue with decoding ..in the debug file i see a message “ssl_decrypt_pre_master_secret wrong pre_master_secret length (256, expected 48) dissect_ssl3_handshake can’t decrypt pre master secret”
“decrypt_ssl3_record: using server decoder decrypt_ssl3_record: no decoder available”
Does this message means i am using a wrong private key ?To the best of my knowledge i am using the correct key.
Hi SYN-bit, I am sorry didn’t saw your comment on my issue.I am using Version 1.6.7 (SVN Rev 41973 from /trunk-1.6 of wireshark
Please find my About Wireshark as below
Version 1.6.7 (SVN Rev 41973 from /trunk-1.6) Compiled (64-bit) with GTK+ 2.22.1, with GLib 2.26.1, with WinPcap (version unknown), with libz 1.2.5, without POSIX capabilities, without libpcre, without SMI, with c-ares 1.7.1, with Lua 5.1, without Python, with GnuTLS 2.12.18, with Gcrypt 1.4.6, without Kerberos, with GeoIP, with PortAudio V19-devel (built Apr 6 2012), with AirPcap.version 4.1.0.2001), based on libpcap version 1.0 branch 1_0_rel0b (20091008), GnuTLS 2.12.18, Gcrypt 1.4.6, without AirPcap
Running on 64-bit Windows 7, build 7600, with WinPcap version 4.1.2 (packet.dll
I did some testing. Whenever the key does not match the certificate, I get exactly the same error message (see also comment of SYN-bit). However in my case: WinXP SP3 32-Bit.
Please check your key. How did you get (export) the key?
Also when we run the tshark command ,do we need to provide the private keys of both client and server ?
unless you are using client certificates, there is no client private key.
BTW: does the server request a client cert?
And even if you are using client certificates, you only need the server private key for decryption.
Hi SYN-bit ..can you please verify the details of the verision of wireshark and GnuTLS library that i am using..I have posted the details of the versions in the previous comments ..please let me know if the issue is with the version’s i am using? Also i have two private keys in the jks keystore at the client side and i tried using both of them for decrypting in the tshark command.I am unable to export the server side private key,unfortunatley i don’t remember the password of the p12 wallet file at the server side.
You must use the server key for decrypting, that is a basic part of ssl.
If i am not wrong we import the server key into the client keystore as well,as part of enabling SSL between client and server?In our scenario we raised a CSR request and got the digital signed certificates and then we imported them into the client keystore as well.
Well, I don’t have a compatability list, but if you use a Wireshark version downloaded from www.wireshark.org, you should be fine.
When you create a CSR and let the server sign it, the you don’t import the servers private key, you import a certificate which has been signed by the servers private key.
If you say “I am unable to export the server side private key,unfortunatley i don’t remember the password of the p12 wallet file at the server side”, you clearly state where your problem lies… You need this key.
so ..at the client side ..do we import the certificates which has been signed by the third party or do we export the private key of server and import it at the client side server ? If my dought is correct and we import the server private key at the client side application server then what i have been using till these will be the correct key(in the tshark command)
Let’s make things easier… forget about whether or not you are using client certificates, they don’t play a role in SSL decryption.
When you captured SSL traffic that you want to decrypt, there are TCP sessions initiated by the client with as destination the server. This server presents a certificate back to the client in the TCP session. This certificate corresponds to a private key on the server. It is this private key on the server that you will need to use in wireshark to decrypt the session.
Where the key resides on the server can be found in the configuration of the (web)server.
if it’s a windows HTTP server, go to the server and open certmgr. Select the certificate and export it. If the private key is “exportable”, select the option to include the private key. The resulting pcks#12 file will contain the cert and the private key. Use openssl to extract the private key.
if it’s a webserver on unix, the private key will be located in a file (PEM/PKCS#12). In case of an encrypted PEM or a PKCS#12, the ‘passphrase’ to open that file must be part of the webserver configuration. Find that passphrase and decrypt the key.
Use the decrypted key (or PCKS#12) in wireshark!
Hi, At the client it is weblogic,and i used keytool commands and found there are two private keys in the keystore(jks file),Which i thoguht one of them to be the server private key (server side it is oracle app server p12 wallet file).SYN-bit please validate my statement “when we enable SSL between two server’s,Server private key will not be imported at the client application server” .If this is correct then i need to find a way to get the private key from the server side wallet file(since i dont remember the password).
there is no reason to import the server key at the ‘client’ and apparently the key you are using in wireshark is not the right one. BTW: Have you tried to use ONLY the key, you believe to be the server key, in wirehark? If that all does not help, you’ll need the passphrase for the p12 file of the oracle app server. The admin of that server should have the passphrase.
yes..i used the private key..which i belived was the servers private key.with tshark and the output of the debug file i have posted..above..
O.K. then it’s the wrong key. Get the p12 file and the passphrase from the oracle wallet.
Hi all, I am able to decrypt the ssl ,after i regenerated the certificates and used the servers private key. I am intrested in reading the xml payload and writing it to file(planing to use a java code) .In the ssl debug file generated by the tshark i can see the payload ,however the problem here that payload is broken into parts ,which is making it difficult to read and get the full payload with out decryption related. So is there any way to read only the payload from the catptured ssl dump file or ssl debug file using tshark or any other command line tool?