WEBVTT

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


00:00:03.388 --> 00:00:06.776 align:middle line:90%
[MUSIC PLAYING]

00:00:06.776 --> 00:00:10.170 align:middle line:90%


00:00:10.170 --> 00:00:13.900 align:middle line:84%
Welcome to the clearing your
tracks section of this course.

00:00:13.900 --> 00:00:16.800 align:middle line:84%
This is going to be the
final section of this course.

00:00:16.800 --> 00:00:19.020 align:middle line:84%
And within this
section, we're going

00:00:19.020 --> 00:00:20.550 align:middle line:84%
to be covering
the process of how

00:00:20.550 --> 00:00:24.900 align:middle line:84%
to clear your tracks on
both Windows and Linux.

00:00:24.900 --> 00:00:27.540 align:middle line:84%
And this is a very,
very important section,

00:00:27.540 --> 00:00:30.420 align:middle line:84%
and it's coming at
the end of this course

00:00:30.420 --> 00:00:33.510 align:middle line:84%
primarily because this
is where it belongs.

00:00:33.510 --> 00:00:36.720 align:middle line:84%
And I'm going to be explaining
a few important things

00:00:36.720 --> 00:00:40.638 align:middle line:84%
to actually keep in mind as
you actually go about clearing

00:00:40.638 --> 00:00:41.430 align:middle line:90%
your tracks, right?

00:00:41.430 --> 00:00:45.840 align:middle line:84%
So let's get started with how
to clear your tracks on Windows.

00:00:45.840 --> 00:00:48.600 align:middle line:84%
Now, before we explore a
practical demonstration,

00:00:48.600 --> 00:00:50.670 align:middle line:90%
I need to explain a few things.

00:00:50.670 --> 00:00:54.270 align:middle line:84%
So the exploitation and
postexploitation phases

00:00:54.270 --> 00:00:57.510 align:middle line:84%
of a penetration test will
typically involve actively

00:00:57.510 --> 00:01:00.750 align:middle line:84%
engaging with target
systems and the data that

00:01:00.750 --> 00:01:02.500 align:middle line:90%
is stored on these systems.

00:01:02.500 --> 00:01:04.530 align:middle line:84%
Now, this is very
important because if we

00:01:04.530 --> 00:01:08.372 align:middle line:84%
use an example or an
analogy and the example,

00:01:08.372 --> 00:01:10.830 align:middle line:84%
I'm going to be using is let's
say you have been contracted

00:01:10.830 --> 00:01:15.270 align:middle line:84%
to perform a penetration test
on a small to medium-sized

00:01:15.270 --> 00:01:19.710 align:middle line:84%
business or company that has
maybe about 20 systems, right?

00:01:19.710 --> 00:01:22.560 align:middle line:84%
And within the rules of
engagement, the client

00:01:22.560 --> 00:01:26.490 align:middle line:84%
and yourself or your company
that you represent agree

00:01:26.490 --> 00:01:31.455 align:middle line:84%
upon specific
guidelines regarding

00:01:31.455 --> 00:01:34.050 align:middle line:84%
the interaction of
you, the penetration

00:01:34.050 --> 00:01:37.020 align:middle line:84%
tester, with the
client's systems

00:01:37.020 --> 00:01:39.960 align:middle line:84%
during and after
exploitation-- so

00:01:39.960 --> 00:01:43.320 align:middle line:84%
during the exploitation phase
and post exploitation phase.

00:01:43.320 --> 00:01:46.590 align:middle line:84%
And what the client will
essentially stipulate is that

00:01:46.590 --> 00:01:49.830 align:middle line:84%
there are certain things
that you can and cannot do.

00:01:49.830 --> 00:01:52.935 align:middle line:84%
And of course, you might have
a good idea as to what this is.

00:01:52.935 --> 00:01:56.190 align:middle line:84%
This is all pertinent to the
operation of these target

00:01:56.190 --> 00:01:59.620 align:middle line:84%
systems and the data that is
stored on these target systems.

00:01:59.620 --> 00:02:04.140 align:middle line:84%
So if you're performing a
pen test on 10 or 15 systems

00:02:04.140 --> 00:02:07.660 align:middle line:84%
and these are systems that
are used by employees--

00:02:07.660 --> 00:02:10.500 align:middle line:84%
they could be servers that
are hosting web applications

00:02:10.500 --> 00:02:14.580 align:middle line:84%
and business-critical
applications-- then the client

00:02:14.580 --> 00:02:17.250 align:middle line:84%
will essentially tell you,
hey, once you gain access

00:02:17.250 --> 00:02:19.770 align:middle line:84%
to the target
system, I don't want

00:02:19.770 --> 00:02:21.330 align:middle line:90%
you to manipulate anything.

00:02:21.330 --> 00:02:23.830 align:middle line:84%
I don't want you to
create any user accounts.

00:02:23.830 --> 00:02:26.670 align:middle line:84%
I don't want you
to modify anything

00:02:26.670 --> 00:02:28.360 align:middle line:84%
pertinent to the
operating system,

00:02:28.360 --> 00:02:32.730 align:middle line:84%
so I don't want you to delete
or modify the Windows Registry.

00:02:32.730 --> 00:02:34.530 align:middle line:84%
And essentially,
I don't want you

00:02:34.530 --> 00:02:36.660 align:middle line:84%
to do anything that
could jeopardize

00:02:36.660 --> 00:02:39.180 align:middle line:84%
the integrity of
the operating system

00:02:39.180 --> 00:02:42.060 align:middle line:84%
and consequently lead to that
operating system failing,

00:02:42.060 --> 00:02:44.970 align:middle line:84%
which would consequently
lead to data loss.

00:02:44.970 --> 00:02:49.830 align:middle line:84%
And this also applies to the
web applications or applications

00:02:49.830 --> 00:02:52.450 align:middle line:84%
that are running on
that operating system.

00:02:52.450 --> 00:02:56.040 align:middle line:84%
And so this the process
of clearing your tracks

00:02:56.040 --> 00:02:59.610 align:middle line:84%
and the postexploitation
phase of a penetration test

00:02:59.610 --> 00:03:04.410 align:middle line:84%
really needs to be in alignment
with the rules of engagement

00:03:04.410 --> 00:03:07.110 align:middle line:84%
that you have agreed upon
with the client, right?

00:03:07.110 --> 00:03:08.820 align:middle line:84%
And this is something
that you will

00:03:08.820 --> 00:03:12.730 align:middle line:84%
get an understanding of before
you begin the penetration test.

00:03:12.730 --> 00:03:17.040 align:middle line:84%
So as a result, you may be
required to clear or undo

00:03:17.040 --> 00:03:19.410 align:middle line:84%
any changes you have made to
the target systems you have

00:03:19.410 --> 00:03:21.690 align:middle line:84%
compromised based on
the guidelines specified

00:03:21.690 --> 00:03:23.440 align:middle line:90%
in the rules of engagement.

00:03:23.440 --> 00:03:27.390 align:middle line:84%
So in certain cases, a
client could tell you, OK,

00:03:27.390 --> 00:03:30.000 align:middle line:84%
once you gain access
to a target system,

00:03:30.000 --> 00:03:32.310 align:middle line:84%
you could create another
user account just

