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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2017-5638 PoC — Apache Struts 2 输入验证错误漏洞

Source
Associated Vulnerability
Title:Apache Struts 2 输入验证错误漏洞 (CVE-2017-5638)
Description:The Jakarta Multipart parser in Apache Struts 2 2.3.x before 2.3.32 and 2.5.x before 2.5.10.1 has incorrect exception handling and error-message generation during file-upload attempts, which allows remote attackers to execute arbitrary commands via a crafted Content-Type, Content-Disposition, or Content-Length HTTP header, as exploited in the wild in March 2017 with a Content-Type header containing a #cmd= string.
Description
Apache Struts 2.0 RCE vulnerability - Allows an attacker to inject OS commands into a web application through the content-type header 
Readme
# CVE-2017-5638
Apache Struts 2.0 RCE vulnerability

This is a script to exploit CVE-2017-5638 - It allows an attacker to inject OS commands into a web application through the content-type header
Apache Struts 2 is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model–view–controller (MVC) architecture.

During the last week of March, 2017 an Apache Struts hacker who goes by the name "Nike Zheng" posted a public proof-of-concept exploit showing how easily someone can execute Operating system commands remotely on a Apache Struts 2 vulnerable server.

The vulnerability, CVE-2017-5638 - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5638, permits unauthenticated Remote Code Execution (RCE) via a specially crafted Content-Type value in an HTTP request. An attacker can create an invalid value for Content-Type which will cause vulnerable software to throw an exception. When the software is preparing the error message for display, a flaw in the Apache Struts Jakarta Multipart parser causes the malicious Content-Type value to be executed instead of displayed.

Since the release of this public exploit, a large number of scans searching for vulnerable Apache servers were observed. As the exploit is really easy to execute, anyone can exploit vulnerable machines remotely with absolute ease. Thus frequent exploits following the large number of scans were reported.

One of our clients wanted us to scan through all their IPs as they were largely using the vulnerable Apache Struts 2 framework and had no exact records which IP's(Web Servers) were running a vulnerable apache framework. There were close to thousand IP's that were to be tested.
The client demanded to submit all the vulnerable domains along with the information if its a Linux or a Windows Server. In order to avoid the tedious task of scanning each IP individually, I wrote a small script.

The script combines the below functions/tasks:

1. Read the vulnerable domain names one by one from the file containing the domain list.

2. Makes use of the official exploit for checking vulnerable servers.

3. Runs the exploit and check if its a windows or a linux server.
File Snapshot

[4.0K] /data/pocs/5fd0a55a14b06c35bc95130d10d8392a79176e63 ├── [ 34K] LICENSE ├── [2.2K] README.md └── [2.6K] rogueApache.py 0 directories, 3 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 →