documentation/modules/exploit/multi/http/struts_dmi_exec.md
struts_dmi_exec is a module that exploits Apache Struts 2's Dynamic Method Invocation, and it supports Windows and Linux platforms.
Apache Struts versions between 2.3.20 and 2.3.28 are vulnerable, except 2.3.20.2 and 2.3.24.2.
The application's struts.xml also needs set struts.enable.DynamicMethodInvocation to true,
and struts.devMode to false.
For testing purposes, here is how you would set up the vulnerable machine:
manager-gui rolemanager-gui role to a user.cd to the bin directory, and run: catalina.bat run (or catalina.sh). You should have Apache Tomcat running on port 8080.tar -xf struts2-blank.tar.gzcd to apache-tomcat-[version]/webapps/struts2-blank/WEB-INF/classes, open struts.xml with a text editor.struts.enable.DynamicMethodInvocation to truestruts.devMode to false.And now you have a vulnerable server.
By default, the struts_dmi_exec exploit should be ready to go without much configuration. However, in case you need to change where the payload should be uploaded to, make sure to set the correct target, and then change the TMPPATH datastore option.
struts_dmi_exec supports three platforms: Windows, Linux, and Java. By default, it uses Java, so you don't need to worry about configuring this. Running the module can be as simple as the usage explained in the Overview section.
However, native payload do have their benefits (for example: Windows Meterpreter has better support than Java), so if you decide to switch to a different platform, here is what you do:
show targets, and see which one you should be usingset target [id]show payloads, which shows you a list of compatible payloads for that target.set payload [payload name]exploit