1 *java.lang.RuntimePermission* *RuntimePermission* This class is for runtime perm
3 public final class RuntimePermission
4 extends |java.security.BasicPermission|
6 |java.lang.RuntimePermission_Description|
7 |java.lang.RuntimePermission_Fields|
8 |java.lang.RuntimePermission_Constructors|
9 |java.lang.RuntimePermission_Methods|
11 ================================================================================
13 *java.lang.RuntimePermission_Constructors*
14 |java.lang.RuntimePermission(String)|Creates a new RuntimePermission with the s
15 |java.lang.RuntimePermission(String,String)|Creates a new RuntimePermission obj
17 *java.lang.RuntimePermission_Description*
19 This class is for runtime permissions. A RuntimePermission contains a name
20 (also referred to as a "target name") but no actions list; you either have the
21 named permission or you don't.
23 The target name is the name of the runtime permission (see below). The naming
24 convention follows the hierarchical property naming convention. Also, an
25 asterisk may appear at the end of the name, following a ".", or by itself, to
26 signify a wildcard match. For example: "loadLibrary.*" or "*" is valid,
27 "*loadLibrary" or "a*b" is not valid.
29 The following table lists all the possible RuntimePermission target names, and
30 for each provides a description of what the permission allows and a discussion
31 of the risks of granting code the permission.
35 Permission Target Name What the Permission Allows Risks of Allowing this
38 createClassLoader Creation of a class loader This is an extremely dangerous
39 permission to grant. Malicious applications that can instantiate their own
40 class loaders could then load their own rogue classes into the system. These
41 newly loaded classes could be placed into any protection domain by the class
42 loader, thereby automatically granting the classes the permissions for that
45 getClassLoader Retrieval of a class loader (e.g., the class loader for the
46 calling class) This would grant an attacker permission to get the class loader
47 for a particular class. This is dangerous because having access to a class's
48 class loader allows the attacker to load other classes available to that class
49 loader. The attacker would typically otherwise not have access to those
52 setContextClassLoader Setting of the context class loader used by a thread The
53 context class loader is used by system code and extensions when they need to
54 lookup resources that might not exist in the system class loader. Granting
55 setContextClassLoader permission would allow code to change which context class
56 loader is used for a particular thread, including system threads.
58 enableContextClassLoaderOverride Subclass implementation of the thread context
59 class loader methods The context class loader is used by system code and
60 extensions when they need to lookup resources that might not exist in the
61 system class loader. Granting enableContextClassLoaderOverride permission would
62 allow a subclass of Thread to override the methods that are used to get or set
63 the context class loader for a particular thread.
65 setSecurityManager Setting of the security manager (possibly replacing an
68 The security manager is a class that allows applications to implement a
69 security policy. Granting the setSecurityManager permission would allow code to
70 change which security manager is used by installing a different, possibly less
71 restrictive security manager, thereby bypassing checks that would have been
72 enforced by the original security manager.
74 createSecurityManager Creation of a new security manager This gives code access
75 to protected, sensitive methods that may disclose information about other
76 classes or the execution stack.
78 getenv.{variable name} Reading of the value of the specified environment
79 variable This would allow code to read the value, or determine the existence,
80 of a particular environment variable. This is dangerous if the variable
81 contains confidential data.
83 exitVM.{exit status} Halting of the Java Virtual Machine with the specified
84 exit status This allows an attacker to mount a denial-of-service attack by
85 automatically forcing the virtual machine to halt. Note: The "exitVM.*"
86 permission is automatically granted to all code loaded from the application
87 class path, thus enabling applications to terminate themselves. Also, the
88 "exitVM" permission is equivalent to "exitVM.*".
90 shutdownHooks Registration and cancellation of virtual-machine shutdown hooks
91 This allows an attacker to register a malicious shutdown hook that interferes
92 with the clean shutdown of the virtual machine.
94 setFactory Setting of the socket factory used by ServerSocket or Socket, or of
95 the stream handler factory used by URL This allows code to set the actual
96 implementation for the socket, server socket, stream handler, or RMI socket
97 factory. An attacker may set a faulty implementation which mangles the data
100 setIO Setting of System.out, System.in, and System.err This allows changing the
101 value of the standard system streams. An attacker may change System.in to
102 monitor and steal user input, or may set System.err to a "null" OutputStream,
103 which would hide any error messages sent to System.err.
105 modifyThread Modification of threads, e.g., via calls to Thread interrupt,
106 stop, suspend, resume, setDaemon, setPriority, setName and
107 setUncaughtExceptionHandler methods This allows an attacker to modify the
108 behaviour of any thread in the system.
110 stopThread Stopping of threads via calls to the Thread stop method This allows
111 code to stop any thread in the system provided that it is already granted
112 permission to access that thread. This poses as a threat, because that code may
113 corrupt the system by killing existing threads.
115 modifyThreadGroup modification of thread groups, e.g., via calls to ThreadGroup
116 destroy, getParent, resume, setDaemon, setMaxPriority, stop, and suspend
117 methods This allows an attacker to create thread groups and set their run
120 getProtectionDomain Retrieval of the ProtectionDomain for a class This allows
121 code to obtain policy information for a particular code source. While obtaining
122 policy information does not compromise the security of the system, it does give
123 attackers additional information, such as local file names for example, to
124 better aim an attack.
126 getFileSystemAttributes Retrieval of file system attributes This allows code to
127 obtain file system information such as disk usage or disk space available to
128 the caller. This is potentially dangerous because it discloses information
129 about the system hardware configuration and some information about the caller's
130 privilege to write files.
132 readFileDescriptor Reading of file descriptors This would allow code to read
133 the particular file associated with the file descriptor read. This is dangerous
134 if the file contains confidential data.
136 writeFileDescriptor Writing to file descriptors This allows code to write to a
137 particular file associated with the descriptor. This is dangerous because it
138 may allow malicious code to plant viruses or at the very least, fill up your
141 loadLibrary.{library name} Dynamic linking of the specified library It is
142 dangerous to allow an applet permission to load native code libraries, because
143 the Java security architecture is not designed to and does not prevent
144 malicious behavior at the level of native code.
146 accessClassInPackage.{package name} Access to the specified package via a class
147 loader's loadClass method when that class loader calls the SecurityManager
148 checkPackageAccess method This gives code access to classes in packages to
149 which it normally does not have access. Malicious code may use these classes to
150 help in its attempt to compromise security in the system.
152 defineClassInPackage.{package name} Definition of classes in the specified
153 package, via a class loader's defineClass method when that class loader calls
154 the SecurityManager checkPackageDefinition method. This grants code permission
155 to define a class in a particular package. This is dangerous because malicious
156 code with this permission may define rogue classes in trusted packages like
157 java.security or java.lang, for example.
159 accessDeclaredMembers Access to the declared members of a class This grants
160 code permission to query a class for its public, protected, default (package)
161 access, and private fields and/or methods. Although the code would have access
162 to the private and protected field and method names, it would not have access
163 to the private/protected field data and would not be able to invoke any private
164 methods. Nevertheless, malicious code may use this information to better aim an
165 attack. Additionally, it may invoke any public methods and/or access public
166 fields in the class. This could be dangerous if the code would normally not be
167 able to invoke those methods and/or access the fields because it can't cast the
168 object to the class/interface with those methods and fields.
172 queuePrintJob Initiation of a print job request This could print sensitive
173 information to a printer, or simply waste paper.
175 getStackTrace Retrieval of the stack trace information of another thread. This
176 allows retrieval of the stack trace information of another thread. This might
177 allow malicious code to monitor the execution of threads and discover
178 vulnerabilities in applications.
180 setDefaultUncaughtExceptionHandler Setting the default handler to be used when
181 a thread terminates abruptly due to an uncaught exception This allows an
182 attacker to register a malicious uncaught exception handler that could
183 interfere with termination of a thread
185 preferences Represents the permission required to get access to the
186 java.util.prefs.Preferences implementations user or system root which in turn
187 allows retrieval or update operations within the Preferences persistent backing
188 store.) This permission allows the user to read from or write to the
189 preferences backing store if the user running the code has sufficient OS
190 privileges to read/write to that backing store. The actual backing store may
191 reside within a traditional filesystem directory or within a registry depending
198 *java.lang.RuntimePermission(String)*
200 public RuntimePermission(java.lang.String name)
202 Creates a new RuntimePermission with the specified name. The name is the
203 symbolic name of the RuntimePermission, such as "exit", "setFactory", etc. An
204 asterisk may appear at the end of the name, following a ".", or by itself, to
205 signify a wildcard match.
207 name - the name of the RuntimePermission.
209 *java.lang.RuntimePermission(String,String)*
211 public RuntimePermission(
212 java.lang.String name,
213 java.lang.String actions)
215 Creates a new RuntimePermission object with the specified name. The name is the
216 symbolic name of the RuntimePermission, and the actions String is currently
217 unused and should be null.
219 name - the name of the RuntimePermission.
220 actions - should be null.