Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Security and Privacy on the Web in 2016

Security and Privacy on the Web in 2016

In the last few years, a number of new security features have become available to web developers (e.g. Content Security Policy, Strict Transport Security) and a few more are coming up (e.g. Referrer Policy, Subresource Integrity).

As a browser vendor and a member of the W3C WebAppSec working group, Mozilla is busy extending the web platform to provide the tools and features that developers and users need in 2016. In addition to that, the non-profit behind Firefox is experimenting with new ways to protect its users, building on Google's Safe Browsing technology to defend users against tracking.

This talk will introduce developers to the security features of the web platform they can use today and show end-users how they can harden their Firefox browser.

https://www.linuxfestnorthwest.org/2016/sessions/security-and-privacy-web-2016

Francois Marier

April 24, 2016
Tweet

More Decks by Francois Marier

Other Decks in Technology

Transcript

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

    View full-size slide

  2. Security and Privacy
    for users, sysadmins and developers

    View full-size slide

  3. security
    for users

    View full-size slide

  4. Safe Browsing

    View full-size slide

  5. pre-downloaded URL hash prefixes

    View full-size slide

  6. pre-downloaded URL hash prefixes
    list updated every 30 minutes

    View full-size slide

  7. pre-downloaded URL hash prefixes
    list updated every 30 minutes
    server completions on prefix hit (with noise entries)

    View full-size slide

  8. pre-downloaded URL hash prefixes
    list updated every 30 minutes
    server completions on prefix hit (with noise entries)
    separate cookie jar

    View full-size slide

  9. 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

    View full-size slide

  10. about:config
    browser.safebrowsing.enabled (phishing)
    browser.safebrowsing.malware.enabled (malware)

    View full-size slide

  11. Download Protection

    View full-size slide

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

    View full-size slide

  13. is it on the pre-downloaded list of dangerous hosts?
    is it signed by a known good software provider?

    View full-size slide

  14. 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.)?

    View full-size slide

  15. 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?

    View full-size slide

  16. about:config
    browser.safebrowsing.downloads.remote.enabled
    browser.safebrowsing.downloads.remote.block_potentially_unwanted
    browser.safebrowsing.downloads.remote.block_uncommon

    View full-size slide

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

    View full-size slide

  18. security
    for developers

    View full-size slide

  19. Content Security Policy
    aka CSP
    mechanism for preventing XSS

    View full-size slide

  20. telling the browser what external
    content is allowed to load

    View full-size slide

  21. Hi y'all<br/>alert('p0wned');<br/>!
    Tweet!
    What's on your mind?

    View full-size slide

  22. Hi y'all!
    John Doe - just moments ago
    p0wned
    Ok

    View full-size slide

  23. Hi y'all!
    John Doe - just moments ago

    View full-size slide

  24. Content-Security-Policy:
    script-src 'self'
    https://cdn.example.com

    View full-size slide

  25. script-src
    object-src
    style-src
    img-src
    media-src
    frame-src
    font-src
    connect-src

    View full-size slide

  26. Strict Transport Security
    aka HSTS
    mechanism for preventing
    HTTPS to HTTP downgrades

    View full-size slide

  27. telling the browser that your site
    should never be reached over HTTP

    View full-size slide

  28. GET bank.com 301

    GET https://bank.com 200

    no HSTS, no sslstrip

    View full-size slide

  29. GET bank.com → 200
    no HSTS, with sslstrip

    View full-size slide

  30. what does HSTS look like?

    View full-size slide

  31. $ curl -i https://bank.com
    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Strict-Transport-Security: max-age=31536000
    ...

    View full-size slide

  32. with HSTS, with sslstrip
    GET https://bank.com 200

    View full-size slide

  33. no HTTP traffic for
    sslstrip to tamper with

    View full-size slide

  34. https://ajax.googleapis.com
    /ajax/libs/jquery/1.8.0/
    jquery.min.js

    View full-size slide

  35. what would happen if that
    server were compromised?

    View full-size slide

  36. Bad Things™
    steal sessions
    leak confidential data
    redirect to phishing sites
    enlist DDoS zombies

    View full-size slide

  37. simple solution

    View full-size slide

  38. instead of this:
    src=”https://ajax.googleapis.com...”>

    View full-size slide

  39. src=”https://ajax.googleapis.com...”
    integrity=”sha256-1z4uG/+cVbhShP...”
    crossorigin=”anonymous”>
    do this:

    View full-size slide

  40. guarantee:
    script won't change
    or it'll be blocked

    View full-size slide

  41. security
    for sysadmins

    View full-size slide

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

    View full-size slide

  43. mass surveillance of
    all Internet traffic
    is no longer theoretical

    View full-size slide

  44. strong encryption of
    all Internet traffic
    is no longer optional

    View full-size slide

  45. “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

    View full-size slide

  46. $ apt-get install letsencrypt
    $ letsencrypt example.com

    View full-size slide

  47. automatically prove domain ownership
    download a free-as-in-beer certificate
    monitor and renew it before it expires

    View full-size slide

  48. automatically prove domain ownership
    download a free-as-in-beer certificate
    monitor and renew it before it expires

    View full-size slide

  49. automatically prove domain ownership
    download a free-as-in-beer certificate
    monitor and renew it before it expires

    View full-size slide

  50. HTTPS is not enough
    you need to do it properly

    View full-size slide

  51. SHA-1
    1024-bit certificates
    RC4

    View full-size slide

  52. SHA-1
    1024-bit certificates
    RC4 weak DH parameters

    View full-size slide

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


    src="http://people.mozilla.org/~fmarier/mixed-content.js">






    View full-size slide

  54. turn on full mixed-content blocking in development

    View full-size slide

  55. privacy
    for users

    View full-size slide

  56. about:config
    network.cookie.lifetimePolicy = 3
    network.cookie.lifetime.days = 5
    network.cookie.thirdparty.sessionOnly = true

    View full-size slide

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

    View full-size slide

  58. Tracking Protection

    View full-size slide

  59. based on Safe Browsing
    pre-downloaded list of full hashes
    (no server lookups)

    View full-size slide

  60. 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?

    View full-size slide

  61. Q: What does it do?
    A: It blocks network loads!

    View full-size slide

  62. No cookies
    No fingerprinting
    No wasted bandwidth
    No performance hit

    View full-size slide

  63. about:config
    privacy.trackingprotection.pbmode.enabled

    View full-size slide

  64. about:config
    privacy.trackingprotection.enabled

    View full-size slide

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

    View full-size slide

  66. privacy
    for developers

    View full-size slide

  67. 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.

    View full-size slide

  68. No Referrer
    No Referrer When Downgrade
    Origin Only
    Origin When Cross Origin
    Unsafe URL

    View full-size slide

  69. No Referrer
    No Referrer When Downgrade
    Origin Only
    Origin When Cross Origin
    Unsafe URL

    View full-size slide

  70. No Referrer
    No Referrer When Downgrade
    Origin Only
    Origin When Cross Origin
    Unsafe URL

    View full-size slide

  71. No Referrer
    No Referrer When Downgrade
    Origin Only
    Origin When Cross Origin
    Unsafe URL

    View full-size slide

  72. No Referrer
    No Referrer When Downgrade
    Origin Only
    Origin When Cross Origin
    Unsafe URL

    View full-size slide

  73. Referrer-Policy: origin


    View full-size slide

  74. Referrer-Policy: origin


    View full-size slide

  75. Referrer-Policy: origin

    referrerPolicy="origin">

    View full-size slide

  76. recommendations
    for users

    View full-size slide

  77. 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

    View full-size slide

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

    View full-size slide

  79. recommendations
    for developers

    View full-size slide

  80. 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

    View full-size slide

  81. recommendations
    for sysadmins

    View full-size slide

  82. Enable HTTPS and HSTS on all your sites
    Use our recommended TLS config
    Test your site periodically using SSL Labs

    View full-size slide

  83. Questions?
    feedback:
    [email protected]
    mozilla.dev.security
    [email protected]
    © 2016 François Marier
    This work is licensed under a
    Creative Commons Attribution-ShareAlike 4.0 License.

    View full-size slide

  84. 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

    View full-size slide