Skip to content

Instantly share code, notes, and snippets.

@kush789
Last active May 25, 2021 19:24
Show Gist options
  • Save kush789/3e1ce7901591225d7e7b4d89935ceaf0 to your computer and use it in GitHub Desktop.
Save kush789/3e1ce7901591225d7e7b4d89935ceaf0 to your computer and use it in GitHub Desktop.
Using OpenSSL, we attempt to establish a TLS 1.3 connection with 216.58.196.174, corresponding to google.com. However, instead of specifying 'google.com' in the SNI, we specify a potentially blocked website '1337x.be' and an unblocked website 'facebook.com'.
openssl s_client -state -connect 216.58.196.174:443 -servername 1337x.be -tls1_3
SSL_connect:before SSL initialization
SSL_connect:SSLv3/TLS write client hello
SSL_connect:SSLv3/TLS write client hello
SSL_connect:SSLv3/TLS read server hello
SSL_connect:TLSv1.3 read encrypted extensions
depth=2 OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
verify return:1
depth=1 C = US, O = Google Trust Services, CN = GTS CA 1O1
verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google LLC, CN = *.google.com
verify return:1
SSL_connect:SSLv3/TLS read server certificate
SSL_connect:TLSv1.3 read server certificate verify
SSL_connect:SSLv3/TLS read finished
SSL_connect:SSLv3/TLS write change cipher spec
SSL_connect:SSLv3/TLS write finished
CONNECTED(00000003)
---
Certificate chain
0 s:C = US, ST = California, L = Mountain View, O = Google LLC, CN = *.google.com
i:C = US, O = Google Trust Services, CN = GTS CA 1O1
1 s:C = US, O = Google Trust Services, CN = GTS CA 1O1
i:OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIKEDCCCPigAwIBAgIRAI8EyckMA1DNCAAAAAAU+9IwDQYJKoZIhvcNAQELBQAw
QjELMAkGA1UEBhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnVzdCBTZXJ2aWNlczET
MBEGA1UEAxMKR1RTIENBIDFPMTAeFw0xOTA5MTcxMzMyNTNaFw0xOTEyMTAxMzMy
NTNaMGYxCzAJBgNVBAYTAlVTM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qLndmrSuynOshIiPHoyu2YFJPz4bjN7qGBIN9Iv3jl11S
-----END CERTIFICATE-----
subject=C = US, ST = California, L = Mountain View, O = Google LLC, CN = *.google.com
issuer=C = US, O = Google Trust Services, CN = GTS CA 1O1
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 4177 bytes and written 312 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
read:errno=0
SSL3 alert write:warning:close notify
openssl s_client -state -connect 216.58.196.174:443 -servername facebook.com -tls1_3
CONNECTED(00000003)
SSL_connect:before SSL initialization
SSL_connect:SSLv3/TLS write client hello
SSL_connect:SSLv3/TLS write client hello
SSL_connect:SSLv3/TLS read server hello
SSL_connect:TLSv1.3 read encrypted extensions
depth=2 OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
verify return:1
depth=1 C = US, O = Google Trust Services, CN = GTS CA 1O1
verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google LLC, CN = *.google.com
verify return:1
SSL_connect:SSLv3/TLS read server certificate
SSL_connect:TLSv1.3 read server certificate verify
SSL_connect:SSLv3/TLS read finished
SSL_connect:SSLv3/TLS write change cipher spec
SSL_connect:SSLv3/TLS write finished
---
Certificate chain
0 s:C = US, ST = California, L = Mountain View, O = Google LLC, CN = *.google.com
i:C = US, O = Google Trust Services, CN = GTS CA 1O1
1 s:C = US, O = Google Trust Services, CN = GTS CA 1O1
i:OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIKEDCCCPigAwIBAgIRAN3ZBLChBcJ1AgAAAABH2HowDQYJKoZIhvcNAQELBQAw
QjELMAkGA1UEBhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnV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k6rS/6INanr64Ld3BlBFlkp+aHeWsyEZn
6iTqD0TkudalliEgMWCJT7v9dYxnfXmJcFZ6Ui1ynPkNAhsSWA+ACgG75vq+5XDo
U1ub9YTMJPtH2xf11jRcsNLOuLN1T2se30hRpayL4Is8mVKd
-----END CERTIFICATE-----
subject=C = US, ST = California, L = Mountain View, O = Google LLC, CN = *.google.com
issuer=C = US, O = Google Trust Services, CN = GTS CA 1O1
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 4177 bytes and written 316 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
Q
DONE
SSL3 alert write:warning:close notify
@kush789
Copy link
Author

kush789 commented Nov 7, 2019

The TCP RST comes after the ServerHello.

I do agree with you, it is strange for the censor to adopt such behaviour. I don't think it has been documented before in any context

@gurshabad
Copy link

@fortuna As Kush said, the TCP RST comes after the ServerHello. Just wanted to add that this is also one of the reasons why we used TLS 1.3 (in older versions, they could be relying on the server cert, in which case they would need to wait for the ServerHello).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment