...
From a security point of view, the JVMTI provides access to fields that are normally inaccessible. The interface also provides facilities for changing the behavior of a running Java program; for example, threads can be suspended or stopped. The JVMTI profiling tools can measure the time that a thread takes to execute, leaving applications vulnerable to timing attacks.
Noncompliant Code Example
In this noncompliant code example, the JVMTI works by using agents that communicate with the running JVM. These agents are usually loaded at JVM startup via one of the command line options, -agentlib
or -agentpath
.
...
Agents may run under the default security manager without requiring any permissions to be granted. While the JVMTI is useful for debuggers and profilers, such levels of access are inappropriate for deployed production code.
Compliant Solution
Do not start the JVM with any agents enabled on a production machine. This compliant solution removes the -agentlib
command line argument and installs a security manager, as required by rule ENV02-J. Create a secure sandbox using a Security Manager.
...
Clear the environment variable JAVA_TOOL_OPTIONS
in the manner appropriate for your platform, for example, by setting it to an empty string value or by {{unset}}ing it. This prevents JVMTI agents from receiving arguments via this route.
Risk Assessment
Deploying a Java application with the JVM Tool Interface enabled can allow an attacker to monitor or modify its behavior.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
ENV07-J | low | unlikely | medium | P2 | L3 |
Automated Detection
Not amenable to automated static analysis.
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Bibliography
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4d26ae9b2638a431-024808e5-49f841b3-9f9dadc8-57dd9b57dacc9cc4a292dfcb"><ac:plain-text-body><![CDATA[ | [[JVMTI 2006 | AA. Bibliography#JVMTI 06]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="460d1dd95fcf3327-128f1954-43b749ad-a05e9f21-581a45b93f04d5c647ba8590"><ac:plain-text-body><![CDATA[ | [[Long 2005 | AA. Bibliography#Long 05]] | Section 2.6, The JVM Tool Interface | ]]></ac:plain-text-body></ac:structured-macro> |
...