WEBVTT

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


00:00:10.140 --> 00:00:11.700 align:middle line:90%
Windows keylogging.

00:00:11.700 --> 00:00:13.470 align:middle line:84%
In this video, we
will be exploring

00:00:13.470 --> 00:00:16.560 align:middle line:84%
the process of performing
keylogging on a Windows target

00:00:16.560 --> 00:00:18.820 align:middle line:84%
once you have
gained access to it.

00:00:18.820 --> 00:00:22.360 align:middle line:84%
So again, keylogging is a fairly
simple concept to understand.

00:00:22.360 --> 00:00:24.210 align:middle line:84%
And let's get an
idea of what it is.

00:00:24.210 --> 00:00:26.700 align:middle line:84%
So keylogging is
essentially the process

00:00:26.700 --> 00:00:30.030 align:middle line:84%
of recording or capturing the
keystrokes entered on a target

00:00:30.030 --> 00:00:31.030 align:middle line:90%
system.

00:00:31.030 --> 00:00:34.770 align:middle line:84%
However, you must also know
that this particular technique

00:00:34.770 --> 00:00:37.140 align:middle line:84%
is not limited to
post exploitation.

00:00:37.140 --> 00:00:39.840 align:middle line:84%
There are plenty of
programs or USB devices

00:00:39.840 --> 00:00:42.030 align:middle line:84%
that can be used to
capture and transmit

00:00:42.030 --> 00:00:44.910 align:middle line:84%
the keystrokes entered on
a system to the attacker

00:00:44.910 --> 00:00:47.220 align:middle line:90%
or to a target system.

00:00:47.220 --> 00:00:52.200 align:middle line:84%
So keylogging is not just part
of a penetration test or post

00:00:52.200 --> 00:00:53.890 align:middle line:90%
exploitation for that matter.

00:00:53.890 --> 00:00:57.120 align:middle line:84%
It's also used by intelligence
agencies and governments

00:00:57.120 --> 00:01:00.300 align:middle line:84%
to monitor people to
essentially gather data, as well

00:01:00.300 --> 00:01:01.890 align:middle line:90%
as malicious actors.

00:01:01.890 --> 00:01:05.640 align:middle line:84%
So the typical way or
the typical access vector

00:01:05.640 --> 00:01:08.880 align:middle line:84%
is they would gain access
to your target system

00:01:08.880 --> 00:01:11.310 align:middle line:84%
either physically or
remotely and install

00:01:11.310 --> 00:01:15.060 align:middle line:84%
a piece of keylogging software
that runs in the background.

00:01:15.060 --> 00:01:18.000 align:middle line:84%
Or some of the other
techniques that are leveraged

00:01:18.000 --> 00:01:21.180 align:middle line:84%
or that are utilized are
malicious USB devices

00:01:21.180 --> 00:01:23.640 align:middle line:84%
that are plugged in at
the back of the system.

00:01:23.640 --> 00:01:26.790 align:middle line:84%
And they essentially capture all
the keystrokes or all the input

00:01:26.790 --> 00:01:30.310 align:middle line:84%
that's being inputted by your
keyboard and mouse as well

00:01:30.310 --> 00:01:33.540 align:middle line:84%
and then sends that data back
onto the attacker's system

00:01:33.540 --> 00:01:36.210 align:middle line:84%
or to the system that
has been specified

00:01:36.210 --> 00:01:39.000 align:middle line:90%
by the actual malicious actor.

00:01:39.000 --> 00:01:41.760 align:middle line:84%
Now, we do need to explore
all of these programs

00:01:41.760 --> 00:01:44.190 align:middle line:84%
because Meterpreter
on a Windows system

00:01:44.190 --> 00:01:47.430 align:middle line:84%
provides us with the ability to
capture the keystrokes entered

00:01:47.430 --> 00:01:50.440 align:middle line:84%
on a target system and download
them back to our local system.

00:01:50.440 --> 00:01:52.120 align:middle line:90%
So why is this important?

00:01:52.120 --> 00:01:54.300 align:middle line:84%
Well, let's say we
don't want to interact

00:01:54.300 --> 00:01:56.490 align:middle line:84%
with the target system
via RBP because it's

00:01:56.490 --> 00:01:57.720 align:middle line:90%
too much of a risk.

00:01:57.720 --> 00:02:01.590 align:middle line:84%
And, of course, we risk getting
caught because we're actually

00:02:01.590 --> 00:02:04.320 align:middle line:84%
physically interacting with
the system with a mouse

00:02:04.320 --> 00:02:05.760 align:middle line:90%
and clicking around.

00:02:05.760 --> 00:02:08.220 align:middle line:84%
So what we can do
is we can set up

00:02:08.220 --> 00:02:09.930 align:middle line:84%
keylogging through
Meterpreter so

00:02:09.930 --> 00:02:12.720 align:middle line:84%
that every keystroke or
every piece of data that's

00:02:12.720 --> 00:02:14.760 align:middle line:84%
entered by the user
on the target system

00:02:14.760 --> 00:02:19.020 align:middle line:84%
like website passwords,
maybe other credentials

00:02:19.020 --> 00:02:21.310 align:middle line:84%
will all essentially
be captured.

00:02:21.310 --> 00:02:23.880 align:middle line:84%
And then we can get that
data back and then utilize

00:02:23.880 --> 00:02:28.230 align:middle line:84%
that data to essentially exploit
the target environment further

00:02:28.230 --> 00:02:32.580 align:middle line:84%
or to gain access to some
of the websites or accounts

00:02:32.580 --> 00:02:35.340 align:middle line:84%
that the target individual
is logging into.

00:02:35.340 --> 00:02:38.400 align:middle line:84%
So again, it's a very,
very important process.

00:02:38.400 --> 00:02:41.350 align:middle line:84%
And it's one that I think you
guys should be familiar with.

00:02:41.350 --> 00:02:44.700 align:middle line:84%
So let's take a look
at how we can do this.

00:02:44.700 --> 00:02:46.180 align:middle line:84%
And all you need
to do, of course,

00:02:46.180 --> 00:02:48.330 align:middle line:84%
is to start up your
lab environment,

00:02:48.330 --> 00:02:50.250 align:middle line:90%
and I'll join you in.

00:02:50.250 --> 00:02:52.830 align:middle line:84%
And we can get started
with essentially

00:02:52.830 --> 00:02:54.420 align:middle line:84%
exploring the
process of performing

00:02:54.420 --> 00:02:56.170 align:middle line:90%
keylogging on a Windows target.

00:02:56.170 --> 00:02:57.270 align:middle line:90%
So I'll see you there.

00:02:57.270 --> 00:03:00.290 align:middle line:90%


00:03:00.290 --> 00:03:02.060 align:middle line:84%
So I'm back within
the lab environment.

00:03:02.060 --> 00:03:04.280 align:middle line:84%
And within this lab
environment, you

00:03:04.280 --> 00:03:07.010 align:middle line:84%
have the option of switching
between the attacker machine as

00:03:07.010 --> 00:03:08.580 align:middle line:90%
well as the target machine.

00:03:08.580 --> 00:03:10.790 align:middle line:84%
And the reason this
is enabled is that--

00:03:10.790 --> 00:03:14.990 align:middle line:84%
or is so that you can actually
perform the actual keylogging

00:03:14.990 --> 00:03:17.670 align:middle line:84%
process and visualize or
see that it actually works.

00:03:17.670 --> 00:03:20.420 align:middle line:84%
So we'll actually
enable the keylogger

00:03:20.420 --> 00:03:23.000 align:middle line:84%
and then head over
to the target system,

00:03:23.000 --> 00:03:24.695 align:middle line:84%
type in a few usernames
and passwords.

00:03:24.695 --> 00:03:26.480 align:middle line:84%
We're enter some
data with a keyboard

00:03:26.480 --> 00:03:28.980 align:middle line:84%
and then see that
indeed it does work.

00:03:28.980 --> 00:03:31.700 align:middle line:84%
Now the target system is running
Bad Blue Enterprise Edition,

00:03:31.700 --> 00:03:34.250 align:middle line:84%
so we are going to be utilizing
that vulnerable service

