douglas crockford - ajax security

78
Web Forward ! Douglas Crockford Yahoo!

Upload: web-directions

Post on 22-Jan-2015

11.520 views

Category:

Technology


3 download

DESCRIPTION

Security design is an important, but often neglected, component of system design. In this session, Douglas Crockford, creator of Javascript Object Notation, will outline the security issues that must be considered in the architecture of Ajax applications. The design of the browser did not anticipate the needs of multiparty applications. The browser’s security model frustrates useful activities and allows some very dangerous activities. This talk will look at the small set of options before us that will determine the future of the Web. During this session, attendees will: Learn why effective security is an inherent feature of good design; Experience a real-time demo of a Ajax client/server system based on sound security principles See how to apply secure design to rich web applications.

TRANSCRIPT

Page 1: Douglas Crockford - Ajax Security

Web

Forward!

Douglas Crockford

Yahoo!

Page 2: Douglas Crockford - Ajax Security

Gordon E. Moore

Page 3: Douglas Crockford - Ajax Security

The complexity for minimum component costs has increased at a rate of roughly a factor of

two per year ... Over the longer term, the rate of increase is a bit more uncertain, although there is no reason to believe it will not

remain nearly constant for at least 10 years.

1965

Page 4: Douglas Crockford - Ajax Security
Page 5: Douglas Crockford - Ajax Security

Moore's prediction became a self-fulfilling

prophesy.It cannot hold forever,

but it is still holding now.

Page 6: Douglas Crockford - Ajax Security

Processors, memory, disk storage, network

bandwidth.Everything except software.

Page 7: Douglas Crockford - Ajax Security

Software is not subject to Moore's Law.

Software is subject to Murphy's Law.

Page 8: Douglas Crockford - Ajax Security

Software productivity improves at a much

slower rate.Doubling in 10-20 years,

rather than 2 years.

Page 9: Douglas Crockford - Ajax Security

Great Leaps of Software

• Plug boards.

• Machine codes.

• Symbolic assembly language.

• High level languages.

• Structured programming.

• Object oriented programming.

Page 10: Douglas Crockford - Ajax Security

The next leap is overdue.

Object oriented milestones:

1967 Simula 1980 Smalltalk 80 1995 Java

Page 11: Douglas Crockford - Ajax Security

The next great leap might realize the dream of

assembling software like Lego.

• Applications can be built by putting together components, each produced at an independent foundry.

• Components communicate, cooperate with each other.

Page 12: Douglas Crockford - Ajax Security

Mashups!JavaScript is the mashup

language!

It is better suited to dynamic mashing than the conventional OO

languages.

Page 13: Douglas Crockford - Ajax Security

Unfortunately...

Page 14: Douglas Crockford - Ajax Security

The Web Is Under

Attack!

Page 15: Douglas Crockford - Ajax Security

Browser Security

• The biggest problem with the browser is its security model.

• The browser security model is inadequate to deal with the current generation of Ajax applications.

• The browser was not designed to do the things we are asking of it.

• Its weaknesses are blocking innovation.

Page 16: Douglas Crockford - Ajax Security

The browser is not a safe programming environment.

It is inherently insecure.

Page 17: Douglas Crockford - Ajax Security

What can an attacker do when he gets some script into your page?

Page 18: Douglas Crockford - Ajax Security

An attacker can request additional scripts from any

server in the world.

Once it gets a foothold, it can obtain all of the scripts it

needs.

Page 19: Douglas Crockford - Ajax Security

An attacker can make requests of your server.

Your server cannot detect that the request did not

originate with your application.

Page 20: Douglas Crockford - Ajax Security

An attacker can read the document.

The attacker can see everything the user sees.

Page 21: Douglas Crockford - Ajax Security

An attacker has control over the display and can request information from the user.

The user cannot detect that the request did not originate

with your application.

Page 22: Douglas Crockford - Ajax Security

An attacker can send information to servers anywhere in the world.

Page 23: Douglas Crockford - Ajax Security

The browser does not prevent any of these.

That's why they happen.

Page 24: Douglas Crockford - Ajax Security

The consequences of a successful attack are

