Firefox Security Sid Stamm <sid@mozilla.com> Browser as a - - PowerPoint PPT Presentation

firefox security
SMART_READER_LITE
LIVE PREVIEW

Firefox Security Sid Stamm <sid@mozilla.com> Browser as a - - PowerPoint PPT Presentation

Firefox Security Sid Stamm <sid@mozilla.com> Browser as a Protector Protect Site Content Safe Platform Third-Party Features Keeping your Secrets Content Restrictions Content Security Policy Content Restrictions Document


slide-1
SLIDE 1

Firefox Security

Sid Stamm <sid@mozilla.com>

slide-2
SLIDE 2

Browser as a Protector

  • Protect Site Content
  • Safe Platform
  • Third-Party Features
  • Keeping your Secrets
slide-3
SLIDE 3

Content Restrictions

Content Security Policy

slide-4
SLIDE 4

Content Restrictions

Document “Good” behavior... Suppress the “Bad”

slide-5
SLIDE 5

Grabbing the Reins

  • Content Rules & Regulations
  • Specify a “Normal Behavior” Policy
  • Catch and Block Violations

<HTML> Content Policy Specify Rules Enforce Rules

Content Restrictions

slide-6
SLIDE 6

Step 1: Smooth Edges

  • Scripts served in files (not inline)
  • “javascript:” URIs
  • <tag on*=...> event registration
  • text nodes in <script> tags
  • Establish Code / Data Separation
  • eval(“foo”) and friends

Content Restrictions

slide-7
SLIDE 7

Step 2: Restrictions on Content

  • Block requests for all resources

... unless explicitly allowed by a policy!

Content Restrictions

slide-8
SLIDE 8

CSP: Policies

  • HTTP Response Header

X-CONTENT-SECURITY

  • POLICY
  • Directives to enforce listed within

Content Restrictions

slide-9
SLIDE 9

Speed Bump

  • Designers may not have access to HTTP
  • T

wo entities want restrictions

  • Multiple policies?

<meta http-equiv=....>?

Content Restrictions

slide-10
SLIDE 10

Speed Bump

Given Policies P1 and P2: Pe = {u | P1 allows u AND P2 allows u}

Intersecting Policies

Content Restrictions

slide-11
SLIDE 11

Speed Bump

  • policy in-band is too dangerous
  • Multiple header instances!

<meta http-equiv=....>?

Content Restrictions

slide-12
SLIDE 12

CSP: Directives

report-uri policy-uri

  • ptions

source directives

Content Restrictions

slide-13
SLIDE 13

CSP: Source Directives

img-src media-src script-src

  • bject-src

frame-src font-src xhr-src frame-ancestors style-src allow (default for these)

Content Restrictions

slide-14
SLIDE 14

Speed Bump

‘self’ ... in pieces? https://‘self’:443 ‘self’://foo.com foo.com:‘self’

Content Restrictions

slide-15
SLIDE 15

‘self’

‘self‘ -> http://foo.com:80 bar.com:8080 -> http://bar.com:8080 http://foo.com -> http://foo.com:80 bar.com -> http://bar.com:80

Content Restrictions

slide-16
SLIDE 16

Speed Bump

Redirects http://foo.com http://bar.com http://duh.com

Content Restrictions

slide-17
SLIDE 17

Step 3: Profit

  • Sites only request explicitly allowed

resources

  • Injected inline scripts don’t run
  • Content homogenization (mixed content

control)

  • Cross-domain CSRF reduction
  • Violation reports = early alert

Content Restrictions

slide-18
SLIDE 18
  • Site wants all content to come from the

same source (scheme, host, port)

CSP: Use Case 1

allow ‘self’

Content Restrictions

slide-19
SLIDE 19
  • Site wants all content to come from the

same source (scheme, host, port), except content in iframes may be served by a third-party advertising network.

CSP: Use Case 2

allow ‘self’; frame-src ads.net

Content Restrictions

slide-20
SLIDE 20
  • Auction site wants to allow images from anywhere,

plugin content from a trusted media provider network, and scripts only from its server hosting sanitized JavaScript

CSP: Use Case 3

allow ‘self’; img-src *;

  • bject-src *.teevee.com;

script-src myscripts.com

Content Restrictions

slide-21
SLIDE 21
  • Example site wants to force all content to be

served via HTTPS on port 443, from any subdomain of example.com

CSP: Use Case 4

Content Restrictions

allow https://*.x.com;

slide-22
SLIDE 22

Wait! That breaks my site!

  • Good Option: convert your site
  • Less Good Option: disable parts of CSP

Content Restrictions

slide-23
SLIDE 23

Ramping Up

  • Disable some restrictions via options
  • Report-Only mode
  • “Writing a Policy” guide
  • “Converting your Site” guide
  • Maybe a policy recommendation tool?

Content Restrictions

slide-24
SLIDE 24

Safe Platform

Safe Platform

slide-25
SLIDE 25

Wrappers

Safe Platform

  • XPCNativeWrapper
slide-26
SLIDE 26

Wrappers

Safe Platform

  • ChromeObjectWrapper
slide-27
SLIDE 27

Wrappers

Safe Platform

  • SafeJSObjectWrapper

JS

slide-28
SLIDE 28

Wrappers

Safe Platform

  • CrossOriginWrapper
slide-29
SLIDE 29

Out of Process Plug-Ins

Safe Platform

Safe Platform

slide-30
SLIDE 30

Add-Ons

Third-Party Features

slide-31
SLIDE 31

XPCOM and IDL

Third-Party Features

slide-32
SLIDE 32

XPCOM and IDL

Third-Party Features

Source: http://www.ibm.com/developerworks/java/library/os-xpcomfirefox/

slide-33
SLIDE 33

Untamed Add-Ons

Third-Party Features

slide-34
SLIDE 34

Jetpack

Third-Party Features

slide-35
SLIDE 35

Jetpack

Third-Party Features

My Add-On

Jetpack Backend (XPCOM)

module module module module module module

API

slide-36
SLIDE 36

Jetpack

Third-Party Features

My Add-On

Jetpack Backend (XPCOM)

module module module module module module

API JavaScript

slide-37
SLIDE 37

Jetpack

Third-Party Features

My Add-On

Jetpack Backend (XPCOM)

module module module module module module

API

Capabilities:

  • 1. http://foo.com
  • 2. graphics
  • 3. menus
slide-38
SLIDE 38

Features and Your Privacy

Keeping your Secrets

slide-39
SLIDE 39

History Sniffing

Keeping your Secrets

http://dbaron.org/mozilla/visited-privacy https://wiki.mozilla.org/User:Sidstamm/CSS_History_Sniffing_Links

slide-40
SLIDE 40

Private Browsing

Keeping your Secrets

(roll-back time)

slide-41
SLIDE 41

NPAPI Hooks

Keeping your Secrets

Private Browsing, Clear Recent History, etc

slide-42
SLIDE 42

Browser Traces

Keeping your Secrets

slide-43
SLIDE 43

Browser as a Protector

  • Protect Site Content
  • Safe Platform
  • Third-Party Features
  • Keeping your Secrets