Tick Tock: Building Browser Red Pills from Timing Side Channels

Tick Tock: Building Browser Red Pills from Timing Side Channels

Tick Tock: Building Browser Red Pills from Timing Side Channels Grant Ho Dan Boneh Lucas Ballard Niels Provos Stanford University Stanford University Google Google Abstract efficiency, not transparency [6]. That is, VMMs gener- ally do not attempt to hide their existence from specifi- Red pills allow programs to detect if their execution en- cally crafted code designed to detect them. vironment is a CPU emulator or a virtual machine. They are used by digital rights management systems and by malware authors. In this paper we study the possibility of Our contributions. In this paper we develop browser- browser-based red pills, namely red pills implemented as based red pills: red pills implemented in Javascript that Javascript that runs in the browser and attempts to detect run in the browser. The interest in browser-based red if the browser is running inside a virtual machine. These pills is a result of several systems that attempt to de- browser red pills can limit the effectiveness of Web mal- tect malicious content rendered in webpages. These sys- ware scanners: scanners that detect drive-by downloads tems run a browser in a CPU emulator or VM and crawl and other malicious content by crawling the Web using a the Web looking for malicious sites. The existence of browser in an emulated environment. We present multi- browser-based red pills can hamper these scanning ef- ple browser red pills that are robust across browser plat- forts since a malicious website can choose to withhold forms and emulation technology. We also discuss poten- malicious content if it detects (from the browser) that it tial mitigations that Web scanners can use to thwart some is in an emulated environment. This work is intended of these red pills. to alert Web scanning services to potential limitations of their scanning techniques. The challenge in designing browser-based red pills is 1 Introduction that the browser sandbox is a limited computing envi- ronment: Javascript cannot access the TLB, cannot read Red pills are pieces of code designed to detect if they instruction counters, and cannot look at registers. Thus, are being run inside a Virtual Machine (VM) or a CPU many of the techniques available to application-level red emulator1. Red pills have several applications such as: pills simply do not work in the browser. The main • Honeypot evasion [14]: Since honeypots often run tool left at our disposal is the browser’s timing features, in a virtual machine [15, 1, 10], red pills can help which have a granularity of a millisecond. malware evade honeypots: whenever malware de- tects CPU emulation in its execution environment, Results. We show that timing variations in standard it can decide not to infect the host. This makes it browser operations can reveal the existence of an em- harder for honeypots to detect the malware. ulation environment. By comparing the time that the browser takes to perform a simple baseline operation to • Digital Right Management (DRM): DRM-enabled the time the browser takes to do I/O, spawn Web workers, systems, such as a digital book reader or a movie render complex graphics, or write to local storage, we are player, can use red pills to ensure that DRM pro- able to detect emulation environments with high statisti- tected content will not play inside a VM. cal confidence. Not only do our red pills work against Previous work on red pills [6, 18, 14, 3, 5] develop any combination of the two latest versions of Windows red pills for native software, namely programs that run and three major browsers, but they also remain effective directly on the operating system. Some use low-level op- both against VMs that use binary translation for virtual- erations such as examining the TLB size; some examine ization and against VMs that use hardware-assisted vir- the contents of the operating system’s registers and pro- tualization. gram counters; and some use CPU cycle counters to de- We describe the implementation of multiple browser tect a VM-induced slow-down. The general consensus is red pills in Section 2 and present our evaluation results that Virtual Machine Monitors (VMMs) are designed for in Sections 3. We discuss potential defenses against these red pills in Section 4 and conclude with a survey of re- 1The name red pill comes from the movie, “The Matrix”. lated work. 1 2 Browser Red Pills • A “differential operation”, which has a significant and predictable difference in execution time be- Attack model: We consider a malicious website, tween virtual machines and normal machines. evil.com, that tries to redirect normal users to a ma- licious webpage, but evade detection by redirecting hon- After executing both operations, the red pills then com- eypots to a benign webpage. When evil.com is loaded pute an “adjusted” execution time for their differential on an unknown machine, it will execute our browser red operation by dividing the differential operation’s execu- pills to determine if it is being executed in a VM (hon- tion time by the baseline’s execution time. If the ex- eypot). We say that our browser red pills are effective pected value for this ratio differs detectably between a if evil.com can successfully redirect a VM to a benign virtual machine and a normal machine, then evil.com website and a normal user to a malicious website. can use the ratio to detect the presence of a VM. There are numerous practical implementations of this We use a baseline operation in our red pills to ac- attack model. For example, consider a scheme where count for performance differences that result from dif- evil.com executes our browser red pills and then sends ferent hardware/system configurations and varying back- the results to its server through an HTTP GET request. ground loads on a user’s machine. If we used just the raw The server can then process the results of the GET re- execution times of our differential operations, it could be quest and return a response that redirects the visitor to a unclear whether a longer execution time resulted from benign page if it suspects the visitor is a VM. older hardware, concurrent activity like watching a video We make the assumption that evil.com knows the in a separate tab, or being executed in a virtual machine. browser and operating system of the visiting machine. Existing literature on browser and device fingerprint- ing [13, 12, 11] presents a plethora of techniques that 2.2 Implementing Browser Red Pills easily allow a webpage to determine the visitor’s browser Each red pill is a snippet of Javascript that executes on and operating system, so we view this as a reasonable as- a visitor’s machine. A red pill executes and times the sumption. baseline operation and the differential operation. After- ward, the red pill computes the ratio of the differential 2.1 Designing Browser Red Pills operation’s execution time to the baseline operation’s ex- ecution time. The high-level structure of our red pills While several papers have discussed red pills for native is shown in Listing 1; while we used the Date object’s programs (executables that run directly on the operat- getTime() function for simplicity, any source of periodic ing system), many of these techniques are inapplicable timing can be used for timing measurements (e.g. other to browser red pills. Prior work on native red pills often Javascript timing objects, implicit wall clocks from peri- relies on detecting low-level anomalies in a system’s con- odic functions like requestAnimationFrame, etc.). figuration that are caused by the VM; for example, sev- function redpill() { eral prior red pills enumerate the machine’s hardware de- var time = new Date(); vices, check registers and memory addresses, or look for var baseStart = time.getTime(); debugging processes running on the machine to detect baselineOperation(); the presence of an emulation environment [18, 14, 3]. var baseTime = time.getTime() - baseStart; Unfortunately for attackers, the browser sandbox and var diffStart = time.getTime(); Javascript language restrict webpages from the low-level differentialOperation(); access that these native red pills use. Nonetheless, our var diffTime = time.getTime() - diffStart; work shows that despite these limitations, browser red return diffTime / baseTime; pills are still possible. By leveraging common Javascript } operations, whose execution times are consistently and significantly different in a VM, we are able to construct Listing 1: Structure of Browser Operation timing-based red pills that work completely inside of the browser, without the assistance of plugins or browser ex- We tested two baseline operations and six differential tensions. operations for our browser red pills. Our six differential Concretely, our browser red pills work by running two operations fall roughly into three broad categories: I/O operations on the visitor’s machine: operations, threading, and graphics. For an operation that depends on memory usage or • A “baseline operation”, which takes roughly the I/O, the size of the operation can have a significant im- same amount of time to execute on a normal ma- pact on its execution time and the red pill’s efficacy; if chine as it does on a virtual machine, and an I/O operation truly has a difference in execution time 2 between a VM and a normal machine, a differential op- To prevent unexpected browser optimization/string eration that executes a greater number of these I/O op- caching when our red pill webpage is reloaded for a new erations will elicit a larger, and more statistically sig- experiment, we randomized the string used in our DOM nificant time difference. Consequently, for operations baseline operation.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us