Sunday, 1 December 2013

Crack your JVM

Wanna crash you JVM ? Just try the following code but only at your own risk . Ensure that you have tools.jar in your classpath both at compile time and run time . This not only crashes the   just the JVM it was deployed to, but also the virtual and/or physical machine underneath.

public class Crash {
  public static void main(String... args) throws Exception {
    com.sun.tools.attach.VirtualMachine.attach("-1");
  }

}

We are trying to attach ourselves to an already existing Java process specifying -1 as the process id. Instead of failing nicely you get something similar to the blue screen of death.

No comments:

Post a Comment