WEBVTT

00:00:00.000 --> 00:00:10.020 align:middle line:90%


00:00:10.020 --> 00:00:12.390 align:middle line:84%
Bind Shells-- in
this video, we're

00:00:12.390 --> 00:00:14.280 align:middle line:84%
going to be getting an
understanding of what

00:00:14.280 --> 00:00:18.630 align:middle line:84%
bind shells are and how they
can be set up or facilitated

00:00:18.630 --> 00:00:20.070 align:middle line:90%
with Netcat.

00:00:20.070 --> 00:00:21.780 align:middle line:84%
And we're also
going to be getting

00:00:21.780 --> 00:00:24.180 align:middle line:84%
an understanding of
why reverse shells are

00:00:24.180 --> 00:00:26.140 align:middle line:90%
preferred over bind shells.

00:00:26.140 --> 00:00:26.640 align:middle line:90%
All right?

00:00:26.640 --> 00:00:28.680 align:middle line:84%
So let's get an
understanding of what's

00:00:28.680 --> 00:00:32.850 align:middle line:84%
happening in the background or
what a bind shell is, really,

00:00:32.850 --> 00:00:35.020 align:middle line:90%
from a connection perspective.

00:00:35.020 --> 00:00:35.520 align:middle line:90%
Right.

00:00:35.520 --> 00:00:37.530 align:middle line:84%
Now, before we do
that, I've been

00:00:37.530 --> 00:00:39.540 align:middle line:90%
mentioning this term shells.

00:00:39.540 --> 00:00:43.170 align:middle line:84%
And within penetration
testing, you'll

00:00:43.170 --> 00:00:46.020 align:middle line:84%
typically hear of reverse
shells, bind shells,

00:00:46.020 --> 00:00:49.050 align:middle line:84%
Meterpreter shells,
command shells, et cetera.

00:00:49.050 --> 00:00:50.130 align:middle line:90%
So what is a shell?

00:00:50.130 --> 00:00:53.370 align:middle line:84%
Well, a shell is essentially
a program or utility

00:00:53.370 --> 00:00:55.410 align:middle line:84%
that allows you to
execute commands

00:00:55.410 --> 00:00:58.290 align:middle line:84%
on an operating system, or
a system for that matter.

00:00:58.290 --> 00:01:00.840 align:middle line:84%
And a remote shell
is essentially

00:01:00.840 --> 00:01:04.269 align:middle line:84%
just a shell that allows you to
execute commands on a system.

00:01:04.269 --> 00:01:07.930 align:middle line:84%
However, the remote shell
allows you to do so remotely.

00:01:07.930 --> 00:01:09.670 align:middle line:90%
So what is a bind shell?

00:01:09.670 --> 00:01:12.720 align:middle line:84%
Well, a bind shell is
a type of remote shell

00:01:12.720 --> 00:01:15.300 align:middle line:84%
where the attacker
connects directly

00:01:15.300 --> 00:01:17.670 align:middle line:84%
to a listener on
the target system,

00:01:17.670 --> 00:01:20.670 align:middle line:84%
consequently allowing
for execution of commands

00:01:20.670 --> 00:01:22.510 align:middle line:90%
on the target system.

00:01:22.510 --> 00:01:23.010 align:middle line:90%
All right?

00:01:23.010 --> 00:01:25.030 align:middle line:84%
So if you take a look
at this diagram here,

00:01:25.030 --> 00:01:27.030 align:middle line:84%
you can see that you have
your attacker system--

00:01:27.030 --> 00:01:28.410 align:middle line:90%
that's red on the left--

00:01:28.410 --> 00:01:30.000 align:middle line:84%
and you have your
target system--

00:01:30.000 --> 00:01:32.070 align:middle line:90%
that's blue on the right.

00:01:32.070 --> 00:01:35.460 align:middle line:84%
And in order for a bind
shell to be obtained,

00:01:35.460 --> 00:01:38.280 align:middle line:84%
a Netcat listener
must be configured

00:01:38.280 --> 00:01:40.230 align:middle line:90%
on the target system.

00:01:40.230 --> 00:01:43.110 align:middle line:84%
And that Netcat listener
must be configured

00:01:43.110 --> 00:01:47.100 align:middle line:84%
to execute a shell depending
on the type of operating system

00:01:47.100 --> 00:01:48.580 align:middle line:90%
that's running on the target.

00:01:48.580 --> 00:01:51.730 align:middle line:84%
So let's take a look
at a simple example.

00:01:51.730 --> 00:01:54.120 align:middle line:84%
If the target is
running Windows,

00:01:54.120 --> 00:02:00.180 align:middle line:84%
then the Netcat listener must be
configured to execute a shell.

00:02:00.180 --> 00:02:02.280 align:middle line:84%
And in the case of Windows,
that will typically

00:02:02.280 --> 00:02:05.350 align:middle line:90%
be cmd.exe or PowerShell.exe.

00:02:05.350 --> 00:02:05.850 align:middle line:90%
Right?

00:02:05.850 --> 00:02:09.419 align:middle line:84%
So what happens is, once
that Netcat listener is

00:02:09.419 --> 00:02:14.130 align:middle line:84%
set up and configured to execute
a shell, any Netcat client--

00:02:14.130 --> 00:02:17.010 align:middle line:84%
or any client for that matter--
that connects to that Netcat

00:02:17.010 --> 00:02:21.480 align:middle line:84%
listener will be provided
with a remote Command Prompt

00:02:21.480 --> 00:02:23.920 align:middle line:84%
session or a command
shell, if you will,

00:02:23.920 --> 00:02:27.450 align:middle line:84%
or even a PowerShell session
if PowerShell.exe has

00:02:27.450 --> 00:02:29.170 align:middle line:90%
been configured to be executed.

00:02:29.170 --> 00:02:34.080 align:middle line:84%
So again, if we go back
to the previous video

00:02:34.080 --> 00:02:38.970 align:middle line:84%
where I highlighted the -e
option within the actual Netcat

00:02:38.970 --> 00:02:41.730 align:middle line:84%
documentation, the
-e option allows you

00:02:41.730 --> 00:02:43.980 align:middle line:90%
to execute a specific program.

00:02:43.980 --> 00:02:46.320 align:middle line:84%
Now, in the context
of penetration testers

00:02:46.320 --> 00:02:49.380 align:middle line:84%
or adversaries or
attackers for that matter,

00:02:49.380 --> 00:02:54.030 align:middle line:84%
the -e option is typically
used to specify a shell.

00:02:54.030 --> 00:02:56.040 align:middle line:84%
Again, in the context
of Windows, as I said,

00:02:56.040 --> 00:02:59.850 align:middle line:84%
that will typically be
cmd.exe or PowerShell.exe.

00:02:59.850 --> 00:03:02.730 align:middle line:84%
If the target system
is running Linux,

00:03:02.730 --> 00:03:07.290 align:middle line:84%
then the Netcat listener must be
configured to execute a shell.

00:03:07.290 --> 00:03:10.140 align:middle line:84%
And on Linux, we know that
we have multiple shells.

00:03:10.140 --> 00:03:12.630 align:middle line:84%
The default shell
is bin/bash, or you

00:03:12.630 --> 00:03:15.060 align:middle line:84%
can use bin/sh, which
is the Bourne shell.

00:03:15.060 --> 00:03:20.260 align:middle line:84%
You also have
usr/bin/zsh or Z shell.

00:03:20.260 --> 00:03:23.610 align:middle line:84%
And again, it's essentially
the same process.

00:03:23.610 --> 00:03:27.840 align:middle line:84%
Now, one of the things that
you will constantly hear

00:03:27.840 --> 00:03:29.940 align:middle line:84%
and you'll actually
find out for yourself

00:03:29.940 --> 00:03:32.790 align:middle line:84%
is that reverse shells are
much better than bind shells.

00:03:32.790 --> 00:03:33.850 align:middle line:90%
Well, why is that?

00:03:33.850 --> 00:03:35.790 align:middle line:84%
Well, let's take a look
at this diagram here.

00:03:35.790 --> 00:03:39.120 align:middle line:84%
What's the problem from the
perspective of an attacker?

00:03:39.120 --> 00:03:43.530 align:middle line:84%
Well, for one, we actually need
to set up a Netcat listener

00:03:43.530 --> 00:03:45.150 align:middle line:90%
on the target system.

00:03:45.150 --> 00:03:47.520 align:middle line:84%
How do we do this if we
don't even have access

00:03:47.520 --> 00:03:48.570 align:middle line:90%
to the target system?

00:03:48.570 --> 00:03:52.030 align:middle line:84%
Well, you can see that that
poses a potential issue.

00:03:52.030 --> 00:03:54.360 align:middle line:84%
The second issue
with bind shells

00:03:54.360 --> 00:03:57.690 align:middle line:84%
comes from the perspective
of network security.

00:03:57.690 --> 00:04:01.980 align:middle line:84%
Now, on most operating systems
like Windows and Linux,

00:04:01.980 --> 00:04:03.550 align:middle line:90%
inbound traffic--

00:04:03.550 --> 00:04:06.150 align:middle line:84%
that means traffic that's
coming into a system--

00:04:06.150 --> 00:04:10.920 align:middle line:84%
will typically be blocked by the
firewall or any other security

00:04:10.920 --> 00:04:14.280 align:middle line:84%
systems or mechanisms that
have been put in place, which

00:04:14.280 --> 00:04:18.930 align:middle line:84%
means that, if Windows Firewall
is enabled on a target system,

00:04:18.930 --> 00:04:23.730 align:middle line:84%
a bind shell will probably fail
if it's incoming to a port that

00:04:23.730 --> 00:04:26.760 align:middle line:84%
has actually been blocked
or a port range that

00:04:26.760 --> 00:04:29.350 align:middle line:84%
has been blocked by Windows
Firewall, for example.

00:04:29.350 --> 00:04:29.850 align:middle line:90%
Right?

00:04:29.850 --> 00:04:33.780 align:middle line:84%
And that really isn't
something that an attacker

00:04:33.780 --> 00:04:35.850 align:middle line:90%
will be too pleased with.

00:04:35.850 --> 00:04:38.370 align:middle line:84%
And this is where the whole
idea of the reverse shell

00:04:38.370 --> 00:04:39.310 align:middle line:90%
comes into play.

00:04:39.310 --> 00:04:44.880 align:middle line:84%
So let me just explain where
a reverse shell is different,

00:04:44.880 --> 00:04:47.290 align:middle line:84%
and it all comes down
to the connection type.

00:04:47.290 --> 00:04:50.070 align:middle line:84%
So in the context
of a reverse shell,

00:04:50.070 --> 00:04:53.940 align:middle line:84%
the roles are switched
in that the target now

00:04:53.940 --> 00:04:56.910 align:middle line:84%
connects to the attacker's
Netcat listener.

00:04:56.910 --> 00:05:02.520 align:middle line:84%
So a Netcat listener is set
up on the attacker system,

00:05:02.520 --> 00:05:06.190 align:middle line:84%
and then the target
actually connects to that.

00:05:06.190 --> 00:05:08.280 align:middle line:84%
So again, this connection
is then flipped,

00:05:08.280 --> 00:05:10.080 align:middle line:84%
and that is where you
have a reverse shell.

00:05:10.080 --> 00:05:13.620 align:middle line:84%
The reason for that
is because, again,

00:05:13.620 --> 00:05:16.320 align:middle line:84%
outgoing traffic
from a system, again,

00:05:16.320 --> 00:05:21.840 align:middle line:84%
is rarely blocked by a firewall
or by any security mechanism,

00:05:21.840 --> 00:05:25.110 align:middle line:84%
whereas inbound traffic
is usually very suspect.

00:05:25.110 --> 00:05:27.720 align:middle line:84%
And you can actually test
this out for yourself.

00:05:27.720 --> 00:05:29.730 align:middle line:84%
If you open up a Windows
system and just take

00:05:29.730 --> 00:05:32.340 align:middle line:84%
a look at the inbound
traffic currently,

00:05:32.340 --> 00:05:34.140 align:middle line:84%
it's going to be
significantly less.

00:05:34.140 --> 00:05:39.360 align:middle line:84%
And that's because there's
very rarely a reason for there

00:05:39.360 --> 00:05:43.170 align:middle line:84%
to be an incoming connection to
a standard workstation system.

00:05:43.170 --> 00:05:46.290 align:middle line:84%
Now, if it's a server, then
that's totally different.

00:05:46.290 --> 00:05:48.220 align:middle line:84%
That really would
not be an issue.

00:05:48.220 --> 00:05:51.870 align:middle line:84%
But even in that case, inbound
traffic is usually limited

00:05:51.870 --> 00:05:56.550 align:middle line:84%
and is controlled by a
firewall, so only specific ports

00:05:56.550 --> 00:05:59.250 align:middle line:84%
will be accepting
inbound connections.

00:05:59.250 --> 00:06:02.910 align:middle line:84%
So that is the difference,
at a very high level,