00:03:32.310 --> 00:03:36.210 align:middle line:84%
to showcase what a
real attacker would do

00:03:36.210 --> 00:03:37.960 align:middle line:90%
or an adversary would do.

00:03:37.960 --> 00:03:40.800 align:middle line:84%
However, when you're done
with your penetration test,

00:03:40.800 --> 00:03:43.290 align:middle line:84%
you need to go back to
all of these systems

00:03:43.290 --> 00:03:45.480 align:middle line:84%
and you need to delete
those user accounts.

00:03:45.480 --> 00:03:46.750 align:middle line:90%
That's just an example.

00:03:46.750 --> 00:03:49.320 align:middle line:84%
So again, keep the
rules of engagement

00:03:49.320 --> 00:03:53.220 align:middle line:84%
in mind before you begin
the penetration test,

00:03:53.220 --> 00:03:55.440 align:middle line:84%
and make sure that
you refer to them

00:03:55.440 --> 00:03:59.830 align:middle line:84%
at every step or every phase
of the penetration test.

00:03:59.830 --> 00:04:03.120 align:middle line:84%
So if you've transferred any
files to the target systems

00:04:03.120 --> 00:04:05.280 align:middle line:84%
that you have
compromised, keep track

00:04:05.280 --> 00:04:07.560 align:middle line:84%
of where they have
been saved or stored

00:04:07.560 --> 00:04:10.350 align:middle line:84%
so that you can remove them or
delete them when you're done.

00:04:10.350 --> 00:04:13.890 align:middle line:84%
And as a good practice
that I actually

00:04:13.890 --> 00:04:17.130 align:middle line:84%
recommended during
the transferring files

00:04:17.130 --> 00:04:19.890 align:middle line:84%
section of this course is
to store all your scripts,

00:04:19.890 --> 00:04:22.560 align:middle line:84%
exploits, executables,
and binaries

00:04:22.560 --> 00:04:26.880 align:middle line:84%
in the operating system
relevant temp directories.

00:04:26.880 --> 00:04:29.910 align:middle line:84%
So if you've exploited or gained
access to a Windows system

00:04:29.910 --> 00:04:32.200 align:middle line:84%
and you want to transfer
some files onto it,

00:04:32.200 --> 00:04:34.770 align:middle line:84%
don't just blindly upload
or transfer the files

00:04:34.770 --> 00:04:37.320 align:middle line:84%
to the desktop of a
specific user account

00:04:37.320 --> 00:04:39.150 align:middle line:90%
or to the downloads directory.

00:04:39.150 --> 00:04:41.318 align:middle line:84%
Store them within
the temp directory.

00:04:41.318 --> 00:04:43.360 align:middle line:84%
There's two reasons why
you should be doing this.

00:04:43.360 --> 00:04:45.540 align:middle line:84%
Firstly, you'll know
where everything

00:04:45.540 --> 00:04:47.040 align:middle line:84%
that you've
transferred is saved,

00:04:47.040 --> 00:04:49.920 align:middle line:84%
so you know that whatever you
transferred onto the target

00:04:49.920 --> 00:04:52.360 align:middle line:84%
system is stored within
the temp directory.

00:04:52.360 --> 00:04:55.080 align:middle line:84%
So there's a singular,
centralized location where

00:04:55.080 --> 00:04:56.200 align:middle line:90%
you're storing everything.

00:04:56.200 --> 00:05:01.290 align:middle line:84%
Secondly, in the context
of defense evasion,

00:05:01.290 --> 00:05:04.540 align:middle line:84%
this will essentially-- storing
your exploits and scripts

00:05:04.540 --> 00:05:07.900 align:middle line:84%
within a temp directory is
a good practice primarily

00:05:07.900 --> 00:05:10.810 align:middle line:84%
because it is not a
frequently-accessed folder

00:05:10.810 --> 00:05:13.540 align:middle line:84%
and users will not
really be able to tell

00:05:13.540 --> 00:05:15.700 align:middle line:84%
whether the system has been
compromised because all

00:05:15.700 --> 00:05:17.950 align:middle line:84%
the files are stored
within a directory

00:05:17.950 --> 00:05:21.370 align:middle line:84%
that they don't really
or frequently access.

00:05:21.370 --> 00:05:23.500 align:middle line:84%
And the same goes
for Linux, right?

00:05:23.500 --> 00:05:25.600 align:middle line:84%
If you are transferring
files or scripts,

00:05:25.600 --> 00:05:27.610 align:middle line:84%
exploits or binaries
transfer them

00:05:27.610 --> 00:05:30.700 align:middle line:84%
to the tmp directory,
which is just

00:05:30.700 --> 00:05:33.050 align:middle line:90%
the temp directory for Linux.

00:05:33.050 --> 00:05:34.820 align:middle line:90%
So do keep that in mind.

00:05:34.820 --> 00:05:36.820 align:middle line:84%
And as I said, if
you've done this

00:05:36.820 --> 00:05:38.650 align:middle line:84%
and you follow
this good practice,

00:05:38.650 --> 00:05:41.020 align:middle line:84%
then once you're done with
your penetration test,

00:05:41.020 --> 00:05:43.558 align:middle line:84%
you can easily go back to
the temp folder and delete

00:05:43.558 --> 00:05:44.350 align:middle line:90%
everything from it.

00:05:44.350 --> 00:05:45.100 align:middle line:90%
And that's it.

00:05:45.100 --> 00:05:46.930 align:middle line:84%
All the artifacts
or all the files

00:05:46.930 --> 00:05:51.920 align:middle line:84%
that you transferred onto
that target system are gone.

00:05:51.920 --> 00:05:55.790 align:middle line:84%
Now, it is also important
to consider the exploitation

00:05:55.790 --> 00:05:57.410 align:middle line:90%
framework that you are using.

00:05:57.410 --> 00:06:02.120 align:middle line:84%
An example of this is the
Metasploit framework exploit

00:06:02.120 --> 00:06:06.920 align:middle line:84%
or postexploitation framework--
whatever you're using MSF for.

00:06:06.920 --> 00:06:09.590 align:middle line:84%
Now, MSF-- or the
Metasploit Framework--

00:06:09.590 --> 00:06:12.320 align:middle line:84%
is notorious for
generating and storing

00:06:12.320 --> 00:06:15.890 align:middle line:84%
artifacts on the target
system when using exploit

00:06:15.890 --> 00:06:17.450 align:middle line:90%
or postexploitation modules.

00:06:17.450 --> 00:06:19.460 align:middle line:84%
So you might have seen
within this course.

00:06:19.460 --> 00:06:23.330 align:middle line:84%
When we used a specific exploit
module or postexploitation

00:06:23.330 --> 00:06:25.370 align:middle line:84%
module, after running
it, it may tell you

00:06:25.370 --> 00:06:28.730 align:middle line:84%
that that module
was unable to delete

00:06:28.730 --> 00:06:31.910 align:middle line:84%
the artifact or the script that
it transferred to the target

00:06:31.910 --> 00:06:32.600 align:middle line:90%
system.

00:06:32.600 --> 00:06:35.540 align:middle line:84%
And as a result, you need
to delete it manually.

