Масштабируя TLS / Артём Гавриченков (Qrator Labs)

76
Масштабируя TLS Артём Гавриченков <[email protected]>

Transcript of Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Page 1: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Масштабируя TLSАртём Гавриченков <[email protected]>

Page 2: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Краткая история нового времени• 2010: SPDY w/de-facto mandatory* SSL/TLS

• 2014: “HTTPS as a ranking signal” at Google

• 2015: HTTP/2 w/de-facto mandatory* TLS

• 2016: Let’s Encrypt

* – https://forum.nginx.org/read.php?21,236132,236184

* – https://daniel.haxx.se/blog/2015/03/06/tls-in-http2/

Page 3: Масштабируя TLS / Артём Гавриченков (Qrator Labs)
Page 4: Масштабируя TLS / Артём Гавриченков (Qrator Labs)
Page 5: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Краткая история нового времени• 2010: SPDY w/de-facto mandatory* SSL/TLS

• 2014: “HTTPS as a ranking signal” at Google

• 2015: HTTP/2 w/de-facto mandatory* TLS

• 2016: Let’s Encrypt

* – https://forum.nginx.org/read.php?21,236132,236184

* – https://daniel.haxx.se/blog/2015/03/06/tls-in-http2/

Page 6: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Краткая история нового времени• 2010: SPDY w/de-facto mandatory* SSL/TLS• 2013: NSA story• 2014: “HTTPS as a ranking signal” at Google• 2014:• 2015: HTTP/2 w/de-facto mandatory* TLS• 2015:• 2016: Let’s Encrypt• 2016:

* – https://forum.nginx.org/read.php?21,236132,236184

* – https://daniel.haxx.se/blog/2015/03/06/tls-in-http2/

Page 7: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Краткая история нового времени• 2010: SPDY w/de-facto mandatory* SSL/TLS• 2013: NSA story• 2014: “HTTPS as a ranking signal” at Google• 2014: Heartbleed, POODLE

• 2015: HTTP/2 w/de-facto mandatory* TLS• 2015: RFC 7457

• 2016: Let’s Encrypt

* – https://forum.nginx.org/read.php?21,236132,236184

* – https://daniel.haxx.se/blog/2015/03/06/tls-in-http2/

Page 8: Масштабируя TLS / Артём Гавриченков (Qrator Labs)
Page 9: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Краткая история нового времени• 2010: SPDY w/de-facto mandatory* SSL/TLS• 2013: NSA story• 2014: “HTTPS as a ranking signal” at Google• 2014: Heartbleed, POODLE

• 2015: HTTP/2 w/de-facto mandatory* TLS• 2015: RFC 7457

• 2016: Let’s Encrypt

* – https://forum.nginx.org/read.php?21,236132,236184

* – https://daniel.haxx.se/blog/2015/03/06/tls-in-http2/

Page 10: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Краткая история нового времени• 2010: SPDY w/de-facto mandatory* SSL/TLS• 2013: NSA story• 2014: “HTTPS as a ranking signal” at Google• 2014: Heartbleed, POODLE

• 2015: HTTP/2 w/de-facto mandatory* TLS• 2015: RFC 7457, FREAK, Logjam

• 2016: Let’s Encrypt• 2016: DROWN

* – https://forum.nginx.org/read.php?21,236132,236184

* – https://daniel.haxx.se/blog/2015/03/06/tls-in-http2/

Page 11: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

SSL/TLS PKI• Root certificate authorities, trust chain

Page 12: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

SSL/TLS PKI• Root certificate authorities, trust chain• 92 CAs in Firefox

Page 13: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

SSL/TLS PKI• Root certificate authorities, trust chain• Trusted, because they make it for living• Independent from large corporations, government, etc.

Page 14: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

SSL/TLS PKI• Root certificate authorities, trust chain• Trusted, because they make it for living• Independent from large corporations, government, etc.

Except, some of them ARE government

Page 15: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

SSL/TLS PKI• Root certificate authorities, trust chain• Trusted, because they make it for living• Independent from large corporations, government, etc.

And some of them are large corporationsExcept, some of them ARE government

Page 16: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

SSL/TLS PKI• Root certificate authorities, trust chain• Trusted, because they make it for living• Independent from large corporations, government, etc.• Pursuing their interests as trusted third parties

Page 17: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

SSL/TLS PKI• Root certificate authorities, trust chain• Trusted, because they make it for living• Independent from large corporations, government, etc.• Pursuing their interests as trusted third parties• Corporations and government always tend to elevate their own interests

Page 18: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSign• Trusted since 2009• Aggressive marketing and free certificates• Passed audit by Ernst&Young

Page 19: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner

Page 20: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner• Allowed using non-privileged ports (>50,000) to verify domain control

Page 21: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner• Allowed using non-privileged ports (>50,000) to verify domain control• Allowed using subdomains to verify 2nd level domain

Page 22: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner• Allowed using non-privileged ports (>50,000) to verify domain control• Allowed using subdomains to verify 2nd level domain• Allowed using arbitrary files to verify ownership