00:06:02.910 --> 00:06:04.800 align:middle line:84%
between a bind shell
and a reverse shell

00:06:04.800 --> 00:06:09.020 align:middle line:84%
and why reverse shells are
preferred to bind shells.

00:06:09.020 --> 00:06:12.040 align:middle line:84%
So again, the connection
is fairly simple.

00:06:12.040 --> 00:06:12.540 align:middle line:90%
All right.

00:06:12.540 --> 00:06:15.270 align:middle line:84%
So now that we have an
understanding of what a bind

00:06:15.270 --> 00:06:17.310 align:middle line:84%
shell is and how it
works, we can actually

00:06:17.310 --> 00:06:20.050 align:middle line:84%
get started with the
practical demonstration.

00:06:20.050 --> 00:06:22.500 align:middle line:84%
So again, we're going to
be utilizing the same lab

00:06:22.500 --> 00:06:24.530 align:middle line:84%
environment that we used
in the previous video.

00:06:24.530 --> 00:06:26.340 align:middle line:84%
So just fire up
the lab environment

00:06:26.340 --> 00:06:27.880 align:middle line:90%
and we'll get started.

00:06:27.880 --> 00:06:29.850 align:middle line:84%
So I'll see you within
the lab environment.

00:06:29.850 --> 00:06:34.637 align:middle line:90%


00:06:34.637 --> 00:06:36.720 align:middle line:84%
All right, so I'm back
within the lab environment.

00:06:36.720 --> 00:06:39.250 align:middle line:84%
And by this point, you should
be familiar with how it works.

00:06:39.250 --> 00:06:41.700 align:middle line:84%
We have the attacker machine
and the target machine,

00:06:41.700 --> 00:06:44.070 align:middle line:84%
which is running
Windows, Windows Server

00:06:44.070 --> 00:06:46.090 align:middle line:90%
2012 to be specific.

00:06:46.090 --> 00:06:48.660 align:middle line:84%
And again, just disregard
the vulnerable service

00:06:48.660 --> 00:06:50.910 align:middle line:84%
that is running on the target
because we're not really

00:06:50.910 --> 00:06:52.540 align:middle line:90%
focused on exploiting it.

00:06:52.540 --> 00:06:55.860 align:middle line:84%
We're primarily focused on
utilizing Netcat to set up

00:06:55.860 --> 00:06:57.450 align:middle line:90%
bind shells and reverse shells.

00:06:57.450 --> 00:07:00.720 align:middle line:84%
So you'll also be provided with
the target IP address, which

00:07:00.720 --> 00:07:03.810 align:middle line:84%
will change from the previous
time you ran the same lab

00:07:03.810 --> 00:07:04.630 align:middle line:90%
environment.

00:07:04.630 --> 00:07:07.110 align:middle line:90%
So just keep this file open.

00:07:07.110 --> 00:07:09.750 align:middle line:84%
The first step, of course,
that we need to perform

00:07:09.750 --> 00:07:14.250 align:middle line:84%
is we need to transfer over
nc.exe onto the Windows system.

00:07:14.250 --> 00:07:16.560 align:middle line:84%
As I said, this is not
ideal, but it's something

00:07:16.560 --> 00:07:18.510 align:middle line:84%
that we have to do in
order to understand

00:07:18.510 --> 00:07:20.220 align:middle line:90%
how to set up a bind shell.

00:07:20.220 --> 00:07:23.040 align:middle line:84%
So what I'll do is I'll
open up a terminal here,

00:07:23.040 --> 00:07:25.860 align:middle line:84%
and I'll just zoom in so
you can see what I'm doing.

00:07:25.860 --> 00:07:28.260 align:middle line:84%
And I'll head over
to the directory

00:07:28.260 --> 00:07:31.450 align:middle line:84%
that contains nc.exe on
the Kali Linux system.

00:07:31.450 --> 00:07:37.230 align:middle line:84%
So that's under user,
share, Windows, binaries.

00:07:37.230 --> 00:07:41.650 align:middle line:84%
And within this folder, we
have the nc.exe file here.

00:07:41.650 --> 00:07:45.600 align:middle line:84%
So we're going to set up a web
server with the Python module

00:07:45.600 --> 00:07:50.790 align:middle line:84%
SimpleHTTPServer, and we're
going to host it on port 80.

00:07:50.790 --> 00:07:51.390 align:middle line:90%
Right?

