Skip to content

Commit 5aeeb3a

Browse files
author
Timo Mueller
committed
Fixed and validated qhelp
1 parent d0478ea commit 5aeeb3a

5 files changed

+17
-19
lines changed

java/ql/src/experimental/Security/CWE/CWE-665/InsecureRmiJmxEnvironmentConfiguration.qhelp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,11 @@ The filter should (ideally) only allow java.lang.String and disallow all other c
2626

2727
<p>The key-value pair can be set as following:</p>
2828

29-
<code>
30-
String stringsOnlyFilter = "java.lang.String;!*"; // Deny everything but java.lang.String
31-
32-
Map&lt;String, Object&gt; env = new HashMap&lt;String, Object&gt;;
33-
env.put(RMIConnectorServer.CREDENTIALS_FILTER_PATTERN, stringsOnlyFilter);
34-
</code>
29+
<sample src="example_filter_java_10.java" />
3530

3631
<p>For applications using Java 6u113 to 9:</p>
3732

38-
<code>
39-
// This is deprecated in Java 10+ !
40-
Map&lt;String, Object&gt; env = new HashMap&lt;String, Object&gt;;
41-
env.put (
42-
"jmx.remote.rmi.server.credential.types",
43-
new String[]{
44-
String[].class.getName(),
45-
String.class.getName()
46-
}
47-
);
48-
</code>
33+
<sample src="example_filter_java_9.java" />
4934

5035
<p>Please note that the JMX-RMI service is vulnerable in the default configuration.
5136
For this reason an initialization with a <code>null</code> environment is also vulnerable.</p>
@@ -56,11 +41,11 @@ For this reason an initialization with a <code>null</code> environment is also v
5641

5742
<p>The first example shows how an JMX server is initialized securely with the <code>JMXConnectorServerFactory.newJMXConnectorServer()</code> call.</p>
5843

59-
<sample src="CorrectJmxInitialisation.java" />
44+
<sample src="CorrectJMXConnectorServerFactoryEnvironmentInitialisation.java" />
6045

6146
<p>The second example shows how a JMX Server is initialized securely if the <code>RMIConnectorServer</code> class is used.</p>
6247

63-
<sample src="CorrectRmiInitialisation.java" />
48+
<sample src="CorrectRMIConnectorServerEnvironmentInitalisation.java" />
6449

6550
</example>
6651

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
String stringsOnlyFilter = "java.lang.String;!*"; // Deny everything but java.lang.String
2+
3+
Map<String, Object> env = new HashMap<String, Object>;
4+
env.put(RMIConnectorServer.CREDENTIALS_FILTER_PATTERN, stringsOnlyFilter);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This is deprecated in Java 10+ !
2+
Map<String, Object>; env = new HashMap<String, Object>;
3+
env.put (
4+
"jmx.remote.rmi.server.credential.types",
5+
new String[]{
6+
String[].class.getName(),
7+
String.class.getName()
8+
}
9+
);

0 commit comments

Comments
 (0)