00:03:34.250 --> 00:03:35.730 align:middle line:90%
in order to gain access.

00:03:35.730 --> 00:03:37.790 align:middle line:84%
So I'm just going to
copy the target IP,

00:03:37.790 --> 00:03:40.430 align:middle line:84%
and I'm going to open
up a terminal here.

00:03:40.430 --> 00:03:41.300 align:middle line:90%
Maximize it.

00:03:41.300 --> 00:03:43.050 align:middle line:84%
And let's increase
the font size,

00:03:43.050 --> 00:03:44.550 align:middle line:90%
so you can see what's going on.

00:03:44.550 --> 00:03:47.090 align:middle line:84%
And I'm just going to start
up the PostgreSQL Database

00:03:47.090 --> 00:03:51.610 align:middle line:90%
Service and also MSF console.

00:03:51.610 --> 00:03:53.680 align:middle line:84%
The reason we're starting
the PostgreSQL Database

00:03:53.680 --> 00:03:56.680 align:middle line:84%
Service in this case is
because all of the keystrokes

00:03:56.680 --> 00:03:59.170 align:middle line:84%
will actually be saved within
the MetasPloit framework

00:03:59.170 --> 00:04:02.140 align:middle line:84%
database within our
current workspace.

00:04:02.140 --> 00:04:05.390 align:middle line:84%
So I'm just going to wait for
this to actually complete.

00:04:05.390 --> 00:04:06.170 align:middle line:90%
There we are.

00:04:06.170 --> 00:04:09.370 align:middle line:84%
And as you can see, we have
access to a MSF console.

00:04:09.370 --> 00:04:11.320 align:middle line:84%
So I'm going to create
a workspace here,

00:04:11.320 --> 00:04:13.520 align:middle line:90%
and I am going to call it--

00:04:13.520 --> 00:04:16.709 align:middle line:90%
we will call it Keylogging.

00:04:16.709 --> 00:04:17.579 align:middle line:90%
Fantastic.

00:04:17.579 --> 00:04:19.709 align:middle line:84%
So given that we
know that the target

00:04:19.709 --> 00:04:22.330 align:middle line:84%
system is running Bad Blue,
we can search for the Bad Blue

00:04:22.330 --> 00:04:22.830 align:middle line:90%
exploits.

00:04:22.830 --> 00:04:25.350 align:middle line:84%
I'm going to just
say search badblue.

00:04:25.350 --> 00:04:25.950 align:middle line:90%
There we are.

00:04:25.950 --> 00:04:28.710 align:middle line:90%
And we are going to utilize--

00:04:28.710 --> 00:04:31.290 align:middle line:84%
we are going to utilize this
particular exploit module here.

00:04:31.290 --> 00:04:33.000 align:middle line:84%
However, before
we do that, let's

00:04:33.000 --> 00:04:35.820 align:middle line:84%
set up the global variable
for the RHOSTS option

00:04:35.820 --> 00:04:38.460 align:middle line:84%
to the target IP
so that we don't

00:04:38.460 --> 00:04:42.500 align:middle line:84%
have to type in the target IP
every time we load a module.

00:04:42.500 --> 00:04:44.040 align:middle line:84%
So I'm going to
say copy, and I'm

00:04:44.040 --> 00:04:45.340 align:middle line:90%
going to paste that in there.

00:04:45.340 --> 00:04:47.720 align:middle line:84%
So we're going to say use that
particular exploit module.

00:04:47.720 --> 00:04:51.240 align:middle line:84%
If we show the options,
you can see that the target

00:04:51.240 --> 00:04:52.200 align:middle line:90%
IP is specified.

00:04:52.200 --> 00:04:53.580 align:middle line:90%
The target port is specified.

00:04:53.580 --> 00:04:56.530 align:middle line:84%
The only option we need to
change is the exploit target.

00:04:56.530 --> 00:05:02.010 align:middle line:84%
So I'm going to say set target
to BadBlue Enterprise Edition

00:05:02.010 --> 00:05:03.450 align:middle line:90%
2.7 Universal.

