Giter Site home page Giter Site logo

readloud / cve-2017-5638 Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 41 KB

This script is intended to validate Apache Struts 2 vulnerability (CVE-2017-5638), AKA Struts-Shock.

License: MIT License

Dockerfile 0.77% Python 26.40% Shell 7.10% Java 6.22% Perl 53.73% Ruby 5.79%
struts-shock cve-2017-5638 apache-struts-2-vulnerability

cve-2017-5638's Introduction

CVE-2017-5638

This script is intended to validate Apache Struts 2 vulnerability (CVE-2017-5638), AKA Struts-Shock. This is a completely harmless as it does not inject any malicious payload, only inject an HTTP header named 'STRUTS2-VALIDATION' in order to be able to validate whether is vulnerable

Because of its multithread capability, it's able to run 2.5k+ applications spread around the globe in less than 10 minutes. So, it can be very handy to validate enterprise applications in large scale.

cve-2017-5638

cve-2017-5638 Vulnerable site sample

This project aims to demonstrate the CVE-2017-5638 exploitation for educational purpose. For more informations, see https://cwiki.apache.org/confluence/display/WW/S2-045

Legal Disclaimer

This project is made for educational and ethical testing purposes only. Attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program.

Getting started

  1. Start the docker container :

docker run -d -p 8080:8080 jrrdev/cve-2017-5638:latest

  1. Download the exploit script on the attacker machine here

  2. Run the python exploit script from the attacker machine :

python exploit.py http://<DOCKER_HOST>:8080/hello "ls -l"

Usage

There are two ways to run this script, with and without threading, the only difference will the execution time. To enable the threading feature, just need to pass the thread parameter. The first parameter must be a TXT file containing all targeted URL, one per line. Please note that these URL should be complete, for example, https://target.com/admin/myStrutsPage.action

Here is a usage example without threading:

struts-shock-validation.py target_urls.txt

Now using threads capability:

struts-shock-validation.py target_urls.txt thread

CVE-2017-5638

http://struts.apache.org/docs/s2-016.html https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017

Metasploit Framework Exploit Module for Apache Struts Content-Type exploit Have not tested against a windows server but tested against a linux server using the payload of generic/shell_bind_tcp

CVE-2017-5638 PoC Code in Python | DORK: ext:action

Example PoC Code for CVE-2017-5638 | Apache Struts Exploit | DORK: ext:action

USAGE: python struts.py https://victim.site dir

The initial Python Script that was Posted didn't correctly format the Content-Type Header. I recoded the Content Type Header to properly format Content-Type:%20{Exploit}. I also added a logging and Requests, then dumped the Object Properties to stdout.

SAMPLE OUTPUT

Check for CVE-2017-5638 by XSS.Cx

Volume in drive D has no label. Volume Serial Number is 2A7B-A245 Directory of d:\Program Files\Apache Software Foundation\Tomcat 9.0

CVE-2017-5638

Table of Contents

  1. Overview
  2. Dependencies
  3. Usage

Overview

This project is a prove-of-concept for the Apache Struts vulnerabilty. The goal was to create software that can generate and test random IPs for the vulnerabilty described above.

Use this project on your own risk and for educational purpose only.

Dependencies

  • cURL

    • cURL is used to send the crafted header to a certain IP address on a certain Port.
  • Nmap

    • Nmap is used to create the random IP addresses that contains an open port 80 or 443.

Usage

Generate random IPs and save them to a text file.

./get_ip.sh [Number of hosts to scan] [What port to scan] [Filename to write output]
./get_ip.sh 10000 80 output.txt

Check for vulnerability for a specific IP address.

./struts_check.sh [ip address] [port]
./struts_check.sh 127.0.0.1 80

Check for vulnerability for a list of IP addresses.

./main.sh [Text file containing IP adresses] [Port]
./main.sh output.txt 443

Execute a command on a server without the Apache struts vulnerability patch

./struts_attack.sh [IP Adres] [Command]
./struts_attack.sh https://127.0.0.1 whoami

# CVE-2017-5638 PoC Code in Python | DORK: ext:action
Example PoC Code for CVE-2017-5638 | Apache Struts Exploit | DORK: ext:action

USAGE: python struts.py https://victim.site dir

The initial Python Script that was Posted didn't correctly format the Content-Type Header.
I recoded the Content Type Header to properly format Content-Type:%20{Exploit}.
I also added a logging and Requests, then dumped the Object Properties to stdout.

SAMPLE OUTPUT

Check for CVE-2017-5638 by XSS.Cx

Volume in drive D has no label.
Volume Serial Number is 2A7B-A245
Directory of d:\Program Files\Apache Software Foundation\Tomcat 9.0

## Results
it will automatically create a folder called results, and on each execution will create a dated folder containing the execution outcome. If threading is enabled, it will create on file per thread named thread_<number>, which can be ignored because when it completes it will consolidate all threads result on single TXT file with the same name (date/timestamp) as its execution folder.

cve-2017-5638's People

Contributors

jongmartinez avatar readloud avatar

Watchers

 avatar  avatar

Forkers

l00169942

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.