Page 23: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner• Allowed using non-privileged ports (>50,000) to verify domain control• Allowed using subdomains to verify 2nd level domain• Allowed using arbitrary files to verify ownership• Allowed to issue certificates for arbitrary domains without verification

Page 24: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner• Allowed using non-privileged ports (>50,000) to verify domain control• Allowed using subdomains to verify 2nd level domain• Allowed using arbitrary files to verify ownership• Allowed to issue certificates for arbitrary domains without verification• Issued backdated SHA-1 certificates

Page 25: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner• Allowed using non-privileged ports (>50,000) to verify domain control• Allowed using subdomains to verify 2nd level domain• Allowed using arbitrary files to verify ownership• Allowed to issue certificates for arbitrary domains without verification• Issued backdated SHA-1 certificates• Used unpatched software (such as dig) on the validation server

Page 26: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignhttps://wiki.mozilla.org/CA:WoSign_Issues• Issued certificates not requested by domain owner• Allowed using non-privileged ports (>50,000) to verify domain control• Allowed using subdomains to verify 2nd level domain• Allowed using arbitrary files to verify ownership• Allowed to issue certificates for arbitrary domains without verification• Issued backdated SHA-1 certificates• Used unpatched software (such as dig) on the validation server• Purchased other CA (StartCom) and attempted to suppress

information about the ownership transfer

Page 27: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignThe aftermath?

Page 28: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignThe aftermath?• Banned by Google in Chrome• Banned by Mozilla for a year

Page 29: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of WoSignThe aftermath?• Banned by Google in Chrome• Banned by Mozilla for a year• Still trusted by Microsoft

and lots of unpatched equipment

Page 30: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Aftermath• Go and choose the cheapest CA available• Bonus points if it provides some kind of API

Page 31: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Aftermath• Go and choose the cheapest CA available• Bonus points if it provides some kind of API• Pick multiple CAs

Page 32: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Aftermath• Go and choose the cheapest CA available• Bonus points if it provides some kind of API• Pick multiple CAs• “Extended validity” certificates?

Page 33: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Aftermath• Go and choose the cheapest CA available• Bonus points if it provides some kind of API• Pick multiple CAs• “Extended validity” certificates are a security theater

(don’t bother if you are not a bank and auditor doesn’t force you to)

Page 34: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Aftermath• Go and choose the cheapest CA available• Bonus points if it provides some kind of API• Pick multiple CAs• “Extended validity” certificates are a security theater

(don’t bother if you are not a bank and auditor doesn’t force you to)• Prefer short-lived certificates

Page 35: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Long-living certificates?Pros:• Discount• Less pain in the #^$ updating all the certs

Page 36: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Long-living certificates?Pros:• Discount• Less pain in the #^$ updating all the certs

Cons:• Soft-fail CRL and OCSP are not reliable• Hard-fail CRL and OCSP are never used

(you may do it in your app though)• Certificate deployment and management must be automated anyway

Page 37: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Long-living certificates?• CRL and OCSP are not reliable• Certificate deployment and management must be automated

Long-lived cert is a technical debt. It wouldn’t punish you immediately.It will hurt you eventually.

Page 38: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Automated certificate management• Add, remove, change and revoke your certificates real quick• Manage certificates properly: short lifetime, multiple keys• Set up a clientside TLS auth

Page 39: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Automated certificate management• Add, remove, change and revoke your certificates real quick• Manage certificates properly: short lifetime, multiple keys• Set up a clientside TLS auth• Quickly work around obscure issues like “Intermediate CA was

revoked”

Page 40: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of GlobalSign• During a planned maintenance, accidentally revoked its own certificate• Used CDN (Cloudflare) for CRL and OCSP• Undid revocation, but it’s got cached on CDN

Page 41: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of GlobalSign• During a planned maintenance, accidentally revoked its own certificate• Used CDN (Cloudflare) for CRL and OCSP• Undid revocation, but it’s got cached on CDN

• Four days before cached response will expire in a browser• Wikipedia, Dropbox, Spotify, Financial Times affected• Large sites affected more because CRL got cached everywhere

immediately

Page 42: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of GlobalSign• Large sites affected more because CRL got cached everywhere

immediately• “All is good and yet traffic dropped by 30%”• Really hard to troubleshoot• The issue is of distributed nature• You depend on a vendor

Page 43: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of GlobalSign• Large sites affected more because CRL got cached everywhere

immediately• “All is good and yet traffic dropped by 30%”• Really hard to troubleshoot• The issue is of distributed nature• You depend on a vendor

• Multiple different certs from different vendors helped to track down• tcpdump also of a great help: sessions got stuck at TLS Server Hello

Page 44: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of GlobalSign• Really hard to troubleshoot• The issue is of distributed nature• You depend on a vendor

• Multiple different certs from different vendors will help to track down• tcpdump also of a great help: sessions got stuck at TLS Server Hello

TLS is still bleeding edge of technology.Unsufficient tools, unsufficient knowledge.

