Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2020-1938 PoC — Apache Tomcat 安全漏洞

Source
Associated Vulnerability
Title:Apache Tomcat 安全漏洞 (CVE-2020-1938)
Description:When using the Apache JServ Protocol (AJP), care must be taken when trusting incoming connections to Apache Tomcat. Tomcat treats AJP connections as having higher trust than, for example, a similar HTTP connection. If such connections are available to an attacker, they can be exploited in ways that may be surprising. In Apache Tomcat 9.0.0.M1 to 9.0.0.30, 8.5.0 to 8.5.50 and 7.0.0 to 7.0.99, Tomcat shipped with an AJP Connector enabled by default that listened on all configured IP addresses. It was expected (and recommended in the security guide) that this Connector would be disabled if not required. This vulnerability report identified a mechanism that allowed: - returning arbitrary files from anywhere in the web application - processing any file in the web application as a JSP Further, if the web application allowed file upload and stored those files within the web application (or the attacker was able to control the content of the web application by some other means) then this, along with the ability to process a file as a JSP, made remote code execution possible. It is important to note that mitigation is only required if an AJP port is accessible to untrusted users. Users wishing to take a defence-in-depth approach and block the vector that permits returning arbitrary files and execution as JSP may upgrade to Apache Tomcat 9.0.31, 8.5.51 or 7.0.100 or later. A number of changes were made to the default AJP Connector configuration in 9.0.31 to harden the default configuration. It is likely that users upgrading to 9.0.31, 8.5.51 or 7.0.100 or later will need to make small changes to their configurations.
Description
批量检测幽灵猫漏洞
Readme
# CVE-2020-1938-Tool
  首先感谢[hypn0s](https://github.com/hypn0s)提供的AJP协议请求构造的工具[AJPY](https://github.com/hypn0s/AJPy.git)(一个python库),本项目在此基础上实现批量检测幽灵猫漏洞站点。

## 使用方法
  
  暂时拥有两种功能
```
usage: tomcat.py [-h] {read_file,scan_files} ...

positional arguments:
  {read_file,scan_files}
    read_file           Exploit CVE-2020-1938
    scan_files          scan a file list

optional arguments:
  -h, --help            show this help message and exit
```

1. 文件读取
```
usage: tomcat.py read_file [-h] [-H HOST] [-p PORT] [--webapp WEBAPP]
                           [-f FILE]

optional arguments:
  -h, --help            show this help message and exit
  -H HOST, --host HOST  The host to check
  -p PORT, --port PORT  The port of AJP connector(default is 8009)
  --webapp WEBAPP       webapp
  -f FILE, --file FILE  The relative path of file to read
```

> python3 tomcat.py read_file -H 127.0.0.1 --webapp manager -f /WEB-INF/web.xml

2. 检测文件中所有站点

```
usage: tomcat.py scan_files [-h] [-f FILE] [-t THREADS] [-o OUT]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Host list(only one url in a line)
  -t THREADS, --threads THREADS
  -o OUT, --out OUT     output the vulnerable host to file
```

> python3 tomcat.py scan_files -t 5 -f host_files.txt -o result.txt

File Snapshot

[4.0K] /data/pocs/1ad968a01453d2bec737dd374890424d1ada8aa2 ├── [4.0K] ajpy │   ├── [ 13K] ajp.py │   ├── [ 0] __init__.py │   └── [4.0K] __pycache__ │   ├── [9.9K] ajp.cpython-37.pyc │   └── [ 154] __init__.cpython-37.pyc ├── [1.4K] README.md └── [7.3K] tomcat.py 2 directories, 6 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →