crypto workshop part 1 - web and crypto

14
includegraphics[width=1cm]cc0.png Web and Crypto Performance Misc Sources Cryptography for Software and Web Developers Part 1: Web and Crypto Hanno B¨ ock 2014-05-28 1 / 14

Upload: hannob

Post on 08-May-2015

346 views

Category:

Internet


1 download

DESCRIPTION

Slides from a workshop I held on cryptography for web developers. Part 1 is about cryptography in web applications and why you should not mix HTTP and HTTPS. https://blog.hboeck.de/archives/849-Slides-from-cryptography-workshop-for-web-developers.html

TRANSCRIPT

Page 1: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

Cryptography for Software and Web DevelopersPart 1: Web and Crypto

Hanno Bock

2014-05-28

1 / 14

Page 2: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HTTP and HTTPSSSL StrippingCookiesMixed contentHTTPS content, HTTP images

I Many webpages use some kind of mix between HTTP andHTTPS

I This is (almost) always insecure - don’t do it!

2 / 14

Page 3: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HTTP and HTTPSSSL StrippingCookiesMixed contentHTTPS content, HTTP images

I How to people get to webpages? Type in URL, Link fromelsewhere, Bookmark

I If initial access happens through HTTP and forward toHTTPS only happens later we can do SSL Stripping

I Change links from HTTPS to HTTP, Man-in-the-Middle:server - https - attacker - http - client

I sslstrip is free and easy to use [url]

3 / 14

Page 4: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HTTP and HTTPSSSL StrippingCookiesMixed contentHTTPS content, HTTP images

I Cookies have a flag ”secure” - you have to set it, this doesn’thappen automatically

I If you don’t, every HTTP connection will reveal the cookie

I Even if you don’t speak HTTP at all, attacker can still pointvictim to http://yoursite:443

I (my intermediate thesis [url])

4 / 14

Page 5: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HTTP and HTTPSSSL StrippingCookiesMixed contentHTTPS content, HTTP images

I HTTPS website, HTTP JavaScript, CSS or other activecontent

I This is mostly a non-issue today, browsers block this

I Chrome and Safari still allow XMLHttpRequest andWebSocket mixed content

I Images and other non-active content can be safe in somesituations, I wouldn’t risk it

5 / 14

Page 6: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HTTP and HTTPSSSL StrippingCookiesMixed contentHTTPS content, HTTP images

I Can you spot the difference?

6 / 14

Page 7: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

I ”But I can’t do HTTPS-only, it’ll kill my performance.Because... our service is so big and we have so many users.”

7 / 14

Page 8: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

I ”In January this year (2010), Gmail switched to using HTTPSfor everything by default. [...] In order to do this we had todeploy no additional machines and no special hardware.On our production frontend machines, SSL/TLS accounts forless than 1% of the CPU load, less than 10KB of memory perconnection and less than 2% of network overhead.” (AdamLangley, Google developer) [url]

8 / 14

Page 9: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

I In most cases TLS is not a significant performance hit

I Don’t believe things, test them (benchmarks)

I Latest Intel/AMD CPUs contain AES instructions, about 2xspeedup. Make sure your your virtualization doesn’t prevent it

I OpenSSL has 64-bit optimizations for ECC, not alwaysenabled by default

I SPDY: experimental, not necessarily a reliable implementationavailable for your software

9 / 14

Page 10: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HSTSWhat crypto can’t do for youConclusions

I HSTS sends a signal to the browser: ”This domain is HTTPSonly and extra secure”

I Includes a time for which browsers should cache thisinformation

I Enables stricter HTTPS checks and prevents clicking away ofwarnings

I Big improvement, prevents SSL stripping in most cases, use it!

I Remaining problem: First access (chrome has somedefault-to-hsts-lists, DNSSEC advised HSTS could help)

10 / 14

Page 11: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HSTSWhat crypto can’t do for youConclusions

11 / 14

Page 12: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HSTSWhat crypto can’t do for youConclusions

I Erh, no!

I You can have an extra secure XSS or SQL injection, encryptedwith AES-GCM, 256 bits, 4096 bit RSA and extra-strongPerfect Forward Secrecy - It’s still a vulnerability

I Be aware what crypto can and can’t do

I And regarding XSS and SQL injections: Use Content SecurityPolicy to stop all XSS and prepared statements to stop allSQL injections

12 / 14

Page 13: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

HSTSWhat crypto can’t do for youConclusions

I Don’t mix HTTP and HTTPS, it’s never secure

I Set secure flag for cookies

I Use HSTS

I Don’t trust unfounded claims, demand real data

I Crypto won’t safe you from non-crypto issues

13 / 14

Page 14: Crypto workshop part 1 - Web and Crypto

includegraphics[width=1cm]cc0.png

Web and CryptoPerformance

MiscSources

I sslstrip download and talkhttp://www.thoughtcrime.org/software/sslstrip/

I Session-Cookies and SSLhttps://blog.hboeck.de/uploads/ssl-cookies.pdf

I Mixed Content http://blog.ivanristic.com/2014/03/https-mixed-content-still-the-easiest-way-to-break-ssl.

html

I Gmail, TLS and Performancehttps://www.imperialviolet.org/2010/06/25/

overclocking-ssl.html

I XSS and SSL https://twitter.com/Cybpoulet/status/

460438949257691136/photo/1

14 / 14