Offensive .NET: C# Reverse Shell
Creating a .NET C# reverse shell that is undetectable is very easy. In this example, I’m going to use BankSecurity’s reverse shell that I forked. This is a real basic reverse shell. Some of the more advanced code will be obfuscated and do some sort of process injection which would include shellcode.
This is a sample of a Reverse Shell written in C# ASP.NET 3.5 for compatibility. I’ll roll this up into a console app and run it to demonstrate how this works. This could also be deployed as a Win Forms application without a form.
You can watch the video above and see how I’m doing this but also here’s a walkthrough to show you all the commands I used to start the Netcat listener and connect to Kali in WSL.
Getting my Host Machines IP Address
To get your current machines IP address, open Power Shell and type “ipconfig“.
# powershell ipconfig
Starting Netcat Listener in WSL
# start a netcat listener on port 443 sudo nc -nvlp 443
Once the reverse shell has connected to my Netcat listener I am able to run commands like “whoami” and “dir” to see what folder the process is running under. Again, this a Proof of Concept (PoC), this is running locally and would require a little modification to use in the wild.