Protecting Users by Confining JavaScript with COWL
Deian Stefan, Edward Z. Yang, Petr Marchenko, Alejandro Russo, Dave Herman, Brad Karp, David Mazières
Protecting Users by Confining JavaScript with COWL Deian Stefan, - - PowerPoint PPT Presentation
Protecting Users by Confining JavaScript with COWL Deian Stefan, Edward Z. Yang, Petr Marchenko, Alejandro Russo, Dave Herman, Brad Karp, David Mazires The Web No longer just a way of publishing static content The Web Now app
Deian Stefan, Edward Z. Yang, Petr Marchenko, Alejandro Russo, Dave Herman, Brad Karp, David Mazières
➤ Combine code and data from different parties!
chase.com weather.com
➤ Compartmentalize code into contexts (tabs, iframes,…) ➤ Disallow cross-origin reads from contexts & servers
chase.com chase.com weather.com weather.com
➤ Compartmentalize code into contexts (tabs, iframes,…) ➤ Disallow cross-origin reads from contexts & servers
chase.com chase.com weather.com weather.com
➤ Compartmentalize code into contexts (tabs, iframes,…) ➤ Disallow cross-origin reads from contexts & servers
chase.com chase.com weather.com weather.com
❌
➤ Third-party code can leak data ➤ Code runs with authority of page
➤ No secure third-party mashups!
chase.com evil.biz mint.cc chase.com hsbc.com
❌ ❌
chase.com evil.biz mint.cc chase.com hsbc.com
➤ Whitelist origins page can
communicate with
➤ Server whitelists origins allowed
to read the data
✓
❌ ❌
➤ Whitelist origins page can
communicate with
➤ Server whitelists origins allowed
to read the data
➤ E.g., mint.com-like client-side third-party mashup
➤ Privacy: bank doesn’t give mint.cc access to data ➤ Functionality: bank cedes user data to mint.cc
(or worse: user cedes bank credentials)
mint.cc chase.com hsbc.com
? ?
docs.google.com eff.org
chase.com sketchy.ru
chase.com
hsbc.com mint.cc chase.com
➤ E.g., chase wants to use password-strength checker
library needs to fetch list of common passwords
➤ Impose restrictions on how code uses data
chase.com sketchy.ru sketchy.ru
p4ssw0rd
➤ E.g., chase wants to use password-strength checker
library needs to fetch list of common passwords
➤ Impose restrictions on how code uses data
chase.com sketchy.ru sketchy.ru
p4ssw0rd
➤ E.g., chase wants to use password-strength checker
library needs to fetch list of common passwords
➤ Impose restrictions on how code uses data
chase.com sketchy.ru sketchy.ru
p4ssw0rd p4ssw0rd
p4ssw0rd
➤ E.g., chase wants to use password-strength checker
library needs to fetch list of common passwords
➤ Impose restrictions on how code uses data
chase.com sketchy.ru sketchy.ru
p4ssw0rd p4ssw0rd
weak! p4ssw0rd
Confinement for Haskell ➠ Hails Confinement for Java ➠ Jif! Change JavaScript to enforce IFC with JSFlow
➤ Highly optimized JITs ➤ Add 1 instruction on hot path ➠ no upstream!
➤ Ingrained notion of principals: origins ➤ Keep iframes, pages, etc. as security boundaries
➤ Isolation enforced across context boundaries
➤ No need to change language runtime! [BFlow]
➤ Attach policies to messages [Hails]
➤ Avoid changing existing communication APIs
➤ E.g., data sensitive to Chase: Label(“chase.com”) ➤ E.g., data sensitive to both Chase and HSBC:
Label(“chase.com”).and(“hsbc.com”)
chase.com
chase.com p4ssw0rd
hsbc.com
hsbc.com
➤ Pages, iframes, workers, servers
➤ Both servers & JavaScript can label messages ➤ The right way to share sensitive data!
chase.com
chase.com
chase.com
public p4ssw0rd chase.com
chase.com sketchy.ru
p4ssw0rd chase.com
sketchy.ru chase.com
chase.com
sketchy.ru
sketchy.ru
chase.com sketchy.ru
public
chase.com
sketchy.ru
sketchy.ru
chase.com sketchy.ru
public
chase.com
sketchy.ru
sketchy.ru
chase.com sketchy.ru
public p4ssw0rd
chase.com
chase.com
➤ I.e., add an origin to its label ➤ Can then read data from that origin ➤ Give up ability to write to contexts without it
sketchy.ru public
sketchy.ru sketch.ru
p4ssw0rd public
chase.com
➤ I.e., add an origin to its label ➤ Can then read data from that origin ➤ Give up ability to write to contexts without it
sketchy.ru p4ssw0rd chase.com public
sketchy.ru sketch.ru
p4ssw0rd public
chase.com
➤ I.e., add an origin to its label ➤ Can then read data from that origin ➤ Give up ability to write to contexts without it
sketchy.ru p4ssw0rd chase.com public
sketchy.ru sketch.ru
p4ssw0rd public p4ssw0rd chase.com
chase.com
➤ I.e., add an origin to its label ➤ Can then read data from that origin ➤ Give up ability to write to contexts without it
sketchy.ru chase.com p4ssw0rd chase.com public
sketchy.ru sketch.ru
p4ssw0rd
public p4ssw0rd
chase.com
➤ I.e., add an origin to its label ➤ Can then read data from that origin ➤ Give up ability to write to contexts without it
sketchy.ru chase.com p4ssw0rd chase.com public
sketchy.ru sketch.ru
p4ssw0rd
public p4ssw0rd weak!
➤ Mixed-granularity: label messages
mint.cc chase.com hsbc.com
mint.cc chase.com hsbc.com
chase.com
mint.cc chase.com hsbc.com
mint.cc chase.com hsbc.com
hsbc.com
mint.cc chase.com hsbc.com
mint.cc chase.com hsbc.com
chase.com
mint.cc chase.com hsbc.com
chase.com hsb.com
mint.cc chase.com hsbc.com
chase.com hsb.com
➤ No changes to JavaScript engines ➤ Maintain existing communication APIs ➤ For each page COWL only enabled on first use of API
docs.google.com eff.org
chase.com sketchy.ru
chase.com
hsbc.com mint.cc chase.com
➤ Does not affect pages that do not use COWL API
➤ Expect it to be friendly to developers
➤ Changes don’t touch JavaScript engine
➤ Malicious code may still covertly leak data ➤ COWL enforces MAC in addition to existing DAC
➤ Cannot just label and run existing apps ➤ Compartmentalizing applications requires thought
➤ Mainly concerned with untrusted code ➤ COWL also handles the mutually distrusting case
➤ Better fit for tightly-coupled libraries ➤ New semantics, 100x slowdown
➤ Modern web apps need to compute on sensitive data ➤ DAC is crucial, but insufficient!
➤ Naturally extends the existing web model ➤ Achieves both flexibility and privacy without slowdown