00:05:03.450 --> 00:05:06.210 align:middle line:84%
And it exploit, and we should
get a Meterpreter session

00:05:06.210 --> 00:05:09.550 align:middle line:90%
on the target system.

00:05:09.550 --> 00:05:10.150 align:middle line:90%
There we go.

00:05:10.150 --> 00:05:13.000 align:middle line:84%
We get a Meterpreter session
on the target system.

00:05:13.000 --> 00:05:15.740 align:middle line:84%
And we can perform some
quick enumeration here.

00:05:15.740 --> 00:05:20.503 align:middle line:84%
So I'm going to say sysinfo
and maybe get user ID.

00:05:20.503 --> 00:05:21.045 align:middle line:90%
There we are.

00:05:21.045 --> 00:05:23.410 align:middle line:84%
So we currently have
administrative access.

00:05:23.410 --> 00:05:26.260 align:middle line:84%
So what we can do
now is, of course,

00:05:26.260 --> 00:05:28.020 align:middle line:90%
get started with the keylogging.

00:05:28.020 --> 00:05:31.260 align:middle line:84%
But before we do that, I'm going
to migrate to the Explorer.exe

00:05:31.260 --> 00:05:33.780 align:middle line:84%
process because,
for some reason,

00:05:33.780 --> 00:05:36.300 align:middle line:84%
the keylogging service
or functionality

00:05:36.300 --> 00:05:40.620 align:middle line:84%
within Meterpreter doesn't
really work very well when it's

00:05:40.620 --> 00:05:44.520 align:middle line:84%
not done on the Explorer
process or when we don't have

00:05:44.520 --> 00:05:46.830 align:middle line:84%
access or Meterpreter's
not running

00:05:46.830 --> 00:05:48.000 align:middle line:90%
within the Explorer process.

00:05:48.000 --> 00:05:51.390 align:middle line:84%
So I'm going to just
search for Explorer.exe

00:05:51.390 --> 00:05:53.790 align:middle line:90%
And we can migrate to 2312.

00:05:53.790 --> 00:05:56.145 align:middle line:84%
And, of course, that will
give us a 32 or rather

00:05:56.145 --> 00:05:59.210 align:middle line:90%
a 64-bit Meterpreter session.

00:05:59.210 --> 00:05:59.780 align:middle line:90%
There we are.

00:05:59.780 --> 00:06:02.930 align:middle line:84%
So that should migrate
relatively easily.

00:06:02.930 --> 00:06:05.750 align:middle line:84%
Now that is done, we can
open up the documentation

00:06:05.750 --> 00:06:06.680 align:middle line:90%
for Meterpreter.

00:06:06.680 --> 00:06:12.920 align:middle line:84%
And if we head over onto the
actual user interface commands,

00:06:12.920 --> 00:06:16.160 align:middle line:84%
you can see that we have
the ability to, again,

00:06:16.160 --> 00:06:19.310 align:middle line:84%
capture keystrokes, stop
capturing keystrokes,

00:06:19.310 --> 00:06:21.020 align:middle line:90%
and dump the keystroke buffer.

00:06:21.020 --> 00:06:23.980 align:middle line:84%
So these are the three commands
that we will be utilizing.

00:06:23.980 --> 00:06:26.480 align:middle line:84%
Now there are a few others that
you can use like the ability

00:06:26.480 --> 00:06:28.040 align:middle line:90%
to send keystrokes.

00:06:28.040 --> 00:06:31.010 align:middle line:84%
But that really is redundant if
you have access via Meterpreter

00:06:31.010 --> 00:06:32.630 align:middle line:84%
because you can
pretty much execute

00:06:32.630 --> 00:06:35.120 align:middle line:84%
all the commands that
you want to execute

00:06:35.120 --> 00:06:36.600 align:middle line:90%
remotely using Meterpreter.

00:06:36.600 --> 00:06:41.040 align:middle line:84%
So the key commands here are
the key scan commands here.

00:06:41.040 --> 00:06:44.180 align:middle line:84%
So what we can do is head
over to the target machine.

