Evaluating the Flexibility of the Java Sandbox

Evaluating the Flexibility of the Java Sandbox

Evaluating the Flexibility of the Java Sandbox Zack Coker, Michael Maass, Tianyuan Ding, Claire Le Goues, and Joshua Sunshine Carnegie Mellon University {zfc,mmaass}@cs.cmu.edu, [email protected], {clegoues,sunshine}@cs.cmu.edu ABSTRACT should protect both the host application and machine from The ubiquitously-installed Java Runtime Environment (JRE) malicious behavior. In practice, these security mechanisms provides a complex, flexible set of mechanisms that support are problematically buggy such that Java malware is often the execution of untrusted code inside a secure sandbox. able to alter the sandbox's settings [4] to override security However, many recent exploits have successfully escaped the mechanisms. Such exploits take advantage of defects in either sandbox, allowing attackers to infect numerous Java hosts. the JRE itself or the application's sandbox configuration to We hypothesize that the Java security model affords devel- disable the security manager, the component of the sandbox opers more flexibility than they need or use in practice, and responsible for enforcing the security policy [5, 6, 7, 8]. thus its complexity compromises security without improving In this paper, we investigate this disconnect between theory practical functionality. We describe an empirical study of the and practice. We hypothesize that it results primarily from ways benign open-source Java applications use and interact unnecessary complexity and flexibility in the design and with the Java security manager. We found that developers engineering of Java's security mechanisms. For example, regularly misunderstand or misuse Java security mechanisms, applications are allowed to change the security manager at that benign programs do not use all of the vast flexibility runtime, whereas static-only configuration of the manager afforded by the Java security model, and that there are clear would be more secure. The JRE also provides a number of differences between the ways benign and exploit programs security permissions that are so powerful that a sandbox that interact with the security manager. We validate these results enforces any of them cannot be secure. We hypothesize that by deriving two restrictions on application behavior that benign applications do not need all of this power, and that restrict (1) security manager modifications and (2) privilege they interact with the security manager in ways that are escalation. We demonstrate that enforcing these rules at measurably different from exploits. If true, these differences runtime stop a representative proportion of modern Java can be leveraged to improve the overall security of Java 7 exploits without breaking backwards compatibility with applications, and prevent future attacks. benign applications. These practical rules should be enforced To validate these insights, we conducted an empirical study in the JRE to fortify the Java sandbox. to answer the question: How do benign applications interact with the Java security manager? We studied and character- ized those interactions in 36 open-source Java projects that 1. INTRODUCTION use the security manager, taken from the Qualitas Corpus There are three broad reasons that Java is such a popular [9] and GitHub. target for attackers. First, the Java Runtime Environment We discovered two types of security managers in practice. (JRE) is widely installed on user endpoints. Second, the Defenseless managers enforce a policy that allows sandboxed JRE can and often does execute external code, in the form of code to modify sandbox settings. Such applications are inher- applets and Java Web Start (JWS) applications [1, 2]. Finally, ently insecure, because externally-loaded malicious code can there are hundreds of known and zero-day vulnerabilities [3] modify or disable the security manager. We found defense- in Java. In the common scenario, often referred to as a less managers in use by applications that modified sandbox \drive-by download," attackers lure users to a website that settings at runtime, typically as workarounds to using more contains a hidden applet to exploit JRE vulnerabilities. complicated (but more correct) security mechanisms or to en- In theory, such attacks should not be so common: Java force policies or implement functionality unrelated to security. provides a sandbox to enable the safe execution of untrusted We believe that such applications use the sandbox to imple- code and to isolate components from one another. This ment certain non-security requirements because Java does not provide better mechanisms for doing so. The sandbox is Permission to make digital or hard copies of all or part of this work for personal or not intended to be used this way, and these use cases both classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation reduce security in practice and limit the potential exploit on the first page. Copyrights for components of this work owned by others than the mitigations that are backwards compatible with benign appli- author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or cations. On the other hand, applications with self-protecting republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. managers do not allow sandboxed code to modify security ACSAC ’15, December 07 - 11, 2015, Los Angeles, CA, USA settings. It might still be possible to exploit such applications c 2015 Copyright held by the owner/author(s). Publication rights licensed to ACM. due to defects in the JRE code that enforces security policies, ISBN 978-1-4503-3682-6/15/12. $15.00 but not due to poorly-deployed local security settings. DOI: http://dx.doi.org/10.1145/2818000.2818003 We found that software that uses the sandbox as intended| Class Loader Loads classes for protection from malicious external code|does not use its Defines a class's... vast flexibility. For these applications, the flexibility decreases Indicates where code originates their security without obviously benefiting the developers or Code Source application functionality. In fact, we found and reported a Associates a class with a... security vulnerability related to the sandbox in one of the Protection Domain Partitions program components by security level applications under study. Contains a set of... We propose two runtime rules that restrict the flexibility of Permissions Enables specific operations (e.g., write to file, connect to the sandbox and fortify Java against the two most common server, etc.) modern attack types without breaking backwards compat- Defined in a... ibility in practice. We evaluate our rules with respect to Policy Defines what a codebase is allowed to do their ability to guard against ten applets in a popular exploit development and delivery framework, Metasploit 4.10.01, Enforced by... that successfully attack unpatched versions of Java 7. Taken Security Manager Acts as the gateway to policy enforcement together, the rules stopped all ten exploits and did not break 1 backwards-compatibility when tested against a corpus of be- Figure 1: High-level summary of the Java sandbox. nign applications. We are engaged in an ongoing discussion on the OpenJDK security-dev mailing list about implement- ing runtime enforcement of these rules in the JVM itself. actions are disallowed. Policies written in the Java policy The contributions of this papers are as follows: language [11] define permission sets and their associated code • A study of open-source applications' interactions with the sources. By default, all classes not loaded from the local file security manager (Section 4). We identify open-source system are run within a restrictive sandbox that restricts applications that enforce constraints on sub-components their ability to interact with the host application or machine. via the Java sandbox, as well as unconventional behaviors The sandbox is activated by setting a security manager, that indicate usability and security problems that the Java which acts as the gateway between the sandbox and the rest security model can be improved to mitigate. of the application. Whenever a sandboxed class attempts to • An enumeration of Java permissions that make security execute a method with security implications, that method policies difficult to enforce (Section 2.2), a discussion of queries the security manager to determine if the operation real-world cases where these permissions are used (Sec- should be permitted. To perform a permission check, the tions 4.3 and 4.4), and a sandbox-bypassing exploit for a security manager walks the call stack to ensure each class in popular open-source application made vulnerable due to the current stack frame has the specific permission needed 2 their use (Section 4.4). to perform the action. • Two novel rules for distinguishing between benign and Missing checks in code that should be protected are a malicious Java programs, validated empirically (Section 5). common source of Java vulnerabilities, because the security- • A discussion of tactics for practically implementing the critical code must initiate the check. Note that such vulner- rules, with a case for direct JVM adoption (Section 5.1). abilities lie in the JRE itself (i.e., the code written by the Java developers), not in code using the sandbox to execute We begin by discussing necessary background on the Java untrusted code. sandbox and exploits (Section 2). We present the methodol- ogy and dataset for our empirical study in Section 3. The 2.2 Defenseless vs. self-protecting managers results of the study are discussed in Section 4, leading to our Java is flexible about when the sandbox is enabled, config- rules which are defined and evaluated in Section 5. Finally, ured, and reconfigured. The default case for web applets and we discuss limitations, cover related work, and conclude in applications that use Java Web Start is to set what we call a Sections 6, 7, and 8 respectively.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 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