116
Security and Privacy on the Web in 2016 François Marier @fmarier mozilla

Security and Privacy on the Web in 2016

Embed Size (px)

Citation preview

Page 1: Security and Privacy on the Web in 2016

Security and Privacyon the Web in 2016

François Marier @fmarier mozilla

Page 2: Security and Privacy on the Web in 2016

Security and Privacyfor users, sysadmins and developers

Page 3: Security and Privacy on the Web in 2016

security

Page 4: Security and Privacy on the Web in 2016

securityfor users

Page 5: Security and Privacy on the Web in 2016

Safe Browsing

Page 6: Security and Privacy on the Web in 2016
Page 7: Security and Privacy on the Web in 2016

pre-downloaded URL hash prefixes

Page 8: Security and Privacy on the Web in 2016

pre-downloaded URL hash prefixes

list updated every 30 minutes

Page 9: Security and Privacy on the Web in 2016

pre-downloaded URL hash prefixes

list updated every 30 minutes

server completions on prefix hit (with noise entries)

Page 10: Security and Privacy on the Web in 2016

pre-downloaded URL hash prefixes

list updated every 30 minutes

server completions on prefix hit (with noise entries)

separate cookie jar

Page 11: Security and Privacy on the Web in 2016

pre-downloaded URL hash prefixes

list updated every 30 minutes

server completions on prefix hit (with noise entries)

separate cookie jar

list entries expire after 45 minutes

Page 12: Security and Privacy on the Web in 2016

about:config

browser.safebrowsing.enabled (phishing)browser.safebrowsing.malware.enabled (malware)

Page 13: Security and Privacy on the Web in 2016

Download Protection

Page 14: Security and Privacy on the Web in 2016
Page 15: Security and Privacy on the Web in 2016

is it on the pre-downloaded list of dangerous hosts?

Page 16: Security and Privacy on the Web in 2016

is it on the pre-downloaded list of dangerous hosts?

is it signed by a known good software provider?

Page 17: Security and Privacy on the Web in 2016

is it on the pre-downloaded list of dangerous hosts?

is it signed by a known good software provider?

is it an executable file (.exe, .com, .pif, .dmg, etc.)?

Page 18: Security and Privacy on the Web in 2016

is it on the pre-downloaded list of dangerous hosts?

is it signed by a known good software provider?

is it an executable file (.exe, .com, .pif, .dmg, etc.)?

what does the apprep server think about it?

Page 19: Security and Privacy on the Web in 2016

about:config

browser.safebrowsing.downloads.remote.enabled

browser.safebrowsing.downloads.remote.block_potentially_unwantedbrowser.safebrowsing.downloads.remote.block_uncommon

Page 20: Security and Privacy on the Web in 2016

https://feeding.cloud.geek.nz/posts/how-safe-browsing-works-in-firefox/

Page 21: Security and Privacy on the Web in 2016

securityfor developers

Page 22: Security and Privacy on the Web in 2016

Content Security Policyaka CSP

mechanism for preventing XSS

Page 23: Security and Privacy on the Web in 2016

telling the browser what externalcontent is allowed to load

Page 24: Security and Privacy on the Web in 2016

Hi y'all<script>alert('p0wned');</script>!

Tweet!

What's on your mind?

Page 25: Security and Privacy on the Web in 2016

without CSP

Page 26: Security and Privacy on the Web in 2016

Hi y'all!John Doe - just moments ago

p0wnedOk

Page 27: Security and Privacy on the Web in 2016

with CSP

Page 28: Security and Privacy on the Web in 2016

Hi y'all!John Doe - just moments ago

Page 29: Security and Privacy on the Web in 2016

Content-Security-Policy:

script-src 'self'

https://cdn.example.com

Page 30: Security and Privacy on the Web in 2016

script-srcobject-srcstyle-srcimg-srcmedia-srcframe-srcfont-src

connect-src

Page 31: Security and Privacy on the Web in 2016

Strict Transport Securityaka HSTS

mechanism for preventingHTTPS to HTTP downgrades

Page 32: Security and Privacy on the Web in 2016

telling the browser that your siteshould never be reached over HTTP

Page 33: Security and Privacy on the Web in 2016
Page 34: Security and Privacy on the Web in 2016

GET bank.com 301→

GET https://bank.com 200→

no HSTS, no sslstrip

Page 35: Security and Privacy on the Web in 2016

GET bank.com → 200

no HSTS, with sslstrip

Page 36: Security and Privacy on the Web in 2016

what does HSTS look like?

Page 37: Security and Privacy on the Web in 2016

$ curl -i https://bank.comHTTP/1.1 200 OKCache-Control: privateContent-Type: text/html; charset=utf-8Strict-Transport-Security: max-age=31536000...

Page 38: Security and Privacy on the Web in 2016

with HSTS, with sslstrip

GET https://bank.com 200→

Page 39: Security and Privacy on the Web in 2016

no HTTP traffic forsslstrip to tamper with

Page 40: Security and Privacy on the Web in 2016
Page 41: Security and Privacy on the Web in 2016
Page 42: Security and Privacy on the Web in 2016
Page 43: Security and Privacy on the Web in 2016

https://ajax.googleapis.com

/ajax/libs/jquery/1.8.0/

jquery.min.js

Page 44: Security and Privacy on the Web in 2016

what would happen if thatserver were compromised?

Page 45: Security and Privacy on the Web in 2016
Page 46: Security and Privacy on the Web in 2016

Bad Things™

steal sessionsleak confidential dataredirect to phishing sitesenlist DDoS zombies

Page 47: Security and Privacy on the Web in 2016

simple solution

Page 48: Security and Privacy on the Web in 2016

instead of this:

<scriptsrc=”https://ajax.googleapis.com...”>

Page 49: Security and Privacy on the Web in 2016

<script

src=”https://ajax.googleapis.com...”

integrity=”sha256-1z4uG/+cVbhShP...”

crossorigin=”anonymous”>

do this:

Page 50: Security and Privacy on the Web in 2016

guarantee:script won't changeor it'll be blocked

Page 51: Security and Privacy on the Web in 2016

securityfor sysadmins

Page 52: Security and Privacy on the Web in 2016

HTTPS

Page 53: Security and Privacy on the Web in 2016

if you're not using it, now is the time to start :)

Page 55: Security and Privacy on the Web in 2016
Page 56: Security and Privacy on the Web in 2016

mass surveillance ofall Internet traffic

is no longer theoretical

Page 57: Security and Privacy on the Web in 2016

strong encryption ofall Internet traffic

is no longer optional

Page 58: Security and Privacy on the Web in 2016

“If we only use encryption when we're working with important data, then encryption signals that data's importance. If only dissidents use encryption in a country, that country's authorities have an easy way of identifying them. But if everyone uses it all of the time, encryption ceases to be a signal. The government can't tell the dissidents from the rest of the population. Every time you use encryption, you're protecting someone who needs to use it to stay alive.”

-Bruce Schneier

Page 62: Security and Privacy on the Web in 2016

$ apt-get install letsencrypt

$ letsencrypt example.com

Page 63: Security and Privacy on the Web in 2016

automatically prove domain ownership

download a free-as-in-beer certificate

monitor and renew it before it expires

Page 64: Security and Privacy on the Web in 2016

automatically prove domain ownership

download a free-as-in-beer certificate

monitor and renew it before it expires

Page 65: Security and Privacy on the Web in 2016

automatically prove domain ownership

download a free-as-in-beer certificate

monitor and renew it before it expires

Page 66: Security and Privacy on the Web in 2016

HTTPS is not enough

you need to do it properly

Page 67: Security and Privacy on the Web in 2016

RC4

Page 68: Security and Privacy on the Web in 2016

SHA-1

RC4

Page 69: Security and Privacy on the Web in 2016

SHA-11024-bit certificates

RC4

Page 70: Security and Privacy on the Web in 2016

SHA-11024-bit certificates

RC4 weak DH parameters

Page 75: Security and Privacy on the Web in 2016

https://people.mozilla.org/~fmarier/mixed-content.html

<html><head> <script src="http://people.mozilla.org/~fmarier/mixed-content.js"> </script></head><body> <img src="http://fmarier.org/img/francois_marier.jpg"></body></html>

Page 76: Security and Privacy on the Web in 2016
Page 77: Security and Privacy on the Web in 2016

turn on full mixed-content blocking in development

Page 78: Security and Privacy on the Web in 2016

privacy

Page 79: Security and Privacy on the Web in 2016

privacyfor users

Page 80: Security and Privacy on the Web in 2016
Page 81: Security and Privacy on the Web in 2016
Page 82: Security and Privacy on the Web in 2016
Page 83: Security and Privacy on the Web in 2016
Page 84: Security and Privacy on the Web in 2016

about:config

network.cookie.lifetimePolicy = 3network.cookie.lifetime.days = 5network.cookie.thirdparty.sessionOnly = true

