Solution for java.lang.ClassNotFoundException when loading your Burp Suite extention

When building your own Burp Suite extension, it can occur that compiling your code and creating the jar works find, but that you get the exception java.lang.ClassNotFoundException when loading your extention in Burp Suite. This article shows the solution to your problem.

The reason is suite simple: Burp Suite expects to find your implementation in a Java package called "burp". Having the line package burp; in your source files is not enough! You also have to take this into account when creating your jar file.

You can easily verify if this is the cause of your problem: open your JAR file with an unzip program (such as WinZip or 7-Zip). You'll will probably see a bunch a class files and a META-INF folder. What burp expects however is to find all class files into a burp folder.

So what happens is that burp opens your JAR file, searches for the folder burp and the file BurpExtender.class. Since it doesn't find this, it gives you this exception stack trace:
java.lang.ClassNotFoundException: burp.BurpExtender at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at burp.wpc.a(Unknown Source)
at burp.wpc.(Unknown Source)
at burp.x4c.a(Unknown Source)
at burp.ht.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

So there are two solutions:

  1. Unzip the JAR file, move all class files into a folder called burp, and create a new JAR by zipping the META-INF and burp folder. When doing this, make your that you give your zipped file the extension .jar
  2. Or do it the nice way: when creating your jar file, make sure that you execute the jar command from within a directory that has a subdirectory called burp containing all class files. The command your have to give is the following:
    jar cf burpextender.jar burp
  3. More detailed instructions on building a Burp Suite extension using command-line tools can be found here: http://www.vanstechelman.eu/content/creating-and-building-burp-suite-ext...

Tags: 

You might also be interested in...