00:07:51.390 --> 00:07:55.110 align:middle line:84%
And this will allow us to
download the nc.exe file

00:07:55.110 --> 00:07:56.590 align:middle line:90%
onto the target system.

00:07:56.590 --> 00:07:57.750 align:middle line:90%
So I'll hit Enter.

00:07:57.750 --> 00:07:59.880 align:middle line:90%
We now need the Kali Linux IP.

00:07:59.880 --> 00:08:03.270 align:middle line:84%
So again, just open up a
terminal and type in ifconfig

00:08:03.270 --> 00:08:05.280 align:middle line:84%
and your IP address is
going to be attached

00:08:05.280 --> 00:08:09.160 align:middle line:84%
to the interface Ethernet I.
And of course, in your case,

00:08:09.160 --> 00:08:11.700 align:middle line:84%
it's going to be different,
but just copy the value there.

00:08:11.700 --> 00:08:13.990 align:middle line:84%
And we can now head over
to the Windows system.

00:08:13.990 --> 00:08:15.930 align:middle line:84%
So in order to
transfer it, we can

00:08:15.930 --> 00:08:18.180 align:middle line:84%
use the technique we used
in the previous video

00:08:18.180 --> 00:08:21.670 align:middle line:84%
where we downloaded it with
a utility called certutil.

00:08:21.670 --> 00:08:23.640 align:middle line:84%
The other technique that
I wanted to highlight

00:08:23.640 --> 00:08:25.060 align:middle line:90%
was through the web browser.

00:08:25.060 --> 00:08:27.480 align:middle line:84%
So if I just open
up a new tab here

00:08:27.480 --> 00:08:31.740 align:middle line:84%
and I open up the Kali
Linux IP on port 80,

00:08:31.740 --> 00:08:35.700 align:middle line:84%
you can see that we get a
directory listing for the web

00:08:35.700 --> 00:08:37.020 align:middle line:90%
server that we set up.

00:08:37.020 --> 00:08:40.200 align:middle line:84%
And all the files within the
folder that we were hosting

00:08:40.200 --> 00:08:42.230 align:middle line:84%
are available, so we
can download nc.exe.

00:08:42.230 --> 00:08:44.960 align:middle line:90%


00:08:44.960 --> 00:08:47.660 align:middle line:90%
We're going to add this website.

00:08:47.660 --> 00:08:50.090 align:middle line:90%
We're going to say it is safe.

00:08:50.090 --> 00:08:52.040 align:middle line:84%
And we're just going to
take a step back here

00:08:52.040 --> 00:08:54.800 align:middle line:84%
and download
nc.exe, and I'm just

00:08:54.800 --> 00:08:56.570 align:middle line:90%
going to click on Save there.

00:08:56.570 --> 00:08:58.372 align:middle line:84%
And you can see it's
going to tell you

00:08:58.372 --> 00:09:00.080 align:middle line:84%
that the publisher
could not be verified.

00:09:00.080 --> 00:09:00.830 align:middle line:90%
That's fine.

00:09:00.830 --> 00:09:02.850 align:middle line:84%
It's now under the
Downloads directory,

00:09:02.850 --> 00:09:06.170 align:middle line:84%
so I'm just going to open
up cmd right over here, so

00:09:06.170 --> 00:09:07.530 align:middle line:90%
Command Prompt.

00:09:07.530 --> 00:09:09.077 align:middle line:84%
And what I'm going
to do is I'm just

00:09:09.077 --> 00:09:11.660 align:middle line:84%
going to increase the font size
and just change the background

00:09:11.660 --> 00:09:13.850 align:middle line:90%
color really quickly.

00:09:13.850 --> 00:09:15.970 align:middle line:84%
All right, so I've
adjusted the font size

00:09:15.970 --> 00:09:19.870 align:middle line:84%
and I've just changed the
background color as well as

00:09:19.870 --> 00:09:21.290 align:middle line:90%
the font color there.

00:09:21.290 --> 00:09:24.040 align:middle line:84%
So again, if we head over
into the Downloads folder,

00:09:24.040 --> 00:09:27.800 align:middle line:84%
we should have nc.exe,
so there we are.

00:09:27.800 --> 00:09:30.040 align:middle line:84%
And let's take a look at
the first scenario, right?

00:09:30.040 --> 00:09:33.190 align:middle line:84%
So let's assume that we
are following the flow that

00:09:33.190 --> 00:09:36.610 align:middle line:84%
is recommended by this lab
where the Kali Linux system is

