A critical security vulnerability, identified as CVE-2023-50164 (CVE: 9.8) was found in Apache Struts, allowing attackers to manipulate file upload parameters that can potentially lead to unauthorized path traversal and remote code execution (RCE).
This exploit script is written for a CVE analysis on vsociety.
A simple dummy app is developed for demonstration purposes (see struts-app
folder).
You can deploy it to Tomcat or any other servlet, or run it by mvn jetty:run
. In this latter case you can reach the app on port 9999
. The exploit script works only in cases when the app is deployed to Tomcat since the exploitation path is to upload a WAR webshell. However, many other exploitation path can work in case of the same vulnerability based on the used technologies and other circumstances.
Install PIP packages:
pip install requests requests_toolbelt
Then, run the exploit script with for example:
python exploit.py --url http://localhost:8080/upload-1.0.0/upload.action
Note that the exploit needs a full URL where the file upload functionality is implemented.
This exploit script has been created solely for the purposes of research and for the development of effective defensive techniques. It is not intended to be used for any malicious or unauthorized activities. The author and the owner of the script disclaim any responsibility or liability for any misuse or damage caused by this software. Users are urged to use this software responsibly and only in accordance with applicable laws and regulations. Use responsibly.