00:06:44.180 --> 00:06:48.378 align:middle line:84%
And I'm just going to open up a
Notepad session really quickly.

00:06:48.378 --> 00:06:48.920 align:middle line:90%
There we are.

00:06:48.920 --> 00:06:50.450 align:middle line:84%
I'm just going to
open up Notepad

00:06:50.450 --> 00:06:52.130 align:middle line:84%
so that we can
enter some test data

00:06:52.130 --> 00:06:53.870 align:middle line:84%
and see whether
it's being captured.

00:06:53.870 --> 00:06:57.140 align:middle line:84%
And what we'll do is head over
back to the attacker machine

00:06:57.140 --> 00:06:58.920 align:middle line:90%
and start the key scan.

00:06:58.920 --> 00:07:00.530 align:middle line:84%
So I'm going to
say keyscan_start.

00:07:00.530 --> 00:07:04.958 align:middle line:90%


00:07:04.958 --> 00:07:05.500 align:middle line:90%
There we are.

00:07:05.500 --> 00:07:08.070 align:middle line:84%
That's going to start
the key stroke sniffer.

00:07:08.070 --> 00:07:09.660 align:middle line:84%
If we head over to
the target machine

00:07:09.660 --> 00:07:14.520 align:middle line:84%
and start typing in some
data maybe like a username.

00:07:14.520 --> 00:07:17.190 align:middle line:84%
Maybe we can say the
username is just admin,

00:07:17.190 --> 00:07:22.920 align:middle line:84%
and then the password is
maybe hacked321 or something

00:07:22.920 --> 00:07:23.680 align:middle line:90%
really simple.

00:07:23.680 --> 00:07:27.270 align:middle line:84%
So essentially, any data that's
being input by the keyboard,

00:07:27.270 --> 00:07:30.960 align:middle line:84%
whether it's in the
browser or within any text

00:07:30.960 --> 00:07:35.730 align:middle line:84%
editor like Notepad or really
any input from the keyboard

00:07:35.730 --> 00:07:38.910 align:middle line:84%
is going to be captured, so it's
not limited just to Notepad.

00:07:38.910 --> 00:07:41.820 align:middle line:84%
So we've started the
keystroke sniffer.

00:07:41.820 --> 00:07:46.020 align:middle line:84%
We can then say keystroke_dump
or keyscan_dump.

00:07:46.020 --> 00:07:47.610 align:middle line:90%
That will dump the buffer.

00:07:47.610 --> 00:07:50.340 align:middle line:84%
And as you can see, it will
dump the captured keystroke.

00:07:50.340 --> 00:07:53.130 align:middle line:84%
So it says right over
here we used the-- so

00:07:53.130 --> 00:07:55.300 align:middle line:84%
it actually highlights
some of the function keys.

00:07:55.300 --> 00:07:59.760 align:middle line:84%
So it says shift, username,
shift, shift, admin,

00:07:59.760 --> 00:08:00.930 align:middle line:90%
shift, password.

00:08:00.930 --> 00:08:04.650 align:middle line:84%
And the reason it's saying
shift is because I actually

00:08:04.650 --> 00:08:05.745 align:middle line:90%
set this to uppercase.

00:08:05.745 --> 00:08:07.620 align:middle line:84%
So whenever you're
working with the keyboard,

00:08:07.620 --> 00:08:11.850 align:middle line:84%
you use shift to essentially set
the actual letter to uppercase.

00:08:11.850 --> 00:08:13.300 align:middle line:90%
So that's why you're seeing it.

00:08:13.300 --> 00:08:14.860 align:middle line:84%
And then, of course,
in this case,

00:08:14.860 --> 00:08:17.198 align:middle line:84%
we actually
performed a backspace

00:08:17.198 --> 00:08:18.240 align:middle line:90%
and then typed in hacked.

00:08:18.240 --> 00:08:20.380 align:middle line:84%
So you can see that
this does work.

00:08:20.380 --> 00:08:27.000 align:middle line:84%
We can also continue entering
data like this is sample data.

00:08:27.000 --> 00:08:29.160 align:middle line:84%
And we can then head
over back in here

