This article explains how to exploit Oracle WebLogic for remote code execution by using valid credentials. It’s useful during black-box security audits, pentests, and infrastructure audits, including automated vulnerability scanning.

To set up an example playground, we will use the following docker container:

docker run -p7001:7001 --name weblogic --rm vulhub/weblogic:

Again, we need to have management rights & access to the administrator console (/console web endpoint) to cause remote code execution in Oracle WebLogic.

In an example from our security audit practice, the WebLogic console credentials were known, but access to /console was blocked by Apache proxy. However, it was possible to call /management endpoint instead of /console. This is a common mistake that administrators make during securing WebLogic panels. 

The management panel works over the REST API protocol and includes functionality that is interesting for an attacker, from disclosing technical data to executing arbitrary code or denying service.

We collected all the security-related REST API /management/ endpoints of WebLogic to simplify security practitioners job:

  1. /tenant-monitoring
  2. /weblogic – is used to access the different versions of the resources in this domain.
  3. /wls – manages the applications that are deployed in this WLS domain.

And the last one, WLS it the most interesting one. Technically, this endpoint is responsible for deploying applications, and applications, obviously, means arbitrary code.

As we can see in the documentation, the WAR package should be transferred via POST request:

example of POST request

For successful deployment, we need to specify “cluster” and “server” variables. To the first value, we have to call another endpoint: http://weblogic:7001/management/tenant-monitoring/clusters

screenshot 1

In our example, the cluster name is “webshell”. The “server” value in a standard assembly is equal to “AdminServer”. The value is also available by the link:http://weblogic:7001/management/tenant-monitoring/servers

screenshot 2

Also, if there is no cluster available, we can create a new one with the following curl command:

curl -v \
 --user weblogic:weak_password \
 -H X-Requested-By:MyClient \
 -H Accept:application/json \
 -H Content-Type:application/json \
 -d "{ name: 'webshell' }" \
 -X POST http://weblogic:7001/management/weblogic/latest/edit/clusters

The result of a successful deployment should look something like:

successful deployment

Inside the war-image, we can put is JSP-based web shell, back connect, or other arbitrary code with no limitations. After the deployment, it will be accessible by the link:

That’s it! We hope this article will save 15-20 minutes of your time during the next pentest with access to the Oracle WebLogic. Enjoy your projects!