00:06:35.540 --> 00:06:39.240 align:middle line:84%
And it provides you with the
path to that particular file.

00:06:39.240 --> 00:06:42.470 align:middle line:84%
So whenever you're running
Metasploit framework exploit

00:06:42.470 --> 00:06:46.070 align:middle line:84%
or postexploitation
modules, pay close attention

00:06:46.070 --> 00:06:49.220 align:middle line:84%
to the output generated by
that module when you run it

00:06:49.220 --> 00:06:53.330 align:middle line:84%
as it will tell you whether
it's generating any artifacts.

00:06:53.330 --> 00:06:55.970 align:middle line:84%
And if so, where
they can be found

00:06:55.970 --> 00:06:59.960 align:middle line:84%
if it is unable to delete them
because some well-developed

00:06:59.960 --> 00:07:03.500 align:middle line:84%
Metasploit framework exploit
and postexploitation modules

00:07:03.500 --> 00:07:06.530 align:middle line:84%
are actually very,
very useful in that

00:07:06.530 --> 00:07:10.130 align:middle line:84%
once they have transferred
a script or an executable

00:07:10.130 --> 00:07:13.100 align:middle line:84%
onto the target system for
the purpose of gaining access.

00:07:13.100 --> 00:07:15.620 align:middle line:84%
So for example, if it
sends a stage in order

00:07:15.620 --> 00:07:17.600 align:middle line:84%
for you to obtain a
Meterpreter session,

00:07:17.600 --> 00:07:19.850 align:middle line:84%
if they're well-developed,
it may actually

00:07:19.850 --> 00:07:22.070 align:middle line:84%
go ahead and delete
it for you so that you

00:07:22.070 --> 00:07:24.200 align:middle line:90%
don't have to do it yourself.

00:07:24.200 --> 00:07:26.300 align:middle line:90%
Now, this is not a rule.

00:07:26.300 --> 00:07:27.930 align:middle line:90%
This is the exception.

00:07:27.930 --> 00:07:31.310 align:middle line:84%
So as I said, the
Metasploit framework modules

00:07:31.310 --> 00:07:34.400 align:middle line:84%
or the Metasploit framework
itself is something

00:07:34.400 --> 00:07:36.650 align:middle line:84%
that you need to take into
consideration for your pen

00:07:36.650 --> 00:07:37.280 align:middle line:90%
tests.

00:07:37.280 --> 00:07:40.220 align:middle line:84%
And you need to be very
good at understanding what

00:07:40.220 --> 00:07:45.800 align:middle line:84%
these modules are doing in the
context of transferring files

00:07:45.800 --> 00:07:49.160 align:middle line:84%
onto the target systems
and what or whether or not

00:07:49.160 --> 00:07:53.480 align:middle line:84%
they're interacting with
specific Windows or Linux

00:07:53.480 --> 00:07:56.870 align:middle line:84%
features that you
probably or might not

00:07:56.870 --> 00:07:58.310 align:middle line:90%
have the permission to do.

00:07:58.310 --> 00:08:01.280 align:middle line:84%
So for example, if a
Metasploit framework exploit

00:08:01.280 --> 00:08:04.790 align:middle line:84%
or postexploitation module is
interacting with the Windows

00:08:04.790 --> 00:08:07.610 align:middle line:84%
registry and the
client has stipulated

00:08:07.610 --> 00:08:10.760 align:middle line:84%
within the rules of
engagement that you are not

00:08:10.760 --> 00:08:13.010 align:middle line:84%
allowed to interact with
the Windows registry,

00:08:13.010 --> 00:08:16.550 align:middle line:84%
then do not use that module
because, again, you're

00:08:16.550 --> 00:08:19.820 align:middle line:84%
going to end up making changes
to the Windows registry that

00:08:19.820 --> 00:08:22.700 align:middle line:84%
could be very difficult
to delete remotely

00:08:22.700 --> 00:08:24.950 align:middle line:84%
or through your
Meterpreter session.

00:08:24.950 --> 00:08:27.090 align:middle line:90%
So keep that in mind.

00:08:27.090 --> 00:08:31.980 align:middle line:84%
Now, again, coming back to
some well-designed MSF modules,

00:08:31.980 --> 00:08:34.970 align:middle line:84%
some of them will provide you
with instructions and resource

00:08:34.970 --> 00:08:37.520 align:middle line:84%
scripts that provide you
with information regarding

00:08:37.520 --> 00:08:40.549 align:middle line:84%
where the artifacts are stored
and how they can be removed.

00:08:40.549 --> 00:08:42.650 align:middle line:84%
And in the context
of resource scripts,

00:08:42.650 --> 00:08:46.760 align:middle line:84%
some well-developed MSF modules
will generate a resource script

00:08:46.760 --> 00:08:49.520 align:middle line:84%
that you can run on
that target system

00:08:49.520 --> 00:08:52.830 align:middle line:84%
to undo whatever the module
did in the first place.

00:08:52.830 --> 00:08:56.150 align:middle line:84%
So for example, if we're using
a postexploitation persistence

00:08:56.150 --> 00:09:00.020 align:middle line:84%
module on Windows and
it creates a new service

00:09:00.020 --> 00:09:02.840 align:middle line:84%
and a new executable and all
of that data is transferred

00:09:02.840 --> 00:09:06.680 align:middle line:84%
onto the target system, that
is quite a messy situation

00:09:06.680 --> 00:09:07.440 align:middle line:90%
to deal with.

00:09:07.440 --> 00:09:09.560 align:middle line:84%
And as a result, it
generates a resource script

00:09:09.560 --> 00:09:11.750 align:middle line:84%
that you can run on
the target system,

00:09:11.750 --> 00:09:15.013 align:middle line:84%
and it will delete the
payload or the executable that

00:09:15.013 --> 00:09:15.680 align:middle line:90%
was transferred.

00:09:15.680 --> 00:09:19.290 align:middle line:84%
It will also delete the
service, et cetera, et cetera.

00:09:19.290 --> 00:09:22.530 align:middle line:84%
Now, one additional thing
that you'll typically find,

00:09:22.530 --> 00:09:25.070 align:middle line:84%
especially when it
comes down to Windows,

00:09:25.070 --> 00:09:28.760 align:middle line:84%
is that a typical
postexploitation technique that

00:09:28.760 --> 00:09:30.740 align:middle line:84%
is pertinent to
clearing your tracks

00:09:30.740 --> 00:09:33.260 align:middle line:84%
is to delete the
Windows Event Log.

00:09:33.260 --> 00:09:35.300 align:middle line:84%
So this is not--
this is something

00:09:35.300 --> 00:09:38.180 align:middle line:84%
that I have covered in the
Metasploit framework course,

00:09:38.180 --> 00:09:40.590 align:middle line:84%
and I did that to showcase
how it can be done.

00:09:40.590 --> 00:09:43.530 align:middle line:84%
However, in the context
of a penetration test,

00:09:43.530 --> 00:09:45.920 align:middle line:84%
this is something that
should be avoided completely

00:09:45.920 --> 00:09:51.230 align:middle line:84%
because the Windows Event Log is
essentially a database of logs

00:09:51.230 --> 00:09:54.410 align:middle line:84%
pertinent to the
system, the security,