00:09:36.610 --> 00:09:38.710 align:middle line:84%
the attacker and
the target system

00:09:38.710 --> 00:09:42.340 align:middle line:90%
is the system running Windows.

00:09:42.340 --> 00:09:45.400 align:middle line:84%
So let me just terminate
the actual web server there,

00:09:45.400 --> 00:09:48.680 align:middle line:84%
and I'll navigate to my
home directory there.

00:09:48.680 --> 00:09:51.790 align:middle line:84%
So in order to set
up a bind shell,

00:09:51.790 --> 00:09:55.000 align:middle line:84%
the target system needs to
have a Netcat listener set up.

00:09:55.000 --> 00:09:55.540 align:middle line:90%
Right?

00:09:55.540 --> 00:09:57.010 align:middle line:90%
And not only that.

00:09:57.010 --> 00:10:00.250 align:middle line:84%
It needs to be configured
to execute cmd.exe.

00:10:00.250 --> 00:10:03.530 align:middle line:84%
So if we open up the
documentation again here,

00:10:03.530 --> 00:10:05.800 align:middle line:84%
you can see that you
have the -e option.

00:10:05.800 --> 00:10:07.780 align:middle line:84%
So that allows an
inbound program

00:10:07.780 --> 00:10:10.930 align:middle line:84%
to be executed, which again,
as it says, is very dangerous.

00:10:10.930 --> 00:10:13.990 align:middle line:84%
And you'll see how dangerous
this is in a couple of seconds.

00:10:13.990 --> 00:10:17.180 align:middle line:84%
So we'll set up a Netcat
listener on the target system.

00:10:17.180 --> 00:10:20.110 align:middle line:90%
So we'll say nc.exe -nvlp.

00:10:20.110 --> 00:10:21.220 align:middle line:90%
This is on TCP.

00:10:21.220 --> 00:10:24.850 align:middle line:84%
And the port we will essentially
set up the listener to run on

00:10:24.850 --> 00:10:26.500 align:middle line:90%
is port 1234.

00:10:26.500 --> 00:10:31.030 align:middle line:84%
However, because we want
to obtain a bind shell

00:10:31.030 --> 00:10:33.040 align:middle line:84%
and we want to be able
to execute commands

00:10:33.040 --> 00:10:37.000 align:middle line:84%
on the target system,
we will execute cmd.exe.

00:10:37.000 --> 00:10:39.160 align:middle line:84%
So again, what this
means is that, whenever

00:10:39.160 --> 00:10:42.310 align:middle line:84%
a client connects to
this particular listener,

00:10:42.310 --> 00:10:46.690 align:middle line:84%
cmd.exe will be executed and the
target or the attacker system

00:10:46.690 --> 00:10:50.830 align:middle line:84%
will be provided with a command
shell or a Command Prompt

00:10:50.830 --> 00:10:51.530 align:middle line:90%
session.

00:10:51.530 --> 00:10:52.030 align:middle line:90%
Right?

00:10:52.030 --> 00:10:54.205 align:middle line:90%
So I'll hit Enter.

00:10:54.205 --> 00:10:56.330 align:middle line:84%
And we have set up the
listener, so we'll head over

00:10:56.330 --> 00:10:57.660 align:middle line:90%
to the attacker system.

00:10:57.660 --> 00:10:59.540 align:middle line:84%
So remember, if
we want to connect

00:10:59.540 --> 00:11:03.140 align:middle line:84%
to a particular target on a
particular port, we say nc.

00:11:03.140 --> 00:11:07.460 align:middle line:84%
And we'll say nv for no DNS
resolution and verbose output.

00:11:07.460 --> 00:11:11.980 align:middle line:84%
We then get the target
IP right over here.

00:11:11.980 --> 00:11:15.517 align:middle line:84%
And then we specify
the port to connect to,

00:11:15.517 --> 00:11:16.600 align:middle line:90%
and that's pretty much it.

00:11:16.600 --> 00:11:21.550 align:middle line:84%
Once we hit Enter, we
should receive a bind shell.

00:11:21.550 --> 00:11:22.250 align:middle line:90%
There we are.

00:11:22.250 --> 00:11:27.100 align:middle line:84%
So you can see Netcat connected
and the cmd.exe is executed

00:11:27.100 --> 00:11:30.160 align:middle line:84%
and we have now gained access
to the target system remotely

