TS*: Taming the Un-typed Adversary in JavaScript

Slides:



Advertisements
Similar presentations
SYDJS July What is HaXe? Multi-platform language Open source ( Community driven Version 2.07 (around since 2005) Single syntax for.
Advertisements

A Program Transformation For Faster Goal-Directed Search Akash Lal, Shaz Qadeer Microsoft Research.
Safe TypeScript Aseem Rastogi University of Maryland, College Park
Taming JavaScript with F* Nikhil Swamy Microsoft Research.
Wysteria: A Programming Language for Generic, Mixed-Mode Multiparty Computations Aseem Rastogi Matthew Hammer, Michael Hicks (University of Maryland, College.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
WEAVING CODE EXTENSIONS INTO JAVASCRIPT Benjamin Lerner, Herman Venter, and Dan Grossman University of Washington, Microsoft Research.
GATEKEEPER MOSTLY STATIC ENFORCEMENT OF SECURITY AND RELIABILITY PROPERTIES FOR JAVASCRIPT CODE Salvatore Guarnieri & Benjamin Livshits Presented by Michael.
Computer Security: Principles and Practice EECS710: Information Security Professor Hossein Saiedian Fall 2014 Chapter 10: Buffer Overflow.
Presented by Vaibhav Rastogi.  Advent of Web 2.0 and Mashups  Inclusion of untrusted third party content a necessity  Need to restrict the functionality.
Mashup Security by Compilation Tamara Rezk These slides discuss joint work with Zhengqin Luo and Jose Santos February 22 nd, 2013.
North Shore.NET User Group Our Sponsors. North Shore.NET User Group Check out our new web site Next Meeting
Safe & Efficient Gradual Typing for TypeScript Aseem Rastogi University of Maryland, College Park Nikhil Swamy Cédric Fournet Gavin Bierman Panagiotis.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
Extensibility, Safety and Performance in the SPIN Operating System Bershad et al Presentation by norm Slides shamelessly “borrowed” from Stefan Savage’s.
Run-Time Storage Organization
Web Page Behavior IS 373—Web Standards Todd Will.
A Type System for Expressive Security Policies David Walker Cornell University.
Automatic Implementation of provable cryptography for confidentiality and integrity Presented by Tamara Rezk – INDES project - INRIA Joint work with: Cédric.
Phu H. Phung Chalmers University of Technology JSTools’ 12 June 13, 2012, Beijing, China Joint work with Lieven Desmet (KU Leuven)
JavaScript Demo Presented by … Jaisingh Sumit jain Sudhindra Taran Deep arora.
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
Major Sponsors Minor Sponsors. about John Liu Contents What is TypeScript Why do we need TypeScript How Demo Pinteresp Working with your existing JavaScript.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
1 Modular Software/ Component Software 2 Modular Software Code developed in modules. Modules can then be linked together to produce finished product/program.
Bootstrapping Trust in Commodity Computers Bryan Parno, Jonathan McCune, Adrian Perrig 1 Carnegie Mellon University.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
AJAX in ASP.NET James Crowley Developer Fusion
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
JavaScript Heap Analysis: From Browser Exploits to Safe JavaScript Subsets Adam Barth Joel Weinberger Matt Finifter Dawn Song University of California,
GRADUAL TYPING EMBEDDED SECURELY IN JAVASCRIPT Aseem Rastogi University of Maryland, College Park Joint Work With: Nikhil Swamy, Cédric Fournet, Karthikeyan.
Introducing NativeScript [Pavel Kolev Software Telerik: a Progress company]
Javascript: More features B. Ramamurthy 7/4/2014B. Ramamurthy, CSE651C1.
Introduction to TypeScript Sergey Barskiy Architect Level: Introductory.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
C C Implementation  Prototype based on Firefox 3.0b2 codebase/ Spidermonkey VM  Uses SM contexts to manage multiple JavaScript execution contexts simultaneously.
TypeScript Allan da Costa Pinto Technical Evangelist Microsoft.
Enhancing JavaScript with Transactions Mohan Dhawan †, Chung-chieh Shan ‡ and Vinod Ganapathy † † Department of Computer Science, Rutgers University ‡
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
CSCI Rational Purify 1 Rational Purify Overview Michel Izygon - Jim Helm.
Protecting Browsers from Extension Vulnerabilities Paper by: Adam Barth, Adrienne Porter Felt, Prateek Saxena at University of California, Berkeley and.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
WorldWide Telescope WWT HTML5 SDK WEB CONTROL WEB CLIENT DEVELOPMENT OVERVIEW RON GILCHRIST (WEB ON GITHUB NOV 7, 2015.
Introduction Program File Authorization Security Theorem Active Code Authorization Authorization Logic Implementation considerations Conclusion.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
JavaScript Dynamic Active Web Pages Client Side Scripting.
UNDERSTANDING YOUR OPTIONS FOR CLIENT-SIDE DEVELOPMENT IN OFFICE 365 Mark Rackley
Object-Oriented Programming “The Rest of the Story”, CS 4450 – Chapter 16.
John Liu. Senior Consultant for SharePoint Gurus Sydney User Groups, SharePoint Saturday, SharePoint Conferences,
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
The Ins and Outs of Gradual Type Inference Avik Chaudhuri Basil Hosmer Adobe Systems Aseem Rastogi Stony Brook University.
Enabling Control over Adaptive Program Transformation for Dynamically Evolving Mobile Software Validation Mike Jochen, Anteneh Anteneh, Lori Pollock University.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
JavaScript, Third Edition 1 SELECTION LIST Demo. JavaScript, Third Edition 2 Description This web page will edit the slection to ensure an option was.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
Introduction to.
Secure Programming Dr. X
Mitigation against Buffer Overflow Attacks
Secure Programming Dr. X
University of Washington
A Verified DSL for MPC in
SharePoint-Hosted Apps and JavaScript
JavaScript an introduction.
Ashish Pandit, Louis Zelus, Jonathan Whitman
Serverless Architecture in the Cloud
Language-based Security
JavaScript CS 4640 Programming Languages for Web Applications
How to debug a website using IE F12 tools
Run-time environments
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

TS*: Taming the Un-typed Adversary in JavaScript Aseem Rastogi (University of Maryland, College Park) Joint work with: Nikhil Swamy, Cedric Fournet, Juan Chen, Karthik Bhargavan, Pierre-Yves Strub, and Gavin Bierman

Writing Security Critical JavaScript Code is Hard ! 11/29/2018

Example – Html5 localStorage -- No schema -- No authorization localStorage.setItem(string, string), localStorage.getItem(string), … Client Storage 11/29/2018

Example – Html5 localStorage -- Enforce Schema -- Authorization -- Efficient High Integrity, Secure, Efficient Interface localStorage.setItem(string, string), localStorage.getItem(string), … Client Storage 11/29/2018

Let’s write Storage library in JavaScript ! JS Demo ! Let’s write Storage library in JavaScript ! 11/29/2018

That didn’t turn out well, huh ? JS Demo ! (Demo elided: The basic idea is that despite writing clean idiomatic code in JavaScript providing a localStorage API, when interacting with a malicious third-party script in the same page, the clean code can easily be subverted by the third-party. Attacks include prototype poisoning, global namespace corruption, stack walks, etc. ) That didn’t turn out well, huh ? 11/29/2018

Migration from JavaScript to TS* Security Critical Code in JS No Heap Separation No Heap Separation Low Effort Migration Other App Code in JS (e.g. UI) Third-party Code in JS (e.g. Ads) Complete Heap Separation Complete Heap Separation Security Critical Code in TS* Gradually-typed, Idiomatic JS 11/29/2018

Let’s try writing Storage library in TS* TS* Demo ! See: http://rise4fun.com/FStar/tutorial/tsStar Let’s try writing Storage library in TS* 11/29/2018

TS* Demo ! Pretty Cool, isn’t it ! 11/29/2018

Gradual Security 11/29/2018

TS* Tour with Example type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); 11/29/2018

TS* Tour with Example type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); 11/29/2018

TS*: Gradually Typed Gradual type system, compiles to JavaScript type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); Gradual type system, compiles to JavaScript Supports idiomatic JavaScript 11/29/2018

TS*: RTTI based Gradual Typing type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); Every value carries a type tag at run-time 11/29/2018

TS*: RTTI based Gradual Typing type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; ◄ r.x = 2; r.y = 3; foo ( r ); any { x = true } r: 11/29/2018

TS*: Type Safety in Any-typed Code type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; ◄ r.y = 3; foo ( r ); Instrumented with run time type checks Must respect RTTI tags 11/29/2018

TS*: Type Safety in Any-typed Code type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; ◄ r.y = 3; foo ( r ); Is r a record ? Does ( r.x = 2 ) respect r’s RTTI ? ✔ any { x = true } r: any { x = 2 } r: 11/29/2018

TS*: Type Safety in Any-typed Code type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; ◄ foo ( r ); Is r a record ? Does ( r.y = 3 ) respect r’s RTTI ? ✔ any { x = true } r: any { x = 2 } r: any { x = 2; y = 3 } r: 11/29/2018

TS*: RTTI Evolution Check that value has expected type … type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); ◄ Check that value has expected type … And tag it -- RTTI tags evolve Ensures type safety in the presence of mutable records 11/29/2018

TS*: RTTI Evolution ✔ Is r a Point ? type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); ◄ Is r a Point ? ✔ any { x = 2; y = 3 } r: Point { x = 2; y = 3 } r, s: 11/29/2018

TS*: Any-subtyping Seamless via Subtyping type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); ◄ return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); Seamless via Subtyping 11/29/2018

TS*: Type Safety in Any-typed Code type Point : { x : number; y : number }; function bar (t) { t.x = true; ◄ } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); Is t a record ? Does ( t.x = true ) respect t’s RTTI ? ✗ Point { x = 2; y = 3 } r, s, t: ( t.x = true ) fails s remains as is 11/29/2018

TS*: Statically-typed Code type Point : { x : number; y : number }; function bar (t) { t.x = true; } function foo ( s : Point ) : number { bar ( s ); return s.x + s.y; ◄ } var r = { x = true }; r.x = 2; r.y = 3; foo ( r ); Executes as is No runtime checks in statically-typed code 11/29/2018

TS*: Un – The Other Dynamic Type type Point : { x : number; y : number }; show : Un function foo ( s : Point ) : number { show ( s ); return s.x + s.y; } Interaction with Un-typed code mediated by wrappers Enforce heap separation from Un code 11/29/2018

TS*: Defensive Wrapper for Un type Point : { x : number; y : number }; show : Un function foo ( s : Point ) : number { show ( s ); ◄ return s.x + s.y; } wrap ( Un, Point unit ) ( show ) ( s ) var t1 = wrap ( Point, Un ) ( s ); /* makes a deep copy of s */ var t2 = show ( t1 ); wrap ( Un, unit) ( t2 ) 11/29/2018

TS* Summary Statically-typed code: Any-typed code: Un-typed code: No run-time type checks No run-time failures No performance penalty (except adding RTTI tags) Any-typed code: Instrumented with run-time type checks Respects RTTI tags set by the statically-typed code Un-typed code: Complete heap separation from TS* code 11/29/2018

You still don’t know all we did this summer ! Support for Arrays in TS* Performance Tweaking Formalization of TS* compilation in JSVerify† Type soundness proof Submitted TS* work to POPL’14 Spent couple of weeks reading Mental Poker ! †Swamy et. al. POPL’ 13 11/29/2018

TS* Summary TypeScript like surface language Gradual type system, compiles to JavaScript Not one, but two dynamic types Any and Un Type safe (unlike TypeScript) Even when interacting with malicious context 11/29/2018