00:09:54.410 --> 00:09:56.390 align:middle line:84%
authentication
attempts, et cetera.

00:09:56.390 --> 00:09:59.690 align:middle line:84%
And this information or the data
stored within the Windows Event

00:09:59.690 --> 00:10:02.750 align:middle line:84%
Log is very, very
important to the company

00:10:02.750 --> 00:10:05.300 align:middle line:84%
as it gives them
an idea as to what

00:10:05.300 --> 00:10:09.530 align:middle line:84%
has been done on that
system, the ability

00:10:09.530 --> 00:10:13.430 align:middle line:84%
to identify successful and
unsuccessful authentication

00:10:13.430 --> 00:10:15.300 align:middle line:90%
attempts, or so on and so forth.

00:10:15.300 --> 00:10:18.770 align:middle line:84%
So again, this is something that
will and should be stipulated

00:10:18.770 --> 00:10:20.240 align:middle line:90%
within the rules of engagement.

00:10:20.240 --> 00:10:21.215 align:middle line:90%
So you need to agree--

00:10:21.215 --> 00:10:23.090 align:middle line:84%
you actually need to
sit down with the client

00:10:23.090 --> 00:10:26.030 align:middle line:84%
and agree upon what
you can do in terms

00:10:26.030 --> 00:10:27.530 align:middle line:90%
of clearing your tracks.

00:10:27.530 --> 00:10:30.290 align:middle line:84%
And on the client's perspective
or from the client's

00:10:30.290 --> 00:10:32.840 align:middle line:84%
perspective, this is something
that they will typically

00:10:32.840 --> 00:10:36.840 align:middle line:84%
refuse you to do because that
information is very important.

00:10:36.840 --> 00:10:39.650 align:middle line:84%
And if you're performing
a red team operation

00:10:39.650 --> 00:10:42.350 align:middle line:84%
or you're trying to emulate
a particular adversary

00:10:42.350 --> 00:10:46.550 align:middle line:84%
and one of the techniques that
these apt teams or adversaries

00:10:46.550 --> 00:10:49.670 align:middle line:84%
use is to delete or to
clear the Windows Event Log,

00:10:49.670 --> 00:10:52.440 align:middle line:84%
then the company
might agree to that.

00:10:52.440 --> 00:10:54.360 align:middle line:84%
However, it's something
that I would not

00:10:54.360 --> 00:10:58.350 align:middle line:84%
recommend that you do primarily
because the data stored

00:10:58.350 --> 00:11:00.660 align:middle line:84%
within the Windows Event
Log is very important.

00:11:00.660 --> 00:11:03.180 align:middle line:84%
And that event log
is rarely cleared

00:11:03.180 --> 00:11:06.630 align:middle line:84%
because it sort of gives
the company or the person

00:11:06.630 --> 00:11:10.860 align:middle line:84%
using that system a very
good historical overview

00:11:10.860 --> 00:11:14.520 align:middle line:84%
of everything that has been done
on that system from a security

00:11:14.520 --> 00:11:17.170 align:middle line:84%
perspective to a
system perspective--

00:11:17.170 --> 00:11:20.250 align:middle line:84%
so what users logged on,
what programs were installed,

00:11:20.250 --> 00:11:23.700 align:middle line:84%
what updates were installed,
what commands were executed,

00:11:23.700 --> 00:11:27.000 align:middle line:84%
was a PowerShell command
executed, et cetera.

00:11:27.000 --> 00:11:30.030 align:middle line:84%
With that being said, this
video has a lab environment

00:11:30.030 --> 00:11:30.690 align:middle line:90%
attached to it.

00:11:30.690 --> 00:11:32.850 align:middle line:84%
And it's not really going
to be that practical.

00:11:32.850 --> 00:11:37.020 align:middle line:84%
I'm just going to be showcasing
a few examples of what

00:11:37.020 --> 00:11:40.170 align:middle line:84%
this would look like or how to
clear your tracks on Windows.

00:11:40.170 --> 00:11:43.020 align:middle line:84%
And the techniques that
we'll be highlighting

00:11:43.020 --> 00:11:46.780 align:middle line:84%
will essentially abide by what
I've stated within the slides,

00:11:46.780 --> 00:11:47.280 align:middle line:90%
all right?

00:11:47.280 --> 00:11:48.870 align:middle line:84%
So I'll fire up the
lab environment,

00:11:48.870 --> 00:11:49.950 align:middle line:90%
and I'll see you there.

00:11:49.950 --> 00:11:52.650 align:middle line:90%


00:11:52.650 --> 00:11:55.530 align:middle line:84%
All right, so I'm back
within the lab environment.

00:11:55.530 --> 00:11:58.357 align:middle line:84%
And you will be provided
with a target IP address.

00:11:58.357 --> 00:12:00.690 align:middle line:84%
And of course, in your case,
it's going to be different.

00:12:00.690 --> 00:12:02.303 align:middle line:84%
All you need to do
is just copy it.

00:12:02.303 --> 00:12:03.720 align:middle line:84%
So what we're going
to be doing is

00:12:03.720 --> 00:12:06.000 align:middle line:84%
we're going to be
simulating exploitation

00:12:06.000 --> 00:12:07.470 align:middle line:90%
and postexploitation.

00:12:07.470 --> 00:12:10.950 align:middle line:84%
And we'll be keeping
in mind the artifacts

00:12:10.950 --> 00:12:11.880 align:middle line:90%
that we're generating.

00:12:11.880 --> 00:12:15.303 align:middle line:84%
And I'll showcase a few examples
of how they can be cleared.

00:12:15.303 --> 00:12:17.220 align:middle line:84%
And we're going to be
utilizing the Metasploit

00:12:17.220 --> 00:12:20.980 align:middle line:84%
framework for exploitation
and postexploitation.

00:12:20.980 --> 00:12:24.360 align:middle line:84%
So we'll just perform a quick
Nmap scan on the target system

00:12:24.360 --> 00:12:26.700 align:middle line:84%
to identify the vulnerable
service that is running.

00:12:26.700 --> 00:12:29.160 align:middle line:90%
So I'll say Nmap SV.

00:12:29.160 --> 00:12:32.270 align:middle line:84%
And the vulnerable service
is running on port 80.

00:12:32.270 --> 00:12:34.315 align:middle line:84%
I'll paste in the
target IP, and I'll

00:12:34.315 --> 00:12:35.565 align:middle line:90%
give this a couple of seconds.

00:12:35.565 --> 00:12:41.000 align:middle line:90%


00:12:41.000 --> 00:12:42.890 align:middle line:84%
All right, so the
Nmap scan is complete.

00:12:42.890 --> 00:12:45.890 align:middle line:90%
As you can see, port 80 open.

00:12:45.890 --> 00:12:48.680 align:middle line:84%
And we have BadBlue
version 2.7 running on it.

00:12:48.680 --> 00:12:51.710 align:middle line:84%
We already know that
there is an exploit module

00:12:51.710 --> 00:12:53.880 align:middle line:84%
for this specific
version of BadBlue.

00:12:53.880 --> 00:12:56.600 align:middle line:84%
So we'll open up
MSF console here,

00:12:56.600 --> 00:12:59.990 align:middle line:84%
and I'll just search for that
particular exploit module.