horrible.

Harm to customers. Loss of trust.

Legal liabilities.

Possible criminal penalties.

Page 25: Douglas Crockford - Ajax Security

The vulnerabilities are required by Web

Standards.The consequences of

standard behavior, not bugs.

Page 26: Douglas Crockford - Ajax Security

“and God gave us the Web Standards, and deviation from the Web Standards is the source of All Evil!”

There is no truth in that statement.

Page 27: Douglas Crockford - Ajax Security

The web was once a driver of innovation.

The web is now the obstacle of innovation.

Web development requires mastery of the workaround.

You can't work around security.

Page 28: Douglas Crockford - Ajax Security

If there is script from two or more sources, the application

is not secure.

A mashup is a self-inflicted XSS attack.

Page 29: Douglas Crockford - Ajax Security

Confusion of Interest

Computer

System Mode

Page 30: Douglas Crockford - Ajax Security

Confusion of Interest

System

System Mode

User

Page 31: Douglas Crockford - Ajax Security

Confusion of Interest

System

System Mode

User User User

Page 32: Douglas Crockford - Ajax Security

Confusion of Interest

CP/M MS-DOS MacOS Windows

System Mode

Page 33: Douglas Crockford - Ajax Security

Confusion of Interest

System ModeThe System cannot distinguish the

interest of the user from the interest of any program. This enables floppy-

borne viruses.

Page 34: Douglas Crockford - Ajax Security

Confusion of Interest

System Mode

When networking is introduced, network-borne viruses are enabled.

Page 35: Douglas Crockford - Ajax Security

User

Confusion of Interest

Browser

System Mode

Site Site Site

The browser is a significant improvement, able to distinguish the interests of users and sites (in some

cases).

Page 36: Douglas Crockford - Ajax Security

But within a page, interests are confused.

An ad or a widget or an Ajax library gets the same rights

as the site's own scripts.

Page 37: Douglas Crockford - Ajax Security

JavaScript got close to getting it right.

Except for the Global Object. And some other bad parts.

It can be repaired, becoming an object capability language.

Page 38: Douglas Crockford - Ajax Security

An Introduction toObject Capabilities

Page 39: Douglas Crockford - Ajax Security

A is an Object.

Object A has state and behavior.

A

Page 40: Douglas Crockford - Ajax Security

Object A has a reference to

Object B.

A

B

An object can have references to other

objects.

has-a

Page 41: Douglas Crockford - Ajax Security

...because it has a

reference to Object B.

Object A can communicate with Object

B...A

B

Page 42: Douglas Crockford - Ajax Security

Object B provides an

interface that constrains

access to its own state and

references.

A

B

Object A does not get access to Object B's

innards.

Page 43: Douglas Crockford - Ajax Security

Object A does not have a reference to Object C, so Object A cannot communicate with Object

C.

A

BIn an Object

Capability System, an object can only

communicate with objects that it has

references to.

C

Page 44: Douglas Crockford - Ajax Security

An Object Capability System is produced by constraining the ways that references are

obtained.

A reference cannot be obtained simply by knowing

the name of a global variable or a public class.

Page 45: Douglas Crockford - Ajax Security

There are exactly three ways to obtain a reference.

1. By Creation.

2. By Construction.

3. By Introduction.

Page 46: Douglas Crockford - Ajax Security

1. By Creation

If a function creates an object, it gets a reference to

that object.

Page 47: Douglas Crockford - Ajax Security

2. By Construction

An object may be endowed by its constructor with references.

This can include references in the constructor's context and inherited

references.

Page 48: Douglas Crockford - Ajax Security

3. By Introduction

A

BC

A has a references to B and C.B has no references, so it cannot communicate with A or C.C has no references, so it cannot communicate with A or B.

Page 49: Douglas Crockford - Ajax Security

3. By Introduction

A

BC

A calls B, passing a reference to C.

Page 50: Douglas Crockford - Ajax Security

3. By Introduction

A

BC

B is now able to communicate with C.

It has the capability.

Page 51: Douglas Crockford - Ajax Security

If references can only be obtained by Creation,

Construction, or Introduction, then you may have a safe