00:11:30.160 --> 00:11:31.240 align:middle line:90%
via a bind shell.

00:11:31.240 --> 00:11:33.100 align:middle line:90%
So I can say, who am I?

00:11:33.100 --> 00:11:35.950 align:middle line:84%
You can see we are currently
the administrator user.

00:11:35.950 --> 00:11:39.190 align:middle line:84%
I can list all the contents
of the Downloads directory

00:11:39.190 --> 00:11:40.280 align:middle line:90%
or the Downloads folder.

00:11:40.280 --> 00:11:42.470 align:middle line:84%
And you can see we
have nc.exe here.

00:11:42.470 --> 00:11:45.490 align:middle line:84%
So what we've just done from
a penetration tester's point

00:11:45.490 --> 00:11:48.340 align:middle line:84%
of view is we have obtained
remote access to the target

00:11:48.340 --> 00:11:50.770 align:middle line:90%
system via a bind shell.

00:11:50.770 --> 00:11:52.547 align:middle line:84%
And of course, this
is very different

00:11:52.547 --> 00:11:54.130 align:middle line:84%
when it comes down
to a reverse shell.

00:11:54.130 --> 00:12:01.665 align:middle line:84%
So again, this can also be
done both ways in that you

00:12:01.665 --> 00:12:03.730 align:middle line:84%
can actually connect
to a Linux system

00:12:03.730 --> 00:12:07.360 align:middle line:84%
and obtain an actual bash
shell or a Bourne shell

00:12:07.360 --> 00:12:08.390 align:middle line:90%
if you wanted to.

00:12:08.390 --> 00:12:09.740 align:middle line:90%
So let's actually try that out.

00:12:09.740 --> 00:12:12.640 align:middle line:84%
So I'll terminate the
Netcat connection there,

00:12:12.640 --> 00:12:14.980 align:middle line:84%
and I'm back on my
Linux system here.

00:12:14.980 --> 00:12:17.680 align:middle line:84%
And the actual listener
has been terminated,

00:12:17.680 --> 00:12:19.130 align:middle line:90%
which is what we want.

00:12:19.130 --> 00:12:23.860 align:middle line:84%
So let's say we are just going
to flip the actual roles now,

00:12:23.860 --> 00:12:25.970 align:middle line:84%
so this is going to be
the attacker system.

00:12:25.970 --> 00:12:28.690 align:middle line:84%
So the Windows system is going
to be the attacker system

00:12:28.690 --> 00:12:33.020 align:middle line:84%
and the Kali Linux system is
going to be the target system.

00:12:33.020 --> 00:12:36.410 align:middle line:84%
So on a Linux target,
you would need to, again,

00:12:36.410 --> 00:12:37.720 align:middle line:90%
set up a listener with Netcat.

00:12:37.720 --> 00:12:40.870 align:middle line:90%
So we can say nc and then nvlp.

00:12:40.870 --> 00:12:41.650 align:middle line:90%
Right?

00:12:41.650 --> 00:12:44.750 align:middle line:84%
And what you need to do
then is specify the port,

00:12:44.750 --> 00:12:45.820 align:middle line:90%
which we already know.

00:12:45.820 --> 00:12:47.890 align:middle line:84%
However, instead
of saying execute,

00:12:47.890 --> 00:12:51.760 align:middle line:84%
which we can do as well, we
can use the -c option, -c,

00:12:51.760 --> 00:12:53.140 align:middle line:90%
to execute a shell.

00:12:53.140 --> 00:12:55.060 align:middle line:84%
And then we specify
the shell that we

00:12:55.060 --> 00:12:57.610 align:middle line:84%
would like executed
once a client connects,

00:12:57.610 --> 00:12:59.758 align:middle line:90%
so we can say bash.

00:12:59.758 --> 00:13:00.300 align:middle line:90%
There we are.

00:13:00.300 --> 00:13:04.710 align:middle line:84%
So nc -nvlp listen on
port 1234 and execute

00:13:04.710 --> 00:13:05.640 align:middle line:90%
the following shell.

00:13:05.640 --> 00:13:10.320 align:middle line:84%
And this option is
reserved for Linux systems.

00:13:10.320 --> 00:13:13.830 align:middle line:84%
So we'll get the Kali
Linux IP address here

00:13:13.830 --> 00:13:16.980 align:middle line:84%
as we will require it because
we are connecting to the Netcat

00:13:16.980 --> 00:13:18.910 align:middle line:84%
listener from the
Windows system.