00:12:59.990 --> 00:13:02.720 align:middle line:90%
So I'll say search BadBlue.

00:13:02.720 --> 00:13:05.520 align:middle line:84%
And the one we want to use
is this one right over here.

00:13:05.520 --> 00:13:08.990 align:middle line:84%
So that has an ID of one,
so I'm going to say use one.

00:13:08.990 --> 00:13:12.140 align:middle line:84%
And let's show this
particular payload

00:13:12.140 --> 00:13:14.010 align:middle line:84%
or this particular
module's options.

00:13:14.010 --> 00:13:16.820 align:middle line:84%
So if I say options, you
can see that it's utilizing

00:13:16.820 --> 00:13:17.990 align:middle line:90%
the following payload.

00:13:17.990 --> 00:13:20.870 align:middle line:84%
So it's using the 32-bit
Meterpreter payload,

00:13:20.870 --> 00:13:22.910 align:middle line:84%
which makes sense
because we don't really

00:13:22.910 --> 00:13:26.480 align:middle line:84%
know what the target operating
system architecture is.

00:13:26.480 --> 00:13:29.930 align:middle line:84%
We then need to set the target
IP, so I'll say that Rhosts.

00:13:29.930 --> 00:13:31.580 align:middle line:90%
And I'll paste that in there.

00:13:31.580 --> 00:13:34.430 align:middle line:84%
And if I show
advanced, this will

00:13:34.430 --> 00:13:37.910 align:middle line:84%
show me advanced options
pertinent to this particular

00:13:37.910 --> 00:13:38.900 align:middle line:90%
exploit module.

00:13:38.900 --> 00:13:41.810 align:middle line:84%
Now, this is something that's
very important because it will

00:13:41.810 --> 00:13:43.790 align:middle line:84%
essentially-- these
advanced options

00:13:43.790 --> 00:13:47.690 align:middle line:84%
give you a better understanding
as to what this module does.

00:13:47.690 --> 00:13:50.000 align:middle line:84%
And in the context of
clearing your tracks

00:13:50.000 --> 00:13:54.030 align:middle line:84%
and getting rid of artifacts,
this is very important.

00:13:54.030 --> 00:13:57.730 align:middle line:84%
So again, the objective
here is to try and identify

00:13:57.730 --> 00:14:00.860 align:middle line:84%
whether we can find an
option that sort of is

00:14:00.860 --> 00:14:04.970 align:middle line:84%
pertinent to whether or
not this module generates

00:14:04.970 --> 00:14:09.000 align:middle line:84%
specific artifacts and whether
it automatically deletes them.

00:14:09.000 --> 00:14:13.010 align:middle line:84%
So we can also show info
to get an idea of what

00:14:13.010 --> 00:14:13.990 align:middle line:90%
this module does.

00:14:13.990 --> 00:14:16.670 align:middle line:84%
So you can see that this
module exploits a stack buffer

00:14:16.670 --> 00:14:17.510 align:middle line:90%
overflow.

00:14:17.510 --> 00:14:21.080 align:middle line:84%
And the PassThru functionality
in the external DLL file

00:14:21.080 --> 00:14:25.190 align:middle line:84%
in BadBlue version
2.72b and earlier.

00:14:25.190 --> 00:14:28.250 align:middle line:84%
All right, so if
we type in exploit,

00:14:28.250 --> 00:14:30.620 align:middle line:84%
this will provide us with
access to the target system

00:14:30.620 --> 00:14:32.330 align:middle line:90%
as you can see here.

00:14:32.330 --> 00:14:36.560 align:middle line:84%
So it sends the stage, and it
gives us a Meterpreter session.

00:14:36.560 --> 00:14:40.130 align:middle line:84%
So if we say sysinfo, we can
see that the target operating

00:14:40.130 --> 00:14:45.690 align:middle line:84%
system is Windows Server 2016
and the architecture is 64-bit.

00:14:45.690 --> 00:14:48.830 align:middle line:84%
OK, so let's migrate
to Explorer.exe.

00:14:48.830 --> 00:14:52.530 align:middle line:84%
But before we do that, let's
check out our user privileges.

00:14:52.530 --> 00:14:53.540 align:middle line:90%
So get user ID.

00:14:53.540 --> 00:14:55.520 align:middle line:84%
We currently have access
to the target system

00:14:55.520 --> 00:14:57.180 align:middle line:90%
as the administrator user.

00:14:57.180 --> 00:15:01.530 align:middle line:84%
So we'll say pgrep
Explorer, and we'll migrate

00:15:01.530 --> 00:15:07.825 align:middle line:90%
to that process ID-- so 4032.

00:15:07.825 --> 00:15:09.608 align:middle line:84%
And we'll give this
a couple of seconds.

00:15:09.608 --> 00:15:10.150 align:middle line:90%
There we are.

00:15:10.150 --> 00:15:13.880 align:middle line:84%
If I say sysinfo, this should
be a 64-bit Meterpreter session.

00:15:13.880 --> 00:15:16.430 align:middle line:84%
All right, so let's take a look
at the first recommendation

00:15:16.430 --> 00:15:18.540 align:middle line:90%
that I made within the slides.

00:15:18.540 --> 00:15:22.700 align:middle line:84%
And that is pertinent to where
you transfer or store files

00:15:22.700 --> 00:15:23.720 align:middle line:90%
on the target system.

00:15:23.720 --> 00:15:25.670 align:middle line:84%
As I said, it's
always recommended

00:15:25.670 --> 00:15:29.520 align:middle line:84%
to store them within the
actual temp directory.

00:15:29.520 --> 00:15:31.550 align:middle line:84%
So if I say LS, you
can see that this

00:15:31.550 --> 00:15:33.890 align:middle line:90%
is the root of the C drive.

00:15:33.890 --> 00:15:37.040 align:middle line:84%
The temp directory is typically
stored in the root of the C

00:15:37.040 --> 00:15:38.300 align:middle line:90%
drive on Windows.

00:15:38.300 --> 00:15:41.130 align:middle line:84%
And you can create it
if it doesn't exist.

00:15:41.130 --> 00:15:44.270 align:middle line:84%
So I can say, make
directory temp.

00:15:44.270 --> 00:15:46.500 align:middle line:84%
And if I navigate into
the temp directory,

00:15:46.500 --> 00:15:48.890 align:middle line:84%
this is where you should
be storing all your files.

00:15:48.890 --> 00:15:53.810 align:middle line:84%
And so if you want to transfer
or upload a local enumeration

00:15:53.810 --> 00:15:55.970 align:middle line:84%
script, this is where
you should upload it to.

00:15:55.970 --> 00:16:00.770 align:middle line:84%
If you uploading a binary like
WinPEs or an exploit binary,

00:16:00.770 --> 00:16:03.080 align:middle line:84%
a privilege escalation
exploit, upload them

00:16:03.080 --> 00:16:06.230 align:middle line:84%
to the temp directory so
that you know that everything

00:16:06.230 --> 00:16:09.980 align:middle line:90%
is in one centralized location.

00:16:09.980 --> 00:16:12.560 align:middle line:90%
So for example, I can say--

00:16:12.560 --> 00:16:15.020 align:middle line:84%
if I wanted to
upload a file, so I