system.

Page 52: Douglas Crockford - Ajax Security

If references can be obtained in any other way, you do

not have a safe system.

Page 53: Douglas Crockford - Ajax Security

Good Object Capability Design

is

Good Object Oriented Design

Page 54: Douglas Crockford - Ajax Security

Short term fixes

• Safe JavaScript subsets can offer some safety now.

Caja, Cajita, ADsafe.

• Progress is also being made in Vat architecture.

A vat is a leak-proof computing vessel.

Capabilities can be used to allow communication between vats.

Browser plugins, Google Gears.

Page 55: Douglas Crockford - Ajax Security

Three Possible Solutions

• Safe JavaScript subsets.

Timeframe: Immediate

• Communicating Vats.

Timeframe: Intermediate

• Secure Programming Language.

Timeframe: Distant

• All of the Above.

Page 56: Douglas Crockford - Ajax Security

How Do We Move the Web Forward?

Page 57: Douglas Crockford - Ajax Security

Browser

War!Never again.

Page 58: Douglas Crockford - Ajax Security

The Web Depends on Standards

• Openness is hugely attractive.

• The standards are bad.

• In order to change the web, we must change its standards.

Page 59: Douglas Crockford - Ajax Security

A revision to a standard is an act of violence.

Surgery.

Pain. Injury. Inconvenience.

Users of web standards cannot opt out.

Page 60: Douglas Crockford - Ajax Security

Not only are the web's standards broken, the

web's standards process is broken.

Page 61: Douglas Crockford - Ajax Security

Design by Committee.

Porkbarrel standards making.

Page 62: Douglas Crockford - Ajax Security

Minimalism should be highly valued in

standards.Committees are not good

at minimalism.

Page 63: Douglas Crockford - Ajax Security

The standards process is entertaining too much speculative technology.

ECMAScript's Close Call

Page 64: Douglas Crockford - Ajax Security

ECMAScript

• The ES4 Proposal contained a lot of pork.

• It lacked a credible value proposition.

• The design progress went years over schedule.

• ES4 was ultimately abandoned.

• Instead, the modest ES3.1 Proposal brings the standard more inline with reality.

• It adds a small set of necessary features.

Page 65: Douglas Crockford - Ajax Security

A standards process must be risk averse.

Once an error gets into a standard, it can be virtually

impossible to get it out.

Page 66: Douglas Crockford - Ajax Security

The Dilemma:

Good Standards happen slowly and our need is urgent.

The web standards are currently frustrating progress and

endangering everyone who uses the web.

Page 67: Douglas Crockford - Ajax Security

Web Time used to mean

really fast.

ECMAScript 3: 1999.

HTML 4.01: 1999.

Page 68: Douglas Crockford - Ajax Security

Browser

War!We need a Browser War!

Page 69: Douglas Crockford - Ajax Security

The only thing worse than where we were

is where we are.

Page 70: Douglas Crockford - Ajax Security

Bring It On

• It turns out that Browser War is a good thing.

• It introduces chaos into the marketplace.

• Most of the cost of that chaos is borne by web developers and users.

• The market is generally better than self-selected committees in determining the value of things.

Page 71: Douglas Crockford - Ajax Security

The marketplace must be more effective this time in

punishing bad behavior.

Yahoo!’s Graded Browser Support Program

Page 72: Douglas Crockford - Ajax Security

This Site Requires Netscape 3

Page 73: Douglas Crockford - Ajax Security

Innovation should happen in research laboratories,

startups, and forward-looking companies.

Not in Standards bodies.

Page 74: Douglas Crockford - Ajax Security

Standards should have a conservative process that

documents the best of what has been proven useful.

Page 75: Douglas Crockford - Ajax Security

The drafting of standards is difficult, important

business.

Page 76: Douglas Crockford - Ajax Security

Standards should not be inventions.

Standards should be agreements.

Standards should work.

Page 77: Douglas Crockford - Ajax Security

We should also be looking past the Web.

The web was a disruptive technology.

The Web needs to be disrupted.

Page 78: Douglas Crockford - Ajax Security

I’ll see you in the

trenches!