Page 85: Security and Privacy on the Web in 2016

https://feeding.cloud.geek.nz/posts/tweaking-cookies-for-privacy-in-firefox/

Page 86: Security and Privacy on the Web in 2016

Tracking Protection

Page 87: Security and Privacy on the Web in 2016
Page 88: Security and Privacy on the Web in 2016

based on Safe Browsing

pre-downloaded list of full hashes

(no server lookups)

Page 89: Security and Privacy on the Web in 2016

1. is this resource coming from a third-party server?

2. is it on Disconnect's list of trackers?

3. is it actually a third-party or does it belong to the same org?

Page 90: Security and Privacy on the Web in 2016

Q: What does it do?

A: It blocks network loads!

Page 91: Security and Privacy on the Web in 2016

No cookiesNo fingerprintingNo wasted bandwidthNo performance hit

Page 92: Security and Privacy on the Web in 2016

about:config

privacy.trackingprotection.pbmode.enabled

Page 93: Security and Privacy on the Web in 2016

about:config

privacy.trackingprotection.enabled

Page 94: Security and Privacy on the Web in 2016

https://feeding.cloud.geek.nz/posts/how-tracking-protection-works-in-firefox/

Page 95: Security and Privacy on the Web in 2016

privacyfor developers

Page 97: Security and Privacy on the Web in 2016
Page 98: Security and Privacy on the Web in 2016

http://example.com/search?q=serious+medical+condition

Click here for the cheapest

insurance around!

Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla.

Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla. Bla bla bla, bla bla, bla bla bla bla.

Page 100: Security and Privacy on the Web in 2016

No ReferrerNo Referrer When DowngradeOrigin OnlyOrigin When Cross OriginUnsafe URL

Page 101: Security and Privacy on the Web in 2016

No ReferrerNo Referrer When DowngradeOrigin OnlyOrigin When Cross OriginUnsafe URL

Page 102: Security and Privacy on the Web in 2016

No ReferrerNo Referrer When DowngradeOrigin OnlyOrigin When Cross OriginUnsafe URL

Page 103: Security and Privacy on the Web in 2016

No ReferrerNo Referrer When DowngradeOrigin OnlyOrigin When Cross OriginUnsafe URL

Page 104: Security and Privacy on the Web in 2016

No ReferrerNo Referrer When DowngradeOrigin OnlyOrigin When Cross OriginUnsafe URL

Page 105: Security and Privacy on the Web in 2016

Referrer-Policy: origin

<meta name="referrer" content="origin">

<a href="http://example.com" referrer="origin">

Page 106: Security and Privacy on the Web in 2016

Referrer-Policy: origin

<meta name="referrer" content="origin">

<a href="http://example.com" referrer="origin">

Page 107: Security and Privacy on the Web in 2016

Referrer-Policy: origin

<meta name="referrer" content="origin">

<a href="http://example.com" referrerPolicy="origin">

Page 108: Security and Privacy on the Web in 2016

recommendationsfor users

Page 109: Security and Privacy on the Web in 2016

network.cookie.lifetimePolicy = 3

network.cookie.lifetime.days = 5

network.cookie.thirdparty.sessionOnly = true

network.http.referer.spoofSource = true

privacy.trackingprotection.enabled = true

security.pki.sha1_enforcement_level = 2

security.ssl.errorReporting.automatic = true

Install the EFF's HTTPS Everywhere add-on

Page 110: Security and Privacy on the Web in 2016

https://github.com/pyllyukko/user.js

Page 111: Security and Privacy on the Web in 2016

recommendationsfor developers

Page 112: Security and Privacy on the Web in 2016

Use SRI for your external scripts

Set a more restrictive Referrer policy

Consider enabling CSP

Watch out for mixed content

Test your site with Tracking Protection

Page 113: Security and Privacy on the Web in 2016

recommendationsfor sysadmins

Page 114: Security and Privacy on the Web in 2016

Enable HTTPS and HSTS on all your sites

Use our recommended TLS config

Test your site periodically using SSL Labs

Page 115: Security and Privacy on the Web in 2016

Questions?

feedback:

[email protected]@w3.org

© 2016 François Marier <[email protected]>This work is licensed under aCreative Commons Attribution-ShareAlike 4.0 License.

Page 116: Security and Privacy on the Web in 2016

photo credits:

cookie: https://secure.flickr.com/photos/jamisonjudd/4810986199/

explosion: https://www.flickr.com/photos/-cavin-/2313239884/

snowden: https://www.flickr.com/photos/gageskidmore/16526354372