00:16:15.020 --> 00:16:19.880 align:middle line:84%
can say Upload share user
share Windows binaries,

00:16:19.880 --> 00:16:22.050 align:middle line:84%
and let's find an example
that we can use here.

00:16:22.050 --> 00:16:24.890 align:middle line:84%
Let's say we wanted
to upload Netcat.exe,

00:16:24.890 --> 00:16:26.660 align:middle line:84%
I'll upload it to
this directory.

00:16:26.660 --> 00:16:29.240 align:middle line:84%
And when I'm done
with the pen test,

00:16:29.240 --> 00:16:31.130 align:middle line:84%
I can just navigate
to the temp directory

00:16:31.130 --> 00:16:33.270 align:middle line:84%
and get rid of all the
files that I transferred.

00:16:33.270 --> 00:16:37.220 align:middle line:84%
So remove Netcat.exe
and that is done.

00:16:37.220 --> 00:16:40.490 align:middle line:84%
All right, so that's the
first recommendation.

00:16:40.490 --> 00:16:43.970 align:middle line:84%
The next recommendation ties
in to the Metasploit framework

00:16:43.970 --> 00:16:47.480 align:middle line:84%
exploitation and
postexploitation modules.

00:16:47.480 --> 00:16:51.500 align:middle line:84%
So during the Windows
persistence section,

00:16:51.500 --> 00:16:54.800 align:middle line:84%
we utilized a couple
of persistence modules

00:16:54.800 --> 00:16:57.590 align:middle line:84%
that generated a lot
of artifacts, right?

00:16:57.590 --> 00:17:01.550 align:middle line:84%
So an example of this
would be a module that--

00:17:01.550 --> 00:17:04.550 align:middle line:84%
the actual persistence
service module

00:17:04.550 --> 00:17:07.609 align:middle line:84%
that generated a
persistent service.

00:17:07.609 --> 00:17:10.550 align:middle line:84%
And I'll just put this in the
background and showcase how

00:17:10.550 --> 00:17:11.609 align:middle line:90%
that would work.

00:17:11.609 --> 00:17:15.980 align:middle line:84%
So I'll say search
and persistence,

00:17:15.980 --> 00:17:19.890 align:middle line:90%
and I'll say platform Windows.

00:17:19.890 --> 00:17:22.185 align:middle line:90%
And this is the module here.

00:17:22.185 --> 00:17:23.310 align:middle line:90%
Let's see if I can find it.

00:17:23.310 --> 00:17:25.349 align:middle line:84%
There we are--
persistent service.

00:17:25.349 --> 00:17:27.960 align:middle line:90%
So I'll use module two.

00:17:27.960 --> 00:17:29.880 align:middle line:84%
And this is a
postexploitation module,

00:17:29.880 --> 00:17:31.590 align:middle line:90%
so I can say show options.

00:17:31.590 --> 00:17:34.350 align:middle line:84%
And I'll just change the
L port to a different one

00:17:34.350 --> 00:17:37.230 align:middle line:90%
because port 4444 is running.

00:17:37.230 --> 00:17:40.140 align:middle line:90%
So I can set that to 4433.

00:17:40.140 --> 00:17:41.200 align:middle line:90%
There we are.

00:17:41.200 --> 00:17:43.720 align:middle line:84%
And we can then
set the session ID.

00:17:43.720 --> 00:17:46.230 align:middle line:90%
So I'll say set session one.

00:17:46.230 --> 00:17:50.355 align:middle line:84%
Now, this module
is a good example

00:17:50.355 --> 00:17:54.420 align:middle line:84%
of when you need to actually
delete or get rid or clear

00:17:54.420 --> 00:17:58.620 align:middle line:84%
your tracks because this is a
postexploitation module that

00:17:58.620 --> 00:18:01.320 align:middle line:84%
will, again, generate
an executable,

00:18:01.320 --> 00:18:03.600 align:middle line:84%
transfer it over to
the target system,

00:18:03.600 --> 00:18:05.310 align:middle line:90%
and then create a service--

00:18:05.310 --> 00:18:06.850 align:middle line:90%
a persistent service.

00:18:06.850 --> 00:18:09.782 align:middle line:84%
So if I say show
info, you can see

00:18:09.782 --> 00:18:11.490 align:middle line:84%
that this module will
generate and upload

00:18:11.490 --> 00:18:13.800 align:middle line:90%
an executable to a remote host.

00:18:13.800 --> 00:18:17.070 align:middle line:84%
Next, it will then make
it a persistent service.

00:18:17.070 --> 00:18:19.080 align:middle line:84%
It'll create a
new service, which

00:18:19.080 --> 00:18:21.810 align:middle line:84%
will start the payload whenever
the service is running.

00:18:21.810 --> 00:18:23.610 align:middle line:84%
So again, persistence
is something

00:18:23.610 --> 00:18:25.240 align:middle line:90%
that is very important.

00:18:25.240 --> 00:18:29.040 align:middle line:84%
However, it leaves a lot of
artifacts on the target system.

00:18:29.040 --> 00:18:31.380 align:middle line:84%
And as part of the
rules of engagement,

00:18:31.380 --> 00:18:32.880 align:middle line:84%
when you're done
with a pen test,

00:18:32.880 --> 00:18:34.620 align:middle line:84%
you need to get
rid of all of this.

00:18:34.620 --> 00:18:38.640 align:middle line:84%
You cannot have this running
on the system that you have

00:18:38.640 --> 00:18:40.560 align:middle line:84%
compromised because
if an attacker--

00:18:40.560 --> 00:18:42.570 align:middle line:84%
a real attacker
finds this running,

00:18:42.570 --> 00:18:44.590 align:middle line:84%
then they could
potentially exploit it.

00:18:44.590 --> 00:18:47.130 align:middle line:84%
And then, you will be
responsible for that company

00:18:47.130 --> 00:18:49.300 align:middle line:84%
or for your client
being exploited.

00:18:49.300 --> 00:18:51.330 align:middle line:84%
So never leave
anything that could

00:18:51.330 --> 00:18:56.140 align:middle line:84%
be useful for a real attacker or
adversary on the target system.

00:18:56.140 --> 00:18:57.510 align:middle line:90%
So we can run this.

00:18:57.510 --> 00:18:58.800 align:middle line:90%
I'll just say exploit.

00:18:58.800 --> 00:19:02.730 align:middle line:84%
And you'll see because this is a
well-developed postexploitation

00:19:02.730 --> 00:19:07.870 align:middle line:84%
module, it'll give you some
very, very important resources.

00:19:07.870 --> 00:19:10.140 align:middle line:84%
So you can see
that it'll, again,

00:19:10.140 --> 00:19:12.000 align:middle line:84%
run the module against
the target system.

00:19:12.000 --> 00:19:13.770 align:middle line:84%
The Meterpreter
service executable

00:19:13.770 --> 00:19:15.840 align:middle line:84%
is written to the
following directory.

00:19:15.840 --> 00:19:17.490 align:middle line:90%
So keep this in mind.

00:19:17.490 --> 00:19:19.320 align:middle line:90%
Always note this down.

00:19:19.320 --> 00:19:21.900 align:middle line:84%
In this case, it
stored the executable