00:08:29.160 --> 00:08:31.020 align:middle line:90%
and perform the keyscan_dump.

00:08:31.020 --> 00:08:33.600 align:middle line:84%
As you can see, this
is some sample data.

00:08:33.600 --> 00:08:36.360 align:middle line:84%
And again, it's fairly
simple to understand.

00:08:36.360 --> 00:08:39.299 align:middle line:84%
We can also open up maybe
a partial session here

00:08:39.299 --> 00:08:41.880 align:middle line:90%
and type in ipconfig.

00:08:41.880 --> 00:08:42.510 align:middle line:90%
There we are.

00:08:42.510 --> 00:08:44.910 align:middle line:84%
That'll give us
all the interfaces.

00:08:44.910 --> 00:08:46.200 align:middle line:90%
We'll give that a few seconds.

00:08:46.200 --> 00:08:47.920 align:middle line:90%
PowerShell is relatively slow.

00:08:47.920 --> 00:08:49.150 align:middle line:90%
So there we are.

00:08:49.150 --> 00:08:51.060 align:middle line:84%
And we can then
say keyscan_dump.

00:08:51.060 --> 00:08:54.400 align:middle line:84%
And in this case, it doesn't
actually capture that.

00:08:54.400 --> 00:08:58.560 align:middle line:84%
So what we can do is stop
the actual key scan sniffer.

00:08:58.560 --> 00:09:01.360 align:middle line:84%
So we're going to say stop
and then start it again.

00:09:01.360 --> 00:09:02.890 align:middle line:84%
So you may experience
this issue.

00:09:02.890 --> 00:09:04.470 align:middle line:90%
So I'm going to say start again.

00:09:04.470 --> 00:09:07.950 align:middle line:84%
And now if we type in
ipconfig on the target,

00:09:07.950 --> 00:09:10.620 align:middle line:84%
and let's see whether that's
actually going to be dumped,

00:09:10.620 --> 00:09:13.110 align:middle line:90%
so keyscan_dump.

00:09:13.110 --> 00:09:15.300 align:middle line:84%
As you can see, ipconfig
is now captured.

00:09:15.300 --> 00:09:17.315 align:middle line:84%
So you may need to
start and stop it

00:09:17.315 --> 00:09:19.440 align:middle line:84%
depending on the application
that's currently being

00:09:19.440 --> 00:09:20.860 align:middle line:90%
used on the target system.

00:09:20.860 --> 00:09:23.260 align:middle line:84%
So it's a good idea
to keep that in mind.

00:09:23.260 --> 00:09:26.130 align:middle line:84%
So that is the
process of performing

00:09:26.130 --> 00:09:27.990 align:middle line:90%
keylogging on a Windows system.

00:09:27.990 --> 00:09:29.490 align:middle line:84%
And as you can see,
this can be very

00:09:29.490 --> 00:09:32.370 align:middle line:84%
helpful in capturing some
really important data

00:09:32.370 --> 00:09:36.030 align:middle line:84%
that the user on the target
system may be entering.

00:09:36.030 --> 00:09:38.670 align:middle line:84%
So that is going to conclude
the practical demonstration

00:09:38.670 --> 00:09:41.270 align:middle line:90%
side of this video.

00:09:41.270 --> 00:09:43.490 align:middle line:84%
In the next video,
we will be exploring

00:09:43.490 --> 00:09:46.273 align:middle line:84%
the process of clearing our
tracks on a Windows system.

00:09:46.273 --> 00:09:47.690 align:middle line:84%
So we will be
taking a look at how

00:09:47.690 --> 00:09:51.020 align:middle line:84%
to clear the Windows event
logs on a Windows target system

00:09:51.020 --> 00:09:53.390 align:middle line:84%
and why this is so
important once you're

00:09:53.390 --> 00:09:56.660 align:middle line:84%
done with your assessment
or penetration test.

00:09:56.660 --> 00:09:59.280 align:middle line:84%
So that's what we're going to
be exploring in the next video,

00:09:59.280 --> 00:10:01.500 align:middle line:90%
and I'll see you there.

00:10:01.500 --> 00:10:02.000 align:middle line:90%