ConScript
Specifying and Enforcing Fine-Grained Security Policies for JavaScript in the Browser
Leo Meyerovich UC Berkeley Benjamin Livshits Microsoft Research
ConScript Specifying and Enforcing Fine-Grained Security Policies - - PowerPoint PPT Presentation
ConScript Specifying and Enforcing Fine-Grained Security Policies for JavaScript in the Browser Leo Meyerovich Benjamin Livshits UC Berkeley Microsoft Research Web Programmability Platform openid.net yelp.com adsense.com Google maps 2
Leo Meyerovich UC Berkeley Benjamin Livshits Microsoft Research
2
yelp.com
adsense.com Google maps
3
4
Can’t trust other people’s code
5
6
7
8
manifest of script URLs HTTP-only cookies resource blacklists limit eval no foreign links no hidden frames script whitelist <noscript> no URL redirection no pop-ups enforce public
9
10
11
function eval heap
document window x y z … div
eval eval foo bar
12
13
a r
n d E x t ( p
t M e s s a g e, f u n c t i
( p m 2 , m , u r i ) { … } ) ;
a r
n d N a t ( e v a l , f u n c t i
( e v a l , s t r ) { … } ) ;
a r
n d F n c ( f
f u n c t i
( f
, a r g 1 ) { … } ) ;
aroundInl(function (src) { return src + „;‟ + pol;});
14
15
16
17
window.postMessage frame2.postMessage JavaScript interpreter IE8 libraries (HTML, Networking, …) postMessage 0xff34e5 arguments: “hello”, “evil.com” call advice aroundExt(window.postMessage,
0xff34e5
); advice dispatch [not found] 0xff34e5
18
advice on advice off
19
advice on
advice off advice on
20
21
script whitelist no eval no innerHTML no hidden frames
no inline scripts
22
23
24
25
26
27
– Function.prototype.apply, exn.stacktrace, myFunction.callee, arguments.caller, myFunction.toString, Function.prototype.call
28
29
30
31
eval new Function(“string”) postMessage XDomainRequest xmlHttpRequest …
32
33
C# JavaScript
Script# compiler
ConScript
34
35
36
0.5 1 1.5 2 2.5 3 3.5 4
wrap bless autobless
37
1.0 1.7 4.8 1.2 1.0 1.5 3.9 10.4 1.0 1.5 4.4 1.5 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 ConScript Docomo Caja Sandbox MSN GMail Google Maps
38
7% 1% 30% 73% 63%
0% 20% 40% 60% 80% Google Maps (183ms) MSN (439ms) GMail (736ms) Runtime overhead ConScript DoCoMo (JavaScript rewriting)
291.05 155.5 297.45 156.9
100 200 300 400 Application Loading Opening a Folder Runtime (ms) Uninstrumented Secured Private Methods
39
manifest of URLs limit eval no foreign links resource blacklists no hidden frames script whitelist <noscript> no URL redirection HTTP-only cookies no pop-ups enforce public
40
1.0 1.7 4.8 1.2 1.0 1.5 3.9 10.4 1.0 1.5 4.4 1.5 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 ConScript Docomo Caja Sandbox MSN GMail Google Maps 0.5 1 1.5 2 2.5 3 3.5 4 wrap bless autobless 7% 1% 30% 73% 63% 0% 100% Google Maps (183ms) MSN (439ms) GMail (736ms) Runtime
ConScript DoCoMo (JavaScript rewriting) 291.05 155.5 297.45 156.9 100 200 300 400 Application Loading Opening a Folder Runtime (ms) Uninstrumented Secured Private Methods
41