1 / 22

Cross-Site Scripting Prevention with Dynamic Tainting and Static Analysis

By Philipp Vogt, Florian Nentwich , Nenad Jovanovic , Engin Kirda , Christopher Kruegel , and Giovanni Vigna Network and Distributed System Security(NDSS ‘07). Cross-Site Scripting Prevention with Dynamic Tainting and Static Analysis. Authors. Philipp Vogt

idola
Download Presentation

Cross-Site Scripting Prevention with Dynamic Tainting and Static Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. By Philipp Vogt, FlorianNentwich, NenadJovanovic,EnginKirda, Christopher Kruegel, and Giovanni Vigna Network and Distributed System Security(NDSS ‘07) Cross-Site Scripting Prevention with Dynamic Tainting and Static Analysis

  2. Authors • Philipp Vogt • Main developer of the XSS Attack Prevention in Firefox project • Cross site scripting detection • Giovanni Vigna • Associate Professor of UCSB • Web Security, Intrusion Detection

  3. Introduction[1/5] • Cross Site Scripting • An attack against web applications where malicious scripting code is injected into the output of an application that is further delivered to a user’s web browser • This scripting code transfers sensitive information tothe attacker • This information allows the attacker to impersonate the victim or hijack the victim’s session

  4. Introduction[2/5] • Cross Site Scripting Server XSS Code is executed Send to request with XSS Code Send to response with XSS Code Send to email with XSS code Sensitive information is trasfered Attacker Victim

  5. Introduction[3/5] • Stored XSSAttacker persistently stores the malicious code in a resource managed by the web application, such as a database. when the victim requests a dynamic page, The actual attack is carried out at a later time. • Reflected XSS The attack script is not persistently stored, instead, it is reflected(sent back) to the victim. • ExampleSending to the victim an email with a link that contains the malicious JavaScript code.

  6. Introduction[4/5] • Sensitive Data Sources

  7. Introduction[5/5] • The GoalJavaScript program can sendsensitive information only to the site fromwhich it was loadedSo the information flow of sensitive data is tracked inside the JavaScript engine of the browser. Whenever an attack is detected, the user is warned and given the possibility to stop the transfer.

  8. Dynamic Tainting[1/5] • Dynamic Tainting Sensitive data is first marked, and then, when this data is accessed by scripts running in the web browser, its use is dynamically tracked by system.it is sufficient to model the taint value associated with a piece of data as a simple boolean flag.

  9. Dynamic Tainting[2/5] • Taint Propagation • Assignments • Arithmetic and logic operations (+, -, &, etc.) • Control structures and loops (if, while, switch, for in) • Function call and eval

  10. Static Tainting[1/3] • Indirect Control DependencyTo cover both direct and indirect control dependencies, all possible program path in a scope need to be examined.Static analysis is necessary.

  11. Static Tainting[2/3] • Linear Static Taint AnalysisEnsure all variables that are assigned values (tainted or not) inside the tainted scope are also tainted.

  12. Static Tainting[3/3] • Stack Analysis • Instructions responsible for setting object properties do not specify the target object because of stack-based nature of JavaScript. • Abstraction stack which has boolean values.

  13. Data Transmission • The tainted data has to be transferred to a third party, using a variety of methods. • document.location. • source of an image in the web page. • Submitting a form in the web page. • XMLHttpRequest object.

  14. Evaluation[1/4] • XSS attacks • XSS sources that group’s members collected • Successful in detecting XSS • Manual test • The modified browser was used by the authors for web surfing on a daily basis • The overhead of is negligible. • The amount of false positives was low.

  15. Evaluation[2/4] • Automatic test • Integrate a web crawling engine into modified Firefox. • Visited 1,033,000 unique web pages • 88,589 (8.58%) web pages raised an XSS warning • The scripts are inserted into the web page with the consent of the web site owner.

  16. Evaluation[3/4] • Top -30 destination domain • These domains belong tocompanies that collectstatistics about traffic on web sites of their customers • Deny top 30 domains, reduce to 13,964(1.35%) • Reduced to 5,289 (0.51%) if only transfer of cookies were considered

  17. Evaluation[4/4] • Reasons of small false positives • Transfer of cookies to different domains, but within company borders (eg. cnn.net -> cnn.com) • Transfer of cookies between different domains, but same company (eg. discover.com -> unitedstreaming.com) • Our indirect control flow

  18. Conclusion • Prevent XSS attacks using a dynamic taint analysis and static analysis when necessary. • Integrate the solution into Firefox web browser by modifying its JavaScript engine. • Generate small false positives and feasible in practice.

  19. Extra - Dynamic Tainting[3/5] • Assignments • If the right-hand side of the assignment is tainted,then the target on the left-hand side is also tainted. x = document.cookie; • The variable that is assigned a tainted value is not the only object that must be tainted. • Arithmetic and Logic Operation • Javascript is a stack-based language. • First pop the operands from the stack and then push backthe result. • The result is tainted if one of the used operands is tainted.

  20. Extra - Dynamic Tainting[4/5] • Control Structures and Loops if the condition of a control structure tests a tainted value, a tainted scope is generated that covers the whole control structures. A variable is dynamically tainted only when its value is modified inside a scope during the actual execution of the program • Function CallsIf a function is defined in a tainted scope, the function itself (operations, parameters, return value) is also tainted • EvalIf eval is called in a tainted scope or if its parameter is tainted, a scope is generated.

  21. Extra - Dynamic Tainting[5/5] • Example

  22. Extra - Implementation • Extends Mozilla firefox 1.o pre • Two parts for containing tainted data objects • The javascript engine (Spider-Monkey) • Variable, functions, scopes, and objects • DOM tree • location.href, etc • Every time a JavaScript program attempts to transfer sensitive data, a check is performed to determine whether sensitive data is sent to own host

More Related