Static Enforcement of Web Application Integrity
William Robertson and Giovanni Vigna {wkr,vigna}@cs.ucsb.edu
Computer Security Group UC Santa Barbara
13 August 2009
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 1 / 28
Static Enforcement of Web Application Integrity William Robertson - - PowerPoint PPT Presentation
Static Enforcement of Web Application Integrity William Robertson and Giovanni Vigna { wkr,vigna } @cs.ucsb.edu Computer Security Group UC Santa Barbara 13 August 2009 (UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 1 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 1 / 28
◮ easy to develop
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 2 / 28
◮ easy to develop ◮ easy to deploy
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 2 / 28
◮ easy to develop ◮ easy to deploy ◮ easy to update
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 2 / 28
◮ easy to develop ◮ easy to deploy ◮ easy to update ◮ accessible from everywhere
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 2 / 28
FAA Review of Web Applications Security and Intrusion Detection in Air Traffic Control Systems Report Number: FI-2009-049 Date Issued: May 4, 2009 (UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 3 / 28
FAA Review of Web Applications Security and Intrusion Detection in Air Traffic Control Systems Report Number: FI-2009-049 Date Issued: May 4, 2009 (UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 3 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 4 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 5 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 5 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 5 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 6 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 6 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 6 / 28
◮ Web application firewalls ◮ Automated static, dynamic analyses ◮ Penetration testing and code auditing
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 7 / 28
◮ Web documents and database queries treated as
◮ No knowledge of structure and content at the
◮ Developers responsible for manually sanitizing
◮ Failure to preserve integrity of document and
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 8 / 28
◮ Explicitly denote structure and content within
◮ Language is responsible for preserving application
◮ Lift burden as much as possible from the developer
◮ No testing, separate analyses, policy specifications
◮ Web application compiles → application is safe
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 9 / 28
◮ Haskell-based application framework prototype ◮ Application implemented as set of functions
◮ HTTP requests routed to functions ◮ Functions perform computations and return
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 10 / 28
Document DocHead DocBody TitleNode LinkNode DivNode AnchorNode TextNode DivNode TextNode (UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 11 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 12 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 12 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 12 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 12 / 28
◮ Type system restricts applications to constructing
◮ f :: HttpRequest -> App Document ◮ Framework is responsible for rendering tree into text
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 13 / 28
Document DocHead DocBody TitleNode LinkNode DivNode AnchorNode TextNode DivNode TextNode
<html> <head> <title>...</title> </head> <body> <div> <a href="...">...</a> </div> ... <div> </div> </body> </html>
Web Application Framework
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 14 / 28
◮ Nodes implement Render typeclass ◮ render sanitizes data given context
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 15 / 28
◮ Mechanism already exists to fix query structure –
◮ App monad controls access to database functions
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 16 / 28
◮ Mechanism already exists to fix query structure –
◮ App monad controls access to database functions
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 16 / 28
IO AppIO AppState AppConfig Application
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 17 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 18 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 18 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 18 / 28
SELECT ["*"] ["users"] IN "login" SET "admin" "test" "devel" (UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 19 / 28
◮ Performed control flow analysis of framework to
◮ Evaluated correctness of individual sanitization
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 20 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 21 / 28
◮ Test-driven approach to check correctness ◮ Number of invariants manually specified ◮ 1,000,000 random test cases generated using
◮ Test cases for malicious examples
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 22 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 23 / 28
◮ Implemented web application using three
◮ Haskell ◮ Pylons ◮ Tomcat
◮ Evaluated throughput and latency
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 24 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 25 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 26 / 28
◮ XSS and SQL injection stem from failure to enforce
◮ Type system allows framework to automatically
◮ Prototype framework is effective at preventing
◮ Reasonable latency and throughput performance
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 27 / 28
(UCSB SecLab) Static Web App Integrity Enforcement 13 August 2009 28 / 28