BuffaloWill / burpsuite-project-file-parser

A Burp Suite Extension for parsing Project Files from the CLI.
84 stars 14 forks source link

Running newly-built jar with dockerfile causes exception "java.lang.UnsupportedClassVersionError" #7

Open peterjmorgan opened 3 months ago

peterjmorgan commented 3 months ago

I'm able to build the jar successfully and install the extension burp. I get this error message when running: java -jar <path_to_burpsuite_pro.jar> --project-file <path_to_project_file> siteMap (or any other subcommands)

The error message is:

Exception in thread "main" java.lang.UnsupportedClassVersionError: burp/StartBurp has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

I suspect there is a way to change the gradle or jre version in docker to match what current burpsuite is using, but after trying a few ideas, I'm curious if anyone else has solved this.

BuffaloWill commented 1 month ago

Hi @peterjmorgan. I am sorry for the slow response. I rewrote the extension to use the Montoya API and updated gradle accordingly.

Could you try to rebuild the extension and run with the newest version?

sparky23172 commented 1 week ago

If you're still having this issue @peterjmorgan, try downloading a new version of Java. I get this error when using the base version of Java for my Kali machine vs using a newer version of Java.

I imagine the issue is the same inside docker since it's close to the version I was using on my machine

FROM gradle:8.1.1-jdk17 AS build WORKDIR /app COPY --chown=gradle:gradle . /app RUN gradle build --no-daemon

FROM openjdk:17-jdk-slim WORKDIR /app COPY --from=build /app/build/libs/*.jar ./burp-plugin.jar ENTRYPOINT ["cp","/app/burp-plugin.jar","/tmp/burpsuite-project-file-parser-all.jar"]

Default java with error

java -jar -Djava.awt.headless=true ~/BurpSuitePro/burpsuite_pro.jar --project-file=testApp.burp proxyHistory scope

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true Error: LinkageError occurred while loading main class burp.StartBurp java.lang.UnsupportedClassVersionError: burp/StartBurp has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

Java version

java --version

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true openjdk 17.0.13 2024-10-15 OpenJDK Runtime Environment (build 17.0.13+11-Debian-2) OpenJDK 64-Bit Server VM (build 17.0.13+11-Debian-2, mixed mode, sharing)

Different version of Java

~/Downloads/idea-IC-242.23726.103/jbr/bin/java --version

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true openjdk 21.0.4 2024-07-16 OpenJDK Runtime Environment JBR-21.0.4+13-509.26-jcef (build 21.0.4+13-b509.26) OpenJDK 64-Bit Server VM JBR-21.0.4+13-509.26-jcef (build 21.0.4+13-b509.26, mixed mode)

Result

~/Downloads/idea-IC-242.23726.103/jbr/bin/java -jar -Djava.awt.headless=true ~/BurpSuitePro/burpsuite_pro.jar --project-file=testApp.burp proxyHistory scope

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true Your JRE appears to be version 21.0.4 from JetBrains s.r.o. Burp has not been fully tested on this platform and you may experience problems. proxyHistory scope {"Message":"Only logging in-scope items"} ...