mdsecresearch / BurpSuiteSharpener

GNU Affero General Public License v3.0
516 stars 42 forks source link

Burp v2022.9.5 compatibility #87

Closed tsc-awardle closed 2 years ago

tsc-awardle commented 2 years ago

It seems the extension is broken in Burp v2022.9.5.

Sharpener extension UI elements could not be added. Please try again.
UI cannot be loaded... try again
java.lang.NullPointerException: Cannot invoke "javax.swing.JMenuBar.getMenuCount()" because "menuBar" is null
    at com.irsdl.burp.generic.BurpUITools.getMenuItem(BurpUITools.java:135)
    at com.irsdl.burp.generic.BurpUITools.getSubMenuComponentFromMain(BurpUITools.java:148)
    at com.irsdl.burp.generic.BurpUITools.reattachTools(BurpUITools.java:179)
    at com.irsdl.burp.sharpener.SharpenerBurpExtender.unload(SharpenerBurpExtender.java:182)
    at com.irsdl.burp.sharpener.SharpenerBurpExtender.extensionUnloaded(SharpenerBurpExtender.java:77)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at burp.q0t.invoke(Unknown Source)
    at jdk.proxy2/jdk.proxy2.$Proxy35.extensionUnloaded(Unknown Source)
    at burp.u26.c(Unknown Source)
    at burp.q8e.M(Unknown Source)
    at burp.ux3.lambda$unloadExtension$0(Unknown Source)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)

The stack trace shows an exception from the unload function, but the real issue is actually here https://github.com/mdsecresearch/BurpSuiteSharpener/blob/21be7984042b18354312b2669f3ac9c19373e20d/src/main/java/com/irsdl/burp/generic/BurpExtensionSharedParameters.java#L229

For some reason, the dummyPanel is no longer attached to a parent, so SwingUtilities.getWindowAncestor is returning null.

Working on a PR now.

irsdl commented 2 years ago

Thanks for this and the PR, I will have a look. I was using the latest early bird version but this issue is definitely only in this stable release :'( I thought I had fixed it in my previous releases but now I have a weird feeling that my local repo is not synced with the latest version. I will have a look now 👍

irsdl commented 2 years ago

I think this is going to be an embarrassing one if I had patched this but never released it :(( your fix is quite future proof though except when you are looking for Burp Suite image

irsdl commented 2 years ago

So this is v2.1 that I was using locally, but guess what? even that has the issue so your fix will definitely be useful, I will have to close the PR but integrate into my new version though. I will give you the credit in the release notes if that's ok.

tsc-awardle commented 2 years ago

Yes, that is ok.

I agree that searching by the window title is a bit hacky. There's probably a more elegant solution, but I didn't see one right away.