00:13:18.910 --> 00:13:22.520 align:middle line:84%
So I'll hit Enter, and it's
going to listen on that port.

00:13:22.520 --> 00:13:25.880 align:middle line:84%
And now, on the Windows
system, we can say nc.exe.

00:13:25.880 --> 00:13:29.060 align:middle line:84%
And remember, we're connecting
to the listener, so -nc.

00:13:29.060 --> 00:13:34.580 align:middle line:84%
And then we specify the target
IP and the port is 1234.

00:13:34.580 --> 00:13:38.660 align:middle line:84%
We hit Enter and it looks
like we are obtaining--

00:13:38.660 --> 00:13:40.310 align:middle line:90%
sorry, that was my mistake.

00:13:40.310 --> 00:13:41.660 align:middle line:90%
We're not using -nc.

00:13:41.660 --> 00:13:45.000 align:middle line:90%
We're using -nv, verbose output.

00:13:45.000 --> 00:13:48.410 align:middle line:84%
So we hit Enter and
it looks like we've

00:13:48.410 --> 00:13:49.890 align:middle line:90%
obtained a bash session.

00:13:49.890 --> 00:13:52.760 align:middle line:84%
The only way we can confirm
this is by typing in ls.

00:13:52.760 --> 00:13:55.850 align:middle line:84%
And indeed, we have
obtained remote access

00:13:55.850 --> 00:13:57.470 align:middle line:90%
to the Linux system.

00:13:57.470 --> 00:14:01.320 align:middle line:84%
We can then probably
type in bin/bash -i

00:14:01.320 --> 00:14:03.348 align:middle line:84%
to obtain a full-on
bash terminal.

00:14:03.348 --> 00:14:05.640 align:middle line:84%
But in this case, it doesn't
look like that has worked,

00:14:05.640 --> 00:14:09.810 align:middle line:84%
so we can just use our
current bash session.

00:14:09.810 --> 00:14:14.970 align:middle line:84%
So for example, I can say, who
am I, or I can get my ID here.

00:14:14.970 --> 00:14:16.890 align:middle line:84%
And we currently
have root access

00:14:16.890 --> 00:14:21.250 align:middle line:84%
and I've essentially gained
access to the Linux system.

00:14:21.250 --> 00:14:25.950 align:middle line:84%
So that is how to obtain
remote access on a target

00:14:25.950 --> 00:14:27.750 align:middle line:90%
system via a bind shell.

00:14:27.750 --> 00:14:29.880 align:middle line:84%
It really is very
simple to understand.

00:14:29.880 --> 00:14:33.480 align:middle line:84%
And of course, you can see
why penetration testers

00:14:33.480 --> 00:14:37.320 align:middle line:84%
and adversaries actually
prefer a reverse shell, more

00:14:37.320 --> 00:14:39.870 align:middle line:84%
of which will become
apparent in the next video

00:14:39.870 --> 00:14:42.940 align:middle line:84%
when we will be exploring
reverse shells in depth.

00:14:42.940 --> 00:14:43.440 align:middle line:90%
OK?

00:14:43.440 --> 00:14:46.410 align:middle line:84%
So that is how to
set up a bind shell,

00:14:46.410 --> 00:14:49.200 align:middle line:84%
and this is going to conclude
the practical demonstration

00:14:49.200 --> 00:14:51.810 align:middle line:90%
side of this video.

00:14:51.810 --> 00:14:54.050 align:middle line:84%
In the next video, we
will be taking a look

00:14:54.050 --> 00:14:56.990 align:middle line:84%
at how reverse shells
work, and we'll

00:14:56.990 --> 00:15:01.100 align:middle line:84%
be taking a look at how
to obtain a reverse shell

00:15:01.100 --> 00:15:05.090 align:middle line:84%
with Netcat, after which
we'll also be exploring

00:15:05.090 --> 00:15:08.120 align:middle line:84%
a reverse shell cheat
sheet that will essentially

00:15:08.120 --> 00:15:10.850 align:middle line:84%
simplify the process of
obtaining a reverse shell.

00:15:10.850 --> 00:15:13.880 align:middle line:84%
And again, I will clarify
how a reverse shell

00:15:13.880 --> 00:15:20.420 align:middle line:84%
can be obtained without too
much reliance on Netcat itself.

00:15:20.420 --> 00:15:24.010 align:middle line:84%
All right, so I'll be seeing
you in the next video.