Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/documentation/modules/exploit/linux/http/cpi_tararchive_upload.md
Views: 11788
Description
This module exploits a vulnerability found in Cisco Prime Infrastructure. The issue is that the TarArchive Java class the HA Health Monitor component uses does not check for any directory traversals while unpacking a Tar file, which can be abused by a remote user to leverage the UploadServlet class to upload a JSP payload to the Apache Tomcat's web apps directory, and gain arbitrary remote code execution. Note that authentication is not required to exploit this vulnerability.
Vulnerable Application
Cisco Prime Infrastructure releases prior to 3.4.1, 3.5, and 3.6, also EPN Manager releases prior to 3.0.1. The Metasploit module is specifically designed to target CPI 3.4.0.
Notes on Setup
While developing the exploit, I happened to run into several issues that made the process more difficut. It was really because I didn't have the best hardware to work with, but in case you are trying to set up Cisco Prime Infrastructure as VMs like me, you may want to read this first.
Special thanks to Steven Seeley (mr_me) for providing some of the most important setup notes himself.
Hardware Requirements
There are two machines you want to set up using the same ISO, the first is called the "primary" server, and the other is "secondary" (High Availability) server. They both require the same hardware:
4 CPU Cores.
12288 MB of RAM (12GB).
350GB of hard drive space, but you may still run out of it in days.
Both VMs should be on the same network.
SCP
In case you want to transfer files, you will probably use scp. Before you do that, run the following script as admin on CPI. It will generate the credentials you need to scp files:
By default, the CPI's SSH server's authentication method is password, you may end up running scp like this:
Out of Space Issues
Cisco Prime Infrastructure requires a lot of space on the primary server. If it ever reaches to a point where it shuts down unexpectedly, you may not be able to bring the NCS services back again (such as port 80, 443, or 8082). At least for me, I couldn't figure out. If that's the case, you may need to reinstall the VM.
Unstable HA Connection
Sometimes the primary and secondary may experience some difficulty staying connected. If this happens, try to do the following on both machines:
Run
ncs stop
to stop the servicesRun
ncs cleanup
Run
ncs start
, this may take 10 to 30 minutes to finish.Finally, run
ncs status
to make sure they are talking.
If the secondary server isn't working with the primary, then the HealthMonitor service may not be in the exploitable condition.
Verification Steps
Start msfconsole
Do
use exploit/linux/http/cpi_tararchive_upload
Do
set payload
to select the preferred payloadset rhosts [ip]
run
, this should give you a shell
Scenarios
Running the check
Exploiting the service