Page 45: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of GlobalSign• Really hard to troubleshoot• So, hours wasted before the root cause is found• The fix must be immediate => cert management automation!

Page 46: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Automated certificate management• CA with API

Page 47: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Automated certificate management• CA with API• Let’s Encrypt?

Page 48: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Automated certificate management• CA with API• Let’s Encrypt?

Very good if you don’t need wildcard certificates.

Page 49: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Automated certificate management• CA with API• Let’s Encrypt?

Very good if you don’t need wildcard certificates.

• Tools like SSLMate• In-house plugins for ansible etc.

Page 50: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

What to set up during the deployment?

Page 51: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

What to set up during the deployment?• Strict Transport Security• “Opportunistic encryption” simply doesn’t work• Most users won’t notice if HTTPS is absent• HTTPS only makes sense if it’s enforced

Page 52: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

What to set up during the deployment?• Strict Transport Security• “Opportunistic encryption” simply doesn’t work• Most users won’t notice if HTTPS is absent• HTTPS only makes sense if it’s enforced

• Public Key Pinning• Pin all end-entity public keys• Create a backup• Include future leafs• Rotate often => use automated tools to generate the header

Page 53: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

What to set up during the deployment?• Ciphers• https://wiki.mozilla.org/Security/TLS_Configurations

Page 54: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

What to set up during the deployment?• Ciphers• https://wiki.mozilla.org/Security/TLS_Configurations outdated• https://mozilla.github.io/server-side-tls/ssl-config-generator/• Update frequently (automation?)

Page 55: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

What to set up during the deployment?• Ciphers• https://wiki.mozilla.org/Security/TLS_Configurations outdated• https://mozilla.github.io/server-side-tls/ssl-config-generator/• Update frequently (automation?)

Page 56: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Rijndael

Page 57: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Rijndael(finally it sounds almost like Tolkien)

Page 58: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Rijndael/AES• Ordered by U.S. federal government• Approved by NSA, 1998-2001• Adopted by U.S. DoD and Army

Page 59: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Rijndael/AES• Adopted by U.S. DoD and Army• Military required three distinct security levels,

with less sensitive data to be encrypted using the most weak method and vice versa

Page 60: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Rijndael/AES• Adopted by U.S. DoD and Army• Military required three distinct security levels,

with less sensitive data to be encrypted using the most weak method and vice versa• Crypto designers implemented three key sizes (128, 192, 256),

with the most weak still unbreakable in foreseeable future(except quantum computers)

Page 61: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Rijndael/AES• Adopted by U.S. DoD and Army• Military required three distinct security levels,

with less sensitive data to be encrypted using the most weak method and vice versa• Crypto designers implemented three key sizes (128, 192, 256),

with the most weak still unbreakable in foreseeable future(except quantum computers)• So, AES-128 is still good enough• Not that it matters much with modern AES-NI

Page 62: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Perfect Forward Secrecy• Present in ephemeral Diffie-Hellman ciphers

Page 63: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Perfect Forward Secrecy• Present in ephemeral Diffie-Hellman ciphers• Makes out-of-path analysis impossible• Makes historic data analysis impossible

Page 64: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

The story of Perfect Forward Secrecy• Present in ephemeral Diffie-Hellman ciphers• Makes out-of-path analysis impossible• Makes historic data analysis impossible• Good catch for an out-of-path DPI and/or WAF

70% HTTPS requests come and go without analysis

Page 65: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

• Present in ephemeral Diffie-Hellman ciphers• Makes out-of-path analysis impossible• Makes historic data analysis impossible• Good catch for an out-of-path DPI and/or WAF

70% HTTP requests go without analysis

The story of Perfect Forward Secrecy

60% legitimate90% malicious

Page 66: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Protocols

Page 67: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Protocols• SSLv2 is dead

Page 68: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Protocols• SSLv2 is dead• SSLv3 is dead*• TLSv1.0 is dead

* – if you don’t have to serve content to IE6 or a TV set

Page 69: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Protocols• SSLv2 is dead• SSLv3 is dead*• TLSv1.0 is dead• TLS is alive and growing

* – if you don’t have to serve content to IE6 or a TV set

Page 70: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Protocols• SSLv2 is dead• SSLv3 is dead*• TLSv1.0 is dead• TLS is alive and growing• Maybe too fast: TLSv1.2 allowed DDoSCoin

* – if you don’t have to serve content to IE6 or a TV set

Page 71: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Misc• OCSP stapling• Persistent connections (TLS handshake is expensive)• Fight unencrypted content!

Page 72: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Sound Bytes• Use short-lived certificates!• Automate!• Trust Mozilla! :-)

Page 73: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Q&Amailto: [email protected]

Page 74: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Bonus track• Client certificates

Page 75: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Bonus track• Client certificates• May be combined with 2FA

Page 76: Масштабируя TLS / Артём Гавриченков (Qrator Labs)

Bonus track• Client certificates• May be combined with 2FA• May be integrated into certain applications as well• Unsupported by some mobile browsers OOTB :-(