Exploitation via the web console (the Invoker method)

Another way of exploiting a JBoss AS instance is via the web console's Invoker method. Executing a curl command while requesting the /web-console/Invoker URI path will get us a response from the server with the 0xAC and 0xED hex code characters (aced) in the first 4 bytes of the file. We can see this at the beginning of any Java serialized object, as follows:

The Invoker servlet can be found in the web console or Invoker at http://example.com/web-console/Invoker. This can mostly be accessed without authentication. We can send a serialized post request to this Invoker to execute commands on the server.

Here's the breakdown of the bytes in the preceding screenshot:

Before jumping into Metasploit's module, let's look at another set of scripts developed by RedTeam Pentesting. The archive can be downloaded from their website at https://www.redteam-pentesting.de/files/redteam-jboss.tar.gz.

The archive contains the following files:

The following screenshot shows the different scripts released by the team:

We can use this tool to create custom BSH scripts, deploy the BSH scripts via the web console Invoker, create a JMXInvokerServlet payload, and so on. Let's see how we can use this tool to create a BSH script.