The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf ·...

212
The Web Browser as a Platform for Secure Applications. Ben Adida Harvard CRCS Luncheon 14 May 2008

Transcript of The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf ·...

Page 1: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The Web Browseras a Platform for

Secure Applications.Ben AdidaHarvard

CRCS Luncheon14 May 2008

Page 2: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web Pages are Programs

Page 3: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web Pages are Programs

<head> <title>Random Blog</title>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script>

</head>

Page 4: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party
Page 5: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Introspectiondocument.getElementById(‘article_content’).innerHTML;

Page 6: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Introspectiondocument.getElementById(‘article_content’).innerHTML;

var req = new XMLHttpRequest();

req.onreadystatechange = function() {if (req.readyState == 4) { // do something with req.responseText}

};

req.open(“GET”, “/more-data”, true);req.send(“”);

Network Requests

Page 7: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Introspectiondocument.getElementById(‘article_content’).innerHTML;

var req = new XMLHttpRequest();

req.onreadystatechange = function() {if (req.readyState == 4) { // do something with req.responseText}

};

req.open(“GET”, “/more-data”, true);req.send(“”);

Network Requests

Modifying the Pagedocument.getElementById(‘menu’).style.display = ‘none’;

var i = document.createElement(‘img’);i.src = ‘http://otherdomain.com/photo2.jpg’;document.body.appendChild(i);

Page 8: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BigBank.com

User

MyFriendBook.com

BigBank.com Cookie

sessionid=8d8c93200

Page 9: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BigBank.com

User

MyFriendBook.com

BigBank.com Cookie

sessionid=8d8c93200

GET/friends

Page 10: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BigBank.com

User

MyFriendBook.com

BigBank.com Cookie

sessionid=8d8c93200

GET/friends

Bank balance

stealing code

Page 11: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BigBank.com

User

MyFriendBook.com

BigBank.com Cookie

sessionid=8d8c93200

GET/friends

Bank balance

stealing code

GET/balance

Page 12: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BigBank.com

User

MyFriendBook.com

BigBank.com Cookie

sessionid=8d8c93200

GET/friends

Bank balance

stealing code

GET/balance

$42

Page 13: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BigBank.com

User

MyFriendBook.com

BigBank.com Cookie

sessionid=8d8c93200

GET/friends

Bank balance

stealing code

GET/balance

$42

$42

Page 14: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BigBank.com

User

MyFriendBook.com

BigBank.com Cookie

sessionid=8d8c93200

GET/friends

Bank balance

stealing code

GET/balance

$42

$42

Page 15: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Intranet

User

MyFriendBook.com

Page 16: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Intranet

User

MyFriendBook.com

GET/friends

Page 17: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Intranet

User

MyFriendBook.com

GET/friends

Port scan

code

Page 18: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Intranet

User

MyFriendBook.com

GET/friends

Port scan

code

GET/employees

Page 19: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Intranet

User

MyFriendBook.com

GET/friends

Port scan

code

GET/employees

"Alice,

Bob,..."

Page 20: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Intranet

User

MyFriendBook.com

GET/friends

Port scan

code

"Alice,

Bob,..."GET

/employees

"Alice,

Bob,..."

Page 21: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Intranet

User

MyFriendBook.com

GET/friends

Port scan

code

"Alice,

Bob,..."GET

/employees

"Alice,

Bob,..."

Page 22: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Imagesflickr.com

User

MyBlog.com

Page 23: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Imagesflickr.com

User

MyBlog.com

GET/post?id=3

Blog Post w/

Inline image

Page 24: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Imagesflickr.com

User

MyBlog.com

GET/post?id=3

Blog Post w/

Inline image

GET/photo

Page 25: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Imagesflickr.com

User

MyBlog.com

GET/post?id=3

Blog Post w/

Inline image

GET/photo

Page 26: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Scripts

Page 27: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Scripts<head> <title>Random Blog</title>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script>

</head>

Page 28: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Scripts<head> <title>Random Blog</title>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script>

</head>

var new_script = document.createElement(‘script’);

new_script.src = ‘http://otherdomain.com/’;

document.head.appendChild(new_script);

Page 29: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Cross-Domain Scripts<head> <title>Random Blog</title>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script>

</head>

var new_script = document.createElement(‘script’);

new_script.src = ‘http://otherdomain.com/’;

document.head.appendChild(new_script);

Page 30: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

Page 31: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

• Cross-Domain outgoing messagescan always be sent (using, IMG, SCRIPT, FORM, or IFRAME.)

Page 32: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

• Cross-Domain outgoing messagescan always be sent (using, IMG, SCRIPT, FORM, or IFRAME.)

• Cross-Domain incoming data can be integrated in limited ways:

➡ images rendered, but opaquely

➡ scripts executed, but opaquely

Page 33: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

Page 34: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

• XHR2 with Access Control:allowing third-party HTTP requests.

Page 35: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

• XHR2 with Access Control:allowing third-party HTTP requests.

• Server must opt in to 3rd-party GET:browser grants access on opt-in.

Page 36: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

• XHR2 with Access Control:allowing third-party HTTP requests.

• Server must opt in to 3rd-party GET:browser grants access on opt-in.

• Server must opt in to 3rd-party POST:server must opt-in before POST is sent.

Page 37: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

State of Cross-Domain

• XHR2 with Access Control:allowing third-party HTTP requests.

• Server must opt in to 3rd-party GET:browser grants access on opt-in.

• Server must opt in to 3rd-party POST:server must opt-in before POST is sent.

Question: should browsers send cookiesfor third-party requests?

Page 38: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Classic Security Model

Page 39: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Classic Security ModelMaster Site

Page 40: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Classic Security ModelMaster Site

EveEvil

Browser

Page 41: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Classic Security ModelMaster Site

EveEvil

Browser

Page 42: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

New Security Model

Page 43: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

New Security ModelMaster Site

Page 44: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

New Security ModelMaster Site

Alice

Page 45: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

New Security ModelMaster Site

Alice

Evil Third Party

Page 46: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

New Security ModelMaster Site

Alice

Evil Third Party

Standard

Browser

Page 47: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Building a Secure Browser Platform is Hard.

What can we do now?

Page 48: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Security in the App Layer

Page 49: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Security in the App Layer

HTTP

Page 50: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Security in the App Layer

HTML & JavaScript

HTTP

Page 51: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Application Code

Security in the App Layer

HTML & JavaScript

HTTP

Page 52: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Application Code

Security in the App Layer

HTML & JavaScript

HTTP

Page 53: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Application Code

Security in the App Layer

- Can we build better securityin the application layer?

HTML & JavaScript

HTTP

Page 54: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Application Code

Security in the App Layer

- Can we build better securityin the application layer?

- Maybe by hijacking certain features for security purposes?(Active Cookies, Subspace, ...)

HTML & JavaScript

HTTP

Page 55: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Application Code

Security in the App Layer

- Can we build better securityin the application layer?

- Maybe by hijacking certain features for security purposes?(Active Cookies, Subspace, ...)

HTML & JavaScript

HTTP

Goal: provide new, unexpected security features

Page 56: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BeamAuthTwo-Factor Web Auth

with a Bookmark

[CCS 2007]

Page 57: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Sad State of Web Auth

Page 58: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Sad State of Web Auth

Page 59: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Sad State of Web Auth

Page 60: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Sad State of Web Auth

Page 61: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SSO makes things worse

Page 62: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SSO makes things worse

Page 63: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SSO makes things worse

Page 64: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SSO makes things worse

Page 65: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SSO makes things worse

Page 66: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Update the Browser

- Dynamic Security Skins [DT2005]secure password-based key exchangenew browser chrome to auth web site.

- PwdHash [RJMBM2005]domain-specific password pre-processing.

- MS CardSpacechange the entire auth infrastructurebuilt into the operating system.

Page 67: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The General Idea

SetupPhase

LoginPhase

Page 68: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The General Idea

SetupPhase

LoginPhase

Alice

OpenIDServer

Page 69: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The General Idea

proof of identitySetupPhase

LoginPhase

Alice

OpenIDServer

Page 70: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The General Idea

proof of identitySetupPhase

LoginPhase

tokenAlice

OpenIDServer

Page 71: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Click Your

BeamAuth

Login Button

The General Idea

proof of identitySetupPhase

LoginPhase

tokenAlice

OpenIDServer

Page 72: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Click Your

BeamAuth

Login Button

The General Idea

proof of identitySetupPhase

LoginPhase

tokenAlice

OpenIDServer

Page 73: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Click Your

BeamAuth

Login Button

benadida

Username

Password

log in

The General Idea

proof of identitySetupPhase

LoginPhase

tokenAlice

OpenIDServer

Page 74: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Click Your

BeamAuth

Login Button

benadida

Username

Password

log in

The General Idea

proof of identitySetupPhase

LoginPhase

token

benadida

Username

**********

Password

log in

Alice

OpenIDServer

Page 75: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Click Your

BeamAuth

Login Button

benadida

Username

Password

log in

The General Idea

proof of identitySetupPhase

LoginPhase

token

Welcome,

Ben Adida.

benadida

Username

**********

Password

log in

Alice

OpenIDServer

Page 76: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Let’s Build this Button!

Page 77: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Let’s Build this Button!

- Browser add-onnot an easy solution for most userscomplexity of add-on across browserssignificant trust delegated to the login site

Page 78: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Let’s Build this Button!

- Browser add-onnot an easy solution for most userscomplexity of add-on across browserssignificant trust delegated to the login site

- BookmarkDelicious, etc. use bookmarks as buttonscan we do the same for security?

BookMark Auth = BM Auth = BeamAuth

Page 79: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

JavaScript Bookmarks

Page 80: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

JavaScript Bookmarksjavascript:document.location=‘http://del.icio.us/add?u=’ + encodeURIComponent(document.location);

Page 81: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

JavaScript Bookmarks

javascript:beamauth_token(‘x737csd23’);

javascript:document.location=‘http://del.icio.us/add?u=’ + encodeURIComponent(document.location);

Page 82: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

JavaScript Bookmarks

javascript:beamauth_token(‘x737csd23’);

javascript:document.location=‘http://del.icio.us/add?u=’ + encodeURIComponent(document.location);

Page 83: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

JavaScript Bookmarks

javascript:beamauth_token(‘x737csd23’);

javascript:if (document.location.hostname == ‘myopenid.com’){ beamauth_token(‘x737csd23’);}

javascript:document.location=‘http://del.icio.us/add?u=’ + encodeURIComponent(document.location);

Page 84: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

JavaScript Bookmarks

javascript:beamauth_token(‘x737csd23’);

javascript:if (document.location.hostname == ‘myopenid.com’){ beamauth_token(‘x737csd23’);}

javascript:document.location=‘http://del.icio.us/add?u=’ + encodeURIComponent(document.location);

Page 85: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

JavaScript Bookmarks

javascript:beamauth_token(‘x737csd23’);

javascript:if (document.location.hostname == ‘myopenid.com’){ beamauth_token(‘x737csd23’);}

Cannot trust the JavaScript Computing Base

javascript:document.location=‘http://del.icio.us/add?u=’ + encodeURIComponent(document.location);

Page 86: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The URL Fragment Identifier

http://site.com/page#paragraph

[Webkeys]

Page 87: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The URL Fragment Identifier

- used to designate a portion of a pagebrowser scrolls to the appropriate location.

http://site.com/page#paragraph

[Webkeys]

Page 88: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The URL Fragment Identifier

- used to designate a portion of a pagebrowser scrolls to the appropriate location.

- never sent over the network but accessible from JavaScript

http://site.com/page#paragraph

[Webkeys]

Page 89: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The URL Fragment Identifier

- used to designate a portion of a pagebrowser scrolls to the appropriate location.

- never sent over the network but accessible from JavaScript

- navigation between fragments does not cause a page reload.

http://site.com/page#paragraph

[Webkeys]

Page 90: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Fragment in a Bookmark

http://login.com/login#[benadida|8x34202]

Page 91: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Fragment in a Bookmark

http://login.com/login#[benadida|8x34202]

var hash = document.location.hash;

if (hash != ‘’) {// parse the hash, get username and tokenprocess_beamauth_hash(hash);

// clear the hash from the URLdocument.location.replace(‘/login’);

}

Page 92: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 93: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 94: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 95: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 96: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 97: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 98: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 99: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The BeamAuth Ritual

Page 100: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Attacks- Trick User into Not Clicking Bookmark

password compromised, token safe.

- Lock User into Sitepassword compromised, token safe.

- Maliciously Replace Bookmarkpassword compromised, token safe.

- Pharmingall compromised.

- “Drag-and-Drop” Attackall compromised on Firefox.

Page 101: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Comparison toLong-Lasting Cookies

- Second-channel setup – though long-lasting cookies could do the same thing there.

- Synchronization across browsersusing existing bookmark-sync tools.

- Better behavior for non-SSL sites

Page 102: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

BeamAuth: Summary

- Bookmark as second authentication factor

- Token delivered via a separate channel (email)

- Use the fragment identifier to store token

- Tweaked Login Ritual: whisk users to safety

Page 103: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Anything elsewith that fragment?

Page 104: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLockSecuring HTTP Sessions

from Eavesdroppers

[WWW 2008]

Page 105: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Alice

Page 106: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Alice

Eve

Page 107: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Alice

Eve

wi-fi typically unencrypted, easy to sniff.

Page 108: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

Page 109: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

Page 110: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

SetCookie:

uid=12345;tok=87654

Page 111: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

SetCookie:

uid=12345;tok=87654

Cookie:

uid=12345;tok=87654

Page 112: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

SetCookie:

uid=12345;tok=87654

/inbox

Cookie: uid=12345;tok=87654

Cookie:

uid=12345;tok=87654

Page 113: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

SetCookie:

uid=12345;tok=87654

/inbox

Cookie: uid=12345;tok=87654

Cookie:

uid=12345;tok=87654

conte

nts

of in

box

Page 114: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

SetCookie:

uid=12345;tok=87654

/inbox

Cookie: uid=12345;tok=87654

Cookie:

uid=12345;tok=87654

conte

nts

of in

box

Eve

Page 115: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

SetCookie:

uid=12345;tok=87654

/inbox

Cookie: uid=12345;tok=87654

Cookie:

uid=12345;tok=87654

conte

nts

of in

box

Eve/send?to=billg

Cookie: uid=12345;tok=87654

Page 116: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SSL?

- Content Distribution Networks

- All-or-Nothing Content

- All-or-Nothing Download

- Caching

Page 117: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SSL?

- Content Distribution Networks

- All-or-Nothing Content

- All-or-Nothing Download

- Caching

Even with server-side horsepower,SSL is significantly more sluggish.

Page 118: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encryption isnot the Issue

- add a few lines to a wiki

- check a few notifications on gmail

- send a few pages to my bookmarks aggregator

Page 119: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encryption isnot the Issue

- add a few lines to a wiki

- check a few notifications on gmail

- send a few pages to my bookmarks aggregator

Risk: complete impersonation!

Page 120: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encryption isnot the Issue

- add a few lines to a wiki

- check a few notifications on gmail

- send a few pages to my bookmarks aggregator

Shoulder-surfing my email is not the end of the world.Impersonating me to my webmail is much worse.

Risk: complete impersonation!

Page 121: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Current Login Approach

Web

Browser

Web

Server

Page 122: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Current Login Approach

Web

Browser

Web

Server

/login?username&password

Set-Cookie /

inbox

conte

nts

of in

box

Cookie:

uid=12345;tok=87654

Page 123: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The SessionLock Idea

Page 124: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The SessionLock Idea

- Use the SSL login to send a SECRETto the web browser.

Page 125: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The SessionLock Idea

- Use the SSL login to send a SECRETto the web browser.

- “Pass” SECRET to the non-SSL side.

Page 126: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The SessionLock Idea

- Use the SSL login to send a SECRETto the web browser.

- “Pass” SECRET to the non-SSL side.

- Keep SECRET in scope,use it to sign every HTTP request.

Page 127: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

The SessionLock Idea

- Use the SSL login to send a SECRETto the web browser.

- “Pass” SECRET to the non-SSL side.

- Keep SECRET in scope,use it to sign every HTTP request.

- Never send SECRET in plaintext.

Page 128: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Passing Secret via Fragment

http://webmail/#SECRET

Page 129: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Passing Secret via Fragment

http://webmail/#SECRET

var hash = document.location.hash;

if (hash != ‘’) {// parse the hash, get username and tokenstore_secret(hash);

// clear the hash from the URLdocument.location.replace(‘/’);

}

Page 130: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Signing with HMAC

Page 131: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Signing with HMAC

- Assume a single-page web application (for now).

Page 132: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Signing with HMAC

- Assume a single-page web application (for now).

- Intercept all XHR JavaScript requests

Page 133: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Signing with HMAC

- Assume a single-page web application (for now).

- Intercept all XHR JavaScript requests

- append timestamp, HMAC the request line,append HMAC result.

sig = HMACsecret(“/message?id=3&ts=20080514..”)/message?id=3&ts=20080514..&s=sig

Page 134: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Signing with HMAC

- Assume a single-page web application (for now).

- Intercept all XHR JavaScript requests

- append timestamp, HMAC the request line,append HMAC result.

sig = HMACsecret(“/message?id=3&ts=20080514..”)/message?id=3&ts=20080514..&s=sig

- 50ms on a 3-year-old laptop for each request(much faster on recent laptop with FF3.)

Page 135: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

Page 136: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password

Page 137: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

Page 138: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

Cookie: bd5c

Page 139: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

Cookie: bd5c

/launch

Page 140: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

#[ac8f]

Cookie: bd5c

/launch

Page 141: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

JS

+H

TM

L in

terfa

ce

#[ac8f]

Cookie: bd5c

/launch

Page 142: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

JS

+H

TM

L in

terfa

ce

#[ac8f]

Cookie: bd5c

/launch

Load #[ac8f] from fragment

and store in JavaScript scope.

Page 143: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

JS

+H

TM

L in

terfa

ce

#[ac8f]

Cookie: bd5c

/launch

Load #[ac8f] from fragment

and store in JavaScript scope.

Page 144: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

JS

+H

TM

L in

terfa

ce

#[ac8f]

Cookie: bd5c

/launch

/inbox?date&HMAC

Load #[ac8f] from fragment

and store in JavaScript scope.

Page 145: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

JS

+H

TM

L in

terfa

ce

#[ac8f]

Cookie: bd5c

/launch

/inbox?date&HMAC

list o

f em

ails

in in

box

Load #[ac8f] from fragment

and store in JavaScript scope.

Page 146: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Recovery

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

/launch

JS

+H

TM

L in

terfa

ce

Load #[ac8f] from fragment

and store in JavaScript scope.

Cookie: bd5c

#[ac8f]

Page 147: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Recovery

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

/launch

JS

+H

TM

L in

terfa

ce

Load #[ac8f] from fragment

and store in JavaScript scope.

Cookie: bd5c

#[ac8f]

Cookie: ac8f

Page 148: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Recovery

Web

Browser

Web

Server

/login?username&password 3

02 /mail#[ac8f]

/launch

JS

+H

TM

L in

terfa

ce

Load #[ac8f] from fragment

and store in JavaScript scope.

Cookie: bd5c

#[ac8f]

Cookie: ac8f/inbox?date&HMAC

list o

f em

ails

in in

box

Page 149: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Recovery

missing secret token

http://webmail/

1

Page 150: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Recovery

open dynamic iframe

http://webmail/

2

tok = cookie('tok');

location =

'http://webmail/

recover#' + tok;

https://webmail/recover

Page 151: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Recovery

recover token

http://webmail/

3

tok = get_fragment();window.parent. set_tok(tok);

http://webmail/recover#

Page 152: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Recovery

token recovered,

close frame,

make AJAX requests

http://webmail/

4

Page 153: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

- need to keep the secret aroundfrom page to page.

- can’t be done on the server side,as it would then be sent unencrypted.

- must be done as a side-channelon the client side.

Multi-Page Apps

Page 154: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server

Page 155: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Page 156: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

Page 157: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

/launch

Page 158: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

#[ac8f]

/launch

Page 159: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

#[ac8f]

/launch

launch p

age

Page 160: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

#[ac8f]

Load #[ac8f] from fragment

use to HMAC and patch links.

/launch

launch p

age

Page 161: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

#[ac8f]

Load #[ac8f] from fragment

use to HMAC and patch links.

/launch

launch p

age

/inbox?date&HMAC

Page 162: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

#[ac8f]

Load #[ac8f] from fragment

use to HMAC and patch links.

/launch

launch p

age

#[ac8f]

/inbox?date&HMAC

Page 163: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

#[ac8f]

Load #[ac8f] from fragment

use to HMAC and patch links.

/launch

launch p

age

#[ac8f]

list o

f em

ails

/inbox?date&HMAC

Page 164: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Multi-Page Apps

Web

Browser

Web

Server/login?username&password 3

02 /mail#[ac8f]

Cookie:bd5c

#[ac8f]

Load #[ac8f] from fragment

use to HMAC and patch links.

/launch

launch p

age

#[ac8f]

list o

f em

ails

Load #[ac8f] from fragment

used to patch links with HMAC.

/inbox?date&HMAC

Page 165: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Better Page-to-Page Transfer & Recovery

Page 166: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Better Page-to-Page Transfer & Recovery

/* * Browser-Local Storage */

// store the token as soon as it is obtained.globalStorage[‘webmail.com’].session_key = ‘...’;

// On opening up a new browser window, get token.var session_key = globalStorage[‘webmail.com’]

Page 167: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

Page 168: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

- fragment identifier as a client-only channel between HTTPS and HTTP.

Page 169: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

- fragment identifier as a client-only channel between HTTPS and HTTP.

- AJAX single-page application is easy.

Page 170: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

- fragment identifier as a client-only channel between HTTPS and HTTP.

- AJAX single-page application is easy.

- Multi-page apps:

Page 171: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

- fragment identifier as a client-only channel between HTTPS and HTTP.

- AJAX single-page application is easy.

- Multi-page apps:

- keep the secret around by frag id.

Page 172: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

- fragment identifier as a client-only channel between HTTPS and HTTP.

- AJAX single-page application is easy.

- Multi-page apps:

- keep the secret around by frag id.

- small JS library that patches HTML.

Page 173: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

- fragment identifier as a client-only channel between HTTPS and HTTP.

- AJAX single-page application is easy.

- Multi-page apps:

- keep the secret around by frag id.

- small JS library that patches HTML.

- writing your app with SessionLock in mind.

Page 174: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

Page 175: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

SessionLock Summary

Intuition matches threat model more closely.

What you browse is visible to an eavesdropper.What you don’t browse is safe.

Actions with side-effects are safe.

Page 176: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

HeliosWeb-based

Open-Audit Voting

[Usenix Security 2008]

Page 177: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Bulletin Board

Public Ballots

Bridget:McCain

Carol:Obama

Page 178: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Bulletin Board

Public Ballots

Bridget:McCain

Carol:Obama

Alice

Page 179: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Bulletin Board

Public Ballots

Alice:Obama

Bridget:McCain

Carol:Obama

Alice

Page 180: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Bulletin Board

Public Ballots

Alice:Obama

Bridget:McCain

Carol:Obama

Tally

Obama....2McCain....1

Alice

Page 181: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypted Public BallotsBulletin Board

Alice:Rice

Bridget:Clinton

Carol:Rice

Tally

Obama....2McCain....1

Alice

Page 182: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypted Public BallotsBulletin Board

Alice:Rice

Bridget:Clinton

Carol:Rice

Tally

Obama....2McCain....1

Alice

Alice verifies her vote

Page 183: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypted Public BallotsBulletin Board

Alice:Rice

Bridget:Clinton

Carol:Rice

Tally

Obama....2McCain....1

Alice

Alice verifies her vote Everyone verifies the tally

Page 184: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Benaloh Casting Protocol

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

Page 185: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Benaloh Casting Protocol

Alice

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

Page 186: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Benaloh Casting Protocol

Alice

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

Page 187: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Benaloh Casting Protocol

Alice

EncryptedBallot

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

Page 188: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

Page 189: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

Page 190: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

Page 191: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 192: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 193: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 194: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

Alice

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 195: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

Alice

"CAST"

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 196: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

Alice

"CAST"

SignedEncryptedBallot

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 197: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

Alice

"CAST"

SignedEncryptedBallot

Alice

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 198: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

"AUDIT"

Benaloh Casting Protocol

Alice

EncryptedBallot

Alice

DecryptedBallot

Alice

"CAST"

SignedEncryptedBallot

Alice

http://en.wikipedia.org/wiki/Image:Barcode-scanner.jpg

SignedEncryptedBallot

DecryptedBallot

EncryptedBallot

VERIFICATION

Page 199: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Filling out a Ballot

Page 200: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypting a Ballot

Page 201: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypting a Ballot

Page 202: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypting a Ballot

Page 203: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypting a Ballot

// Call Java from JavaScriptvar a = new java.math.BigInteger(42);var b = new java.math.BigInteger(17);var c = new java.math.BigInteger(12);

alert(a.modPow(c, b).toString());

Page 204: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Encrypting a Ballot

// Call Java from JavaScriptvar a = new java.math.BigInteger(42);var b = new java.math.BigInteger(17);var c = new java.math.BigInteger(12);

alert(a.modPow(c, b).toString());

// Call Java from JavaScript (IE & Safari)var a = MyApplet.static_new_bigint(42);...

Page 205: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Getting a Receipt

Page 206: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Getting a Receipt

Page 207: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Getting a Receipt

// open a Data URI<a target="_new" href="data:text/plain,Your%20Receipt..."> receipt</a>

Page 208: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Getting a Receipt

// open a Data URI<a target="_new" href="data:text/plain,Your%20Receipt..."> receipt</a>

// dynamic construction of a windowvar receipt = window.open();receipt.document.open("text/plain");receipt.document.write(content);receipt.document.close();

Page 209: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Application State

Page 210: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Thoughts

- Guide developers to “do the right thing.”

- Let the browser become a true platform

- Security solutions in the application layer

- ideally through design, not tricks

Page 211: The Web Browser as a Platform forassets.adida.net/presentations/2008-05-14-crcs-websec.pdf · 5/14/2008  · State of Cross-Domain •XHR2 with Access Control: allowing third-party

Thoughts

- Guide developers to “do the right thing.”

- Let the browser become a true platform

- Security solutions in the application layer

- ideally through design, not tricks

Should browsers send cookiesfor third-party requests? YES.