00:19:21.900 --> 00:19:26.580 align:middle line:84%
under C Users administrator
appdata local temp,

00:19:26.580 --> 00:19:28.720 align:middle line:84%
and this is the name
of the executable.

00:19:28.720 --> 00:19:30.768 align:middle line:84%
So let's actually see
whether this is the case.

00:19:30.768 --> 00:19:33.060 align:middle line:84%
All right, so I'll navigate
to the root of the C drive.

00:19:33.060 --> 00:19:41.430 align:middle line:84%
I'll say CD users, CD
administrator, CD appdata,

00:19:41.430 --> 00:19:46.590 align:middle line:90%
CD local, CD temp.

00:19:46.590 --> 00:19:47.090 align:middle line:90%
And?

00:19:47.090 --> 00:19:49.290 align:middle line:84%
If we list all the files
within this directory,

00:19:49.290 --> 00:19:51.530 align:middle line:84%
you can see that that
is actually there.

00:19:51.530 --> 00:19:53.570 align:middle line:84%
And this tells you
where it's written,

00:19:53.570 --> 00:19:55.850 align:middle line:84%
so you can remove it
manually if you want to.

00:19:55.850 --> 00:19:58.730 align:middle line:84%
However, because this is
a well-developed module,

00:19:58.730 --> 00:20:02.690 align:middle line:84%
it will tell you that it's
generated a cleanup Meterpreter

00:20:02.690 --> 00:20:04.640 align:middle line:90%
resource script file.

00:20:04.640 --> 00:20:06.830 align:middle line:84%
A resource script,
as I've already

00:20:06.830 --> 00:20:09.320 align:middle line:84%
highlighted within the
Metasploit framework course,

00:20:09.320 --> 00:20:13.280 align:middle line:84%
is a script that is used
within the Metasploit framework

00:20:13.280 --> 00:20:16.730 align:middle line:84%
to automate a specific
task that you want

00:20:16.730 --> 00:20:18.890 align:middle line:90%
to perform with MSF console.

00:20:18.890 --> 00:20:21.830 align:middle line:84%
In this case, this
resource script--

00:20:21.830 --> 00:20:24.590 align:middle line:84%
if we can actually copy
the path to it here--

00:20:24.590 --> 00:20:27.020 align:middle line:84%
and that's very important,
so also note that down.

00:20:27.020 --> 00:20:28.550 align:middle line:84%
I'm just going to
open up a new tab,

00:20:28.550 --> 00:20:31.430 align:middle line:84%
and I'll cut the content
of that resource script.

00:20:31.430 --> 00:20:34.490 align:middle line:84%
You can see that when we
run it on the target system,

00:20:34.490 --> 00:20:37.490 align:middle line:84%
it will stop that service
that was generated--

00:20:37.490 --> 00:20:38.900 align:middle line:90%
the persistent service.

00:20:38.900 --> 00:20:40.970 align:middle line:90%
It will then delete the service.

00:20:40.970 --> 00:20:45.020 align:middle line:84%
It will then utilize
taskkill.exe to essentially

00:20:45.020 --> 00:20:46.730 align:middle line:90%
kill that particular process.

00:20:46.730 --> 00:20:50.420 align:middle line:84%
And it has the relative string
or the name of the process

00:20:50.420 --> 00:20:52.010 align:middle line:90%
or service for that matter.

00:20:52.010 --> 00:20:55.370 align:middle line:84%
And then, it will also delete
that particular executable

00:20:55.370 --> 00:20:58.110 align:middle line:84%
for you that was transferred
to the target system.

00:20:58.110 --> 00:21:00.350 align:middle line:84%
So this is extremely
useful because you

00:21:00.350 --> 00:21:03.200 align:middle line:84%
don't need to do it manually if
a resource script is generated

00:21:03.200 --> 00:21:03.930 align:middle line:90%
for you.

00:21:03.930 --> 00:21:07.490 align:middle line:84%
So the next question is, how do
I use this particular resource

00:21:07.490 --> 00:21:08.090 align:middle line:90%
script?

00:21:08.090 --> 00:21:10.670 align:middle line:84%
Well, firstly, you need
to use it or you need

00:21:10.670 --> 00:21:13.110 align:middle line:90%
to run it on the target system.

00:21:13.110 --> 00:21:17.540 align:middle line:84%
So this is the actual persistent
service Meterpreter session,

00:21:17.540 --> 00:21:20.120 align:middle line:90%
so I'll just exit from it.

00:21:20.120 --> 00:21:23.030 align:middle line:84%
And you can see we still
have session one running,

00:21:23.030 --> 00:21:24.830 align:middle line:90%
so I'll say sessions one.

00:21:24.830 --> 00:21:26.840 align:middle line:84%
And in order to run
a resource script,

00:21:26.840 --> 00:21:29.070 align:middle line:90%
you simply say resource.

00:21:29.070 --> 00:21:33.860 align:middle line:84%
Let me type that in correctly--
so resource if I can actually

00:21:33.860 --> 00:21:34.610 align:middle line:90%
type it correctly.

00:21:34.610 --> 00:21:37.430 align:middle line:84%
And then, you specify the
path to the resource script.

00:21:37.430 --> 00:21:41.510 align:middle line:84%
So I'll hit Enter, and you will
see that this will clear up

00:21:41.510 --> 00:21:42.780 align:middle line:90%
everything for you.

00:21:42.780 --> 00:21:46.460 align:middle line:84%
So firstly, it'll tell you
that it'll execute the-- it'll

00:21:46.460 --> 00:21:47.930 align:middle line:90%
actually stop the service.

00:21:47.930 --> 00:21:49.700 align:middle line:90%
It'll then delete the service.

00:21:49.700 --> 00:21:54.200 align:middle line:84%
It'll then kill that
particular process or service.

00:21:54.200 --> 00:21:56.570 align:middle line:84%
And in this case, it
tells us that the process

00:21:56.570 --> 00:22:00.590 align:middle line:84%
has been terminated and this
one as well as been terminated.

00:22:00.590 --> 00:22:01.850 align:middle line:90%
And then the file--

00:22:01.850 --> 00:22:03.710 align:middle line:84%
the executable that
was transferred,

00:22:03.710 --> 00:22:07.340 align:middle line:84%
that was stored under the
administrator user directory

00:22:07.340 --> 00:22:10.860 align:middle line:84%
under appdata local
temp has been deleted.

00:22:10.860 --> 00:22:12.710 align:middle line:84%
So we can actually
confirm this and see

00:22:12.710 --> 00:22:14.790 align:middle line:90%
whether this is the case.

00:22:14.790 --> 00:22:17.730 align:middle line:84%
So I've navigated to that
particular directory.

00:22:17.730 --> 00:22:19.980 align:middle line:84%
And you can see that
file has been deleted.

00:22:19.980 --> 00:22:20.990 align:middle line:90%
So that's fantastic.

00:22:20.990 --> 00:22:23.090 align:middle line:84%
All the artifacts
that were generated

00:22:23.090 --> 00:22:25.910 align:middle line:84%
and the services that were
created have all been deleted.

00:22:25.910 --> 00:22:28.790 align:middle line:84%
And this is something
that is very, very, very

00:22:28.790 --> 00:22:32.250 align:middle line:84%
important, especially during
a real penetration test.

00:22:32.250 --> 00:22:38.240 align:middle line:84%
So again, this was one example
of how to closely identify

00:22:38.240 --> 00:22:40.700 align:middle line:84%
the actual output
or artifacts that

00:22:40.700 --> 00:22:43.580 align:middle line:84%
are generated by a
Metasploit framework module,

00:22:43.580 --> 00:22:47.210 align:middle line:84%
whether it be an exploitation
module or postexploitation

00:22:47.210 --> 00:22:47.900 align:middle line:90%
module.

00:22:47.900 --> 00:22:50.390 align:middle line:84%
And in the event that it
provides you with a resource

00:22:50.390 --> 00:22:54.630 align:middle line:84%
script, that's how to use it--
a cleanup resource script--

00:22:54.630 --> 00:22:55.280 align:middle line:90%
how to use it.

00:22:55.280 --> 00:22:58.820 align:middle line:84%
And in this case, we have been
able to confirm that we have

00:22:58.820 --> 00:23:01.460 align:middle line:90%
essentially undone what we did.

00:23:01.460 --> 00:23:04.850 align:middle line:84%
And in this case, we got rid
of the persistent service.

00:23:04.850 --> 00:23:06.770 align:middle line:84%
All right, now, the
final recommendation

00:23:06.770 --> 00:23:09.590 align:middle line:84%
that I made within the
slides was, of course,

00:23:09.590 --> 00:23:12.320 align:middle line:84%
pertinent to clearing
the Windows event logs.

00:23:12.320 --> 00:23:15.110 align:middle line:84%
Now, Meterpreter has
an in-built command

00:23:15.110 --> 00:23:17.540 align:middle line:84%
that will clear the
entire Windows Event

00:23:17.540 --> 00:23:18.440 align:middle line:90%
log on the target.

00:23:18.440 --> 00:23:20.060 align:middle line:90%
It's called clear EV.

00:23:20.060 --> 00:23:22.940 align:middle line:84%
As I said, this is something
that I recommend you stay away

00:23:22.940 --> 00:23:27.140 align:middle line:84%
from until you know what you're
doing because if I hit Enter,

00:23:27.140 --> 00:23:29.840 align:middle line:84%
this is going to clear
the entire Windows Event

00:23:29.840 --> 00:23:31.162 align:middle line:90%
log on the target system.

00:23:31.162 --> 00:23:32.370 align:middle line:90%
So let me just show you this.

00:23:32.370 --> 00:23:35.180 align:middle line:84%
This is for the sake
of demonstration.

00:23:35.180 --> 00:23:36.673 align:middle line:90%
I'll hit Enter.

00:23:36.673 --> 00:23:38.090 align:middle line:84%
And you can see
it's going to wipe

00:23:38.090 --> 00:23:42.830 align:middle line:84%
165 records from the
application logs,

00:23:42.830 --> 00:23:45.680 align:middle line:84%
764 records from
the system logs,

00:23:45.680 --> 00:23:51.840 align:middle line:84%
and 2,558 records from
the security logs.

00:23:51.840 --> 00:23:54.030 align:middle line:84%
Now, this is something
that is really not

00:23:54.030 --> 00:23:56.880 align:middle line:84%
useful for the client
because, again,

00:23:56.880 --> 00:23:59.460 align:middle line:84%
as I said, unless you're
performing adversary

00:23:59.460 --> 00:24:01.650 align:middle line:84%
emulation-- which is part
of Red teaming-- then,

00:24:01.650 --> 00:24:04.708 align:middle line:84%
if you're performing
a standard pen test,

00:24:04.708 --> 00:24:06.000 align:middle line:90%
then you don't need to do this.

00:24:06.000 --> 00:24:09.810 align:middle line:84%
You can simply highlight that
an attacker within your pen test

00:24:09.810 --> 00:24:12.840 align:middle line:84%
report, you can highlight that
an attacker could potentially

00:24:12.840 --> 00:24:13.590 align:middle line:90%
do this.

00:24:13.590 --> 00:24:17.530 align:middle line:84%
And that's something that the
client needs to be aware of.

00:24:17.530 --> 00:24:19.890 align:middle line:84%
So, yeah, that's really
all that I wanted to cover.

00:24:19.890 --> 00:24:24.060 align:middle line:84%
As I said, most of this
section or this phase

00:24:24.060 --> 00:24:28.080 align:middle line:84%
of postexploitation will
tie into your understanding

00:24:28.080 --> 00:24:30.000 align:middle line:90%
of what you're able to do.

00:24:30.000 --> 00:24:32.482 align:middle line:84%
And that, of course,
needs to be in accordance

00:24:32.482 --> 00:24:33.690 align:middle line:90%
with the rules of engagement.

00:24:33.690 --> 00:24:35.970 align:middle line:84%
And furthermore,
keep track and keep

00:24:35.970 --> 00:24:38.520 align:middle line:84%
a note of where you're
transferring files to.

00:24:38.520 --> 00:24:41.850 align:middle line:84%
Understand that the Metasploit
framework modules also

00:24:41.850 --> 00:24:44.700 align:middle line:84%
generate files and
artifacts, and they need

00:24:44.700 --> 00:24:46.380 align:middle line:90%
to be deleted once you're done.

00:24:46.380 --> 00:24:49.050 align:middle line:84%
Do keep a note of what
modules you're using.

00:24:49.050 --> 00:24:53.130 align:middle line:84%
And of course, be very
cognizant of the fact that you

00:24:53.130 --> 00:24:56.610 align:middle line:84%
can potentially damage
a system by interacting

00:24:56.610 --> 00:24:59.190 align:middle line:84%
with specific, in
the case of Windows,

00:24:59.190 --> 00:25:02.190 align:middle line:84%
specific Windows features
like the registry,

00:25:02.190 --> 00:25:03.210 align:middle line:90%
et cetera, et cetera.

00:25:03.210 --> 00:25:08.340 align:middle line:84%
And of course, never be in a
position where you need to--

00:25:08.340 --> 00:25:12.030 align:middle line:84%
you run an exploit that could
potentially cause the system

00:25:12.030 --> 00:25:14.490 align:middle line:84%
to shut down or to
cause the kernel

00:25:14.490 --> 00:25:16.950 align:middle line:90%
to go into a kernel panic.

00:25:16.950 --> 00:25:19.690 align:middle line:84%
Primarily because that
could lead to data loss.

00:25:19.690 --> 00:25:22.620 align:middle line:84%
So that is going to conclude
the practical demonstration

00:25:22.620 --> 00:25:25.160 align:middle line:90%
side of this video.

00:25:25.160 --> 00:25:26.710 align:middle line:84%
All right, now
that we've explored

00:25:26.710 --> 00:25:29.770 align:middle line:84%
the process of clearing your
tracks on a Windows system,

00:25:29.770 --> 00:25:33.280 align:middle line:84%
we can now move on to how to
clear your tracks on a Linux

00:25:33.280 --> 00:25:33.830 align:middle line:90%
system.

00:25:33.830 --> 00:25:37.500 align:middle line:84%
So I'll be seeing you
in the next video.

00:25:37.500 --> 00:25:38.000 align:middle line:90%