Burp Suite User Forum

Create new post

Montoya API NoSuchMethodError

Federico | Last updated: Mar 15, 2023 11:18AM UTC

When loading an extension that uses the burp.api.montoya.ui.menu.MenuItem.basicMenuItem method, I receive the following exception: java.lang.NoSuchMethodError: 'burp.api.montoya.ui.menu.BasicMenuItem burp.api.montoya.ui.menu.MenuItem.basicMenuItem(java.lang.String)' An example of line of code is the following one: BasicMenuItem numberOfDefaultColumnsMenuItem = MenuItem.basicMenuItem("# of added columns"); I'm using last version of Burp Professional and last version of Montoya API. Thank you

Hannah, PortSwigger Agent | Last updated: Mar 15, 2023 11:56AM UTC

Hi Could you tell me the specific versions of Burp Pro and the Montoya API you are using? I've just tested this with v2023.3 of Burp and the Montoya API, but have not encountered any issues.

Federico | Last updated: Mar 15, 2023 01:46PM UTC

Hi Hannah, I'm using Burp Suite v2023.2.3 (the last stable if I'm not wrong) and Montoya API v2023.3. Thank you for your help! Federico

Hannah, PortSwigger Agent | Last updated: Mar 15, 2023 02:22PM UTC

Hi Federico Could you try downgrading your Montoya version to v2023.2, or upgrading your Burp version to 2023.3 (Early Adopter) and see if that makes a difference? The MenuItem interfaces are also present in v2023.2 of the Montoya API, so your functionality shouldn't be affected by downgrading - https://github.com/PortSwigger/burp-extensions-montoya-api/blob/de3a71f60914b87f959257372f768d62f56c9754/src/main/java/burp/api/montoya/ui/menu The version number of the Montoya API represents the minimum version of Burp that the version is compatible with.

Federico | Last updated: Mar 15, 2023 02:28PM UTC

Hi Hannah, I tried with Burp Suite v2023.2.3 and Montoya API v2023.2 but I have the same error. I'm using Linux. Thank you for your help! Federico

Hannah, PortSwigger Agent | Last updated: Mar 15, 2023 04:23PM UTC

Hi Federico We've looked into this in some more detail, and it looks like this is due to a bug in the current Stable version. If you use the latest Early Adopter (v2023.3) with the Montoya API (either v2023.2 or 2023.3), then you should no longer encounter this issue. I'm sorry for the inconvenience.

Federico | Last updated: Mar 17, 2023 02:13PM UTC

Hi Hannah, With Burp Suite v2023.3 it works correctly. Thank you for your help! Federico

Nick | Last updated: Jun 07, 2023 08:07PM UTC

Hello, I'm running into the same problem. I've tried it with the following versions of Burp Suite Pro: - v2023.5.3 - v2023.3.3 - v2023.6 I've tried the following Maven versions: - net.portswigger.burp.extender:montoya-api:0.9.25 - net.portswigger.burp.extender:montoya-api:0.9.5 - net.portswigger.burp.extender:montoya-api:0.9.5.1 It throws an exception when it hits requestResponse.httpRequest() for the first time. _Event is an instance of burp.api.montoya.ui.contextmenu.ContextMenuEvent Here's the affected code: @Override public void actionPerformed(ActionEvent e) { if (!_Event.selectedRequestResponses().isEmpty()) { StringBuilder builder = new StringBuilder(); for (HttpRequestResponse requestResponse : _Event.selectedRequestResponses()) { if (requestResponse.httpRequest() != null) { builder.append(String.format("__%s__\n\n", requestResponse.httpRequest().url())); builder.append(this.surroundWithMarkdown(_api.utilities().byteUtils().convertToString(requestResponse.httpRequest().asBytes()))); } if (requestResponse.httpResponse() != null) { if (e.getActionCommand().equals(this._CopyRequestAndResponseName)) { //if (this.getValue(AbstractAction.NAME).equals(this._CopyRequestAndResponseName)) { builder.append(this.surroundWithMarkdown(_api.utilities().byteUtils().convertToString(requestResponse.httpResponse().asBytes()))); } else { byte[] responseHeaders = Arrays.copyOfRange(requestResponse.httpResponse().asBytes(), 0, requestResponse.httpResponse().bodyOffset()); builder.append(this.surroundWithMarkdown(_api.utilities().byteUtils().convertToString(responseHeaders))); } } } Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable transferable = new StringSelection(builder.toString()); clipboard.setContents(transferable, this); } } The exception I receive is: java.lang.NoSuchMethodError: 'burp.api.montoya.http.message.requests.HttpRequest burp.api.montoya.http.message.HttpRequestResponse.httpRequest()' at com.nickcoblentz.montoya.utils.CopyRequestResponse.actionPerformed(CopyRequestResponse.java:68) at burp.Zbg7.actionPerformed(Unknown Source) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374) at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1029) at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1073) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6620) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3398) at java.desktop/java.awt.Component.processEvent(Component.java:6385) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4995) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4827) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4827) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) While debugging it in IntelliJ, I can confirm that there is indeed an HTTP request and response in that object. Here's what it shows for the value of requestResponse at that breakpoint before throwing the exception: HttpRequestResponse{httpRequest=GET / HTTP/1.1 Host: www.google.com Cookie: OGPC=19027681-1:; OTZ=7055687_76_80_104160_76_446820; AEC=AUEFqZf...snip...age: en-US,en;q=0.9 Connection: close , httpResponse=HTTP/2 200 OK Date: Wed, 07 Jun 2023 19:47:42 GMT Expi...snip...nts":[{"url":"https://csp.withgoogle.com/csp/report-to/gws/other"}]}

Hannah, PortSwigger Agent | Last updated: Jun 08, 2023 08:37AM UTC

Nick | Last updated: Jun 08, 2023 02:25PM UTC

Thank you so much Hannah! Now that you mention it, I do remember that in the release notes, but I had forgotten about it. Somehow I ended up trying to use the older version. I since switched to the newer maven package and everything is now working. I did run into one more hiccup, but solved it. If you create a new project with Java version 11, it won't be able to pull down the maven packages and there isn't a lot of details why. After switching to Java version 19, all was well. Thanks again for your help!

Hannah, PortSwigger Agent | Last updated: Jun 08, 2023 03:24PM UTC

Since v2022.12.4 (https://portswigger.net/burp/releases/professional-community-2022-12-4?requestededition=professional), the minimum version of Java required to run Burp was increased to 17 :)

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.