In this demonstration,
I will walk you through how to use Netcat
to create both a Bind shell and a Reverse shell
between my Kali Linux box and an Ubuntu VM.
Now to make things a little easier,
I named this "compromised VM" so we can keep track easily.
Now remember, a Bind shell is when the attack box initiates
the connections, that's going to be our Kali Linux box,
and the compromised VM is the one that's going
to return the shell.
Remember, Reverse shells are best
when you have secure environments
because outbound connections are more trusted
than inbound connections.
All right. So first, we are assuming now
that we've compromised the server.
We're going to have this server listen,
verbose, on port 4444,
and we want you to execute bin/bash
once you receive a connection, okay?
So again, we're running the Netcat tool
with the "lvp" options.
Okay, so the "l" is for listening.
Verbose means we're going to list out everything
that's happening, right?
It's going to let us know when the connection
is established X, Y, and Z.
And the "p" just going to specify the port,
which is going to be 4444.
And then we have the -e option
that lets us know what's going to be executed
once the connection is established,
and that's going to be the Bash shell, all right?
So press Enter here.
Now I'm about to switch over to the Kali Linux box.
All right, so on my Kali Linux box here,
and what I'm going to do now is show my IP address.
So it's just to make sure that we properly establish this.
Okay, so my IP address here is 10.2.11.55.3,
and the target IP address is going to be 10.211.55.5, right?
So I'm going to simply do Netcat
10.211.55.5 port 4444.
And remember it's already compromised
and it knows, hey, once I receive a connection,
I'm going to initiate a Bash shell.
All right?
So, it doesn't always show a new prompt,
but in this current configuration,
I'm already attached to it.
So, I'm going to do IPA.
And now you see that I am currently
10.211 55.5, all right?
So, I can list commands,
I can look through the different folders,
all those different things.
So, I am currently in the compromised system,
and all I did was connect to it via Netcat.
Then remember I'm using the IP address
and simply inputing the port number here.
And this is going to be considered a Bind shell
because I'm coming from my attack box
and starting the connection.
So traditionally, this won't work
because I'm establishing a connection
from outside of the terminal.
The connection needs to be established
from the Ubuntu server.
But again, this just to demonstrate
that this is indeed a Bind shell I initiated
from my attack box to the Ubuntu server.
So let's get out here.
Screen, all right.
Now it's time to set up a Reverse shell.
Now the Reverse shell connects back from the target machine,
which is going to be our Ubuntu virtual machine,
to our attacking machine, which is going to be us.
So now, we're going to be listening out
for it to connect to us.
So, we're going to do Netcat here,
and we're going to be the ones listening
with the -lvp.
Going to be 4444.
Perfect.
Now let me go to the Ubuntu server really quick.
All right, so now let's establish the connection
back to our Kali Linux machine.
So, you're going to do Netcat,
10.211.55.3,
port 4444.
Going to execute,
bin/bash section.
All right, so let's go back to Kali Linux machine
to see if we received that connection.
And then we will be executing commands
on this compromised virtual machine.
All right, perfect.
So, we see now that we received a connection
from 55.5 that's going to be our Ubuntu server,
and now we can execute commands on it,
so we can list out different folders.
Look at the IP address again to establish
that we are indeed connected to that 55.55.
So again, in both scenarios
we are executing the commands from our attack box.
So to sum things up,
we simply established a Bind shell
from our Kali Linux box to our Ubuntu server,
which is our compromised server.
And then we performed a Reverse shell
from our Ubuntu server back to our Kali Linux box,
allowing us to execute commands from our Kali Linux box
to our Ubuntu server.
I hope you enjoyed this demonstration
and I'll see you in the next one.