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
批量扫描TomcatAJP漏洞
Readme
# CVE-2020-1938TomcatAjpScanner
批量扫描TomcatAJP漏洞

### 漏洞详情
2020年1月6日,国家信息安全漏洞共享平台(CNVD)收录了Apache Tomcat文件包含漏洞(CNVD-2020-10487,对应CVE-2020-1938)。攻击者利用该漏洞,可在未授权的情况下远程读取特定目录下的任意文件。目前,漏洞细节尚未公开,厂商已发布新版本完成漏洞修复。

### 漏洞分析
https://mp.weixin.qq.com/s/8Wueh4lkKBtfNisjxOSoWA

### 脚本使用
python CVE-2020-1938TomcatAjpScanner -h         可以查看使用说明
usage: CVE-2020-1938TomcatAjpScanner.py [-h] [-p PORT] [-f FILE] [-z ZIZHAN]
                                        target

使用方法:python CVE-2020-1938TomcatAjpScanner.py target [-p port]
其中target为ip地址,形式可以为字符串或者文件; 扫描结果将存放在当前路径下的result.txt中 支持python3

positional arguments:
  target                Hostname or IP to attack---Support Inputting a txt
                        file

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  AJP port to attack (default is 8009)
  -f FILE, --file FILE  file path :(WEB-INF/web.xml)
  -z ZIZHAN, --zizhan ZIZHAN
                        zizhan path :(woaiqiukui)
                        
[!]注意:使用时注意文件名冲突问题,为防止出现内容冲突,重复使用时请提前手动清空result.txt文件  
[!]注意:请注意传递的ip的正确格式,不要传递一个目录
                        
### 使用演示
##### 这里使用的是本地搭建的apache-tomcat-7.0.86
* usage:  
![image](https://github.com/CleanBulking/CVE-2020-1938TomcatAjpScanner/blob/images/usage.png)  

* test.txt:  
![image](https://github.com/CleanBulking/CVE-2020-1938TomcatAjpScanner/blob/images/test.txt.png)  

* display:  
![image](https://github.com/CleanBulking/CVE-2020-1938TomcatAjpScanner/blob/images/display.png)  

* result.txt:  
![image](https://github.com/CleanBulking/CVE-2020-1938TomcatAjpScanner/blob/images/result.txt.png)
File Snapshot

[4.0K] /data/pocs/fc10c1adbd66e0a10ed6cb8b5d43aecdac5768c6 ├── [ 15K] CVE-2020-1938TomcatAjpScanner.py └── [2.0K] README.md 0 directories, 2 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 →