j k using dynamic analysis to crawl and test modern web
play

jk: Using Dynamic Analysis to Crawl and Test Modern Web Applications - PowerPoint PPT Presentation

jk: Using Dynamic Analysis to Crawl and Test Modern Web Applications Giancarlo Pellegrino (1) , Constantin Tschrtz (2) , Eric Bodden (2) , and Christian Rossow (1) 18th International Symposium on Research in Attacks, Intrusions and Defenses


  1. jÄk: Using Dynamic Analysis to Crawl and Test Modern Web Applications Giancarlo Pellegrino (1) , Constantin Tschürtz (2) , Eric Bodden (2) , and Christian Rossow (1) 18th International Symposium on Research in Attacks, Intrusions and Defenses November 3rd, Kyoto, Japan (1) CISPA, Saarland University, Germany (2) Fraunhofer SIT / TU Darmstadt, Germany

  2. Web Application Scanners  (Semi-)automated security testing tools  Follow a dynamic and black-box testing approach Nov. 3, 2016

  3. Web Application Scanners  (Semi-)automated security testing tools  Follow a dynamic and black-box testing approach Nov. 3, 2016

  4. Architecture Crawler Module Attacker Module Analysis Module Nov. 3, 2016

  5. Crawler Seed URL http://shop.foo http://shop.foo Nov. 3, 2016

  6. Crawler http://shop.foo <html> <head> <title>Online shopping</title> </head> <body> <a href=”/contacts”>Contacts</a> <form action=”/search”> <input type=”text” name=”q”/> <input type=”submit”/> </form> </body> </html> Nov. 3, 2016

  7. Crawler http://shop.foo <html> <head> <title>Online shopping</title> </head> <body> <a href=”/contacts”>Contacts</a> <form action=”/search”> <input type=”text” name=”q”/> <input type=”submit”/> </form> </body> </html> New URL Nov. 3, 2016

  8. Crawler http://shop.foo <html> <head> <title>Online shopping</title> </head> <body> <a href=”/contacts”>Contacts</a> <form action=”/search”> <input type=”text” name=”q”/> <input type=”submit”/> </form> </body> </html> New search HTML form Nov. 3, 2016

  9. Crawler Next? http://shop.foo/contacts Nov. 3, 2016

  10. Crawler http://shop.foo/contacts <html> <head> <title>Contact Page</title> </head> <body> <form action=”/comments”> <input type=”text” name=”msg”/> <input type=”submit”/> </form> </body> </html> New HTML form Nov. 3, 2016

  11. Security Testing XSS payload SQL payload XSS payload SQL payload <form action=”/search”> shop.foo Tests == Attacks <input type=”text” name=”q”/> <input type=”submit”/> </form> Responses ? Nov. 3, 2016

  12. Crawler Critical for Coverage  Crawler explores the Web application attack surface ● Missing parts → missing possible vulnerabilities  Existing crawlers based on: ● HTML parsing and pattern matching to extract URLs ● “clickable” areas to further explore the surface Nov. 3, 2016

  13. Crawler and Modern Web Applications  Complexity of client side has dramatically increased (i.e., stateful JS programs) Nov. 3, 2016

  14. Crawler and Modern Web Applications  Complexity of client side has dramatically increased (i.e., stateful JS programs)  Links and forms can be built and inserted in the webpage at run-time var url = scheme() + '://' + domain() + '/' + endpoint(); document.getElementByID('myLink').href = url; ➔ HTML parsing and pattern matching no longer sufficient Nov. 3, 2016

  15. Crawler and Modern Web Applications  Complexity of client side has dramatically increased (i.e., stateful JS programs)  Links and forms can be built and inserted in the webpage at run-time var url = scheme() + '://' + domain() + '/' + endpoint(); document.getElementByID('myLink').href = url; ➔ HTML parsing and pattern matching no longer sufficient  JS is an event-driven language click generate URLs/HTML form mouse movement register new events timeout Ajax requests Ajax response received ● Functions executed upon events ➔ Lack of support of event-based execution model Nov. 3, 2016

  16. Crawler and Modern Web Applications  Complexity of client side has dramatically increased (i.e., stateful JS programs)  Links and forms can be built and inserted in the webpage at run-time var url = scheme() + '://' + domain() + '/' + endpoint(); document.getElementByID('myLink').href = url; ➔ HTML parsing and pattern matching no longer sufficient  JS is an event-driven language click generate URLs/HTML form mouse movement register new events timeout Ajax requests Ajax response received ● Functions executed upon events ➔ Lack of support of event-based execution model Large part of web applications remain unexplored! Large part of web applications remain unexplored! Nov. 3, 2016

  17. Crawler and Modern Web Applications  Complexity of client side has dramatically increased (i.e., stateful JS programs)  Links and forms can be built and inserted in the webpage at run-time var url = scheme() + '://' + domain() + '/' + endpoint(); document.getElementByID('myLink').href = url;  We addressed the coverage problem with ➔ HTML parsing and pattern matching no longer sufficient ● JavaScript client side dynamic analysis  JS is an event-driven language ● Model-based Crawler click generate URLs/HTML form  Build a tool: jÄk mouse movement register new events timeout Ajax requests Ajax response received ● Functions executed upon events ➔ Lack of support of event-based execution model Large part of web applications remain unexplored! Large part of web applications remain unexplored! Nov. 3, 2016

  18. Our Approach Dynamic Analysis Model-based Crawler Action JS Engine Navigator I/O Probe Seed URL Handler reg. Model Inference/Update APIs Trace Trace Analysis  Combine dynamic analysis with model-based crawler ● Dynamic analysis monitors client side program execution ● Crawler builds, maintains, uses a model of the visited attack surface Nov. 3, 2016

  19. Dynamic Analysis Action JS Engine Environment Navigator I/O Probe Seed URL Handler reg. Model Inference/Update APIs Trace Trace Analysis  Different approaches: Nov. 3, 2016

  20. Dynamic Analysis Action JS Engine Environment Navigator I/O Probe Seed URL Handler reg. Model Inference/Update APIs Trace Trace Analysis  Different approaches: 1) JS engine instrumentation → laborious task, engine-dependent Nov. 3, 2016

  21. Dynamic Analysis Action JS Engine Environment Navigator I/O Probe Seed URL Handler reg. Model Inference/Update APIs Trace Trace Analysis  Different approaches: 1) JS engine instrumentation → laborious task, engine-dependent 2) JS program instrumentation → JS code is not entirely available Nov. 3, 2016

  22. Dynamic Analysis Action JS Engine Environment Navigator I/O Probe Seed URL Handler reg. Model Inference/Update APIs Trace Trace Analysis  Different approaches: 1) JS engine instrumentation → laborious task, engine-dependent 2) JS program instrumentation → JS code is not entirely available 3) Modification of execution environment Nov. 3, 2016

  23. Dynamic Analysis Action JS Engine Environment Navigator I/O Probe Seed URL Handler reg. Model Inference/Update APIs  Modify execution environment via function hooking : Intercept API calls (e.g., network I/O and event handler registration) ● Object manipulations (i.e., object properties) ● Schedule DOM inspections ●  Hooks installed by injecting own JS code: Function redefinition ● Set functions ● Nov. 3, 2016

  24. Function Redefinition function handler() { alert("hello world"); Application JS code } el = document.getElementByID('img') el.addEventListener("click", handler); Nov. 3, 2016

  25. Function Redefinition function handler() { alert("hello world"); } el = document.getElementByID('img') el.addEventListener("click", handler); Nov. 3, 2016

  26. Function Redefinition function handler() { alert("hello world"); } el = document.getElementByID('img') el.addEventListener("click", handler); Nov. 3, 2016

  27. Function Redefinition Element.prototype.addEventListener = function(e, h) { Element.prototype.addEventListener = function(e, h) { function handler() { […] API […] API alert("hello world"); listeners[e].append(h); listeners[e].append(h); } } } el = document.getElementByID('img') el.addEventListener("click", handler); Nov. 3, 2016

  28. Function Redefinition Element.prototype.addEventListener = function(e, h) { Element.prototype.addEventListener = function(e, h) { function handler() { […] API […] API alert("hello world"); listeners[e].append(h); listeners[e].append(h); } } } el = document.getElementByID('img') el.addEventListener("click", handler); Intercept! Intercept! Nov. 3, 2016

  29. Function Redefinition preamble function handler() { alert("hello world"); Application JS code } el = document.getElementByID('img') el.addEventListener("click", handler); var orig_f = Element.prototype.addEventListener; var orig_f = Element.prototype.addEventListener; PREAMBLE PREAMBLE Element.prototype.addEventListener = function(){ Element.prototype.addEventListener = function(){ console.log("new handler registration"); console.log("new handler registration"); return orig_f.apply(this, argument); return orig_f.apply(this, argument); }; }; Nov. 3, 2016

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend