WEBVTT

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


00:00:10.180 --> 00:00:13.840 align:middle line:84%
Enumerating processes
and services on Windows.

00:00:13.840 --> 00:00:15.370 align:middle line:84%
In this video,
we'll be exploring

00:00:15.370 --> 00:00:18.940 align:middle line:84%
the process of how to enumerate
a list of running processes

00:00:18.940 --> 00:00:22.850 align:middle line:84%
and services on a Windows system
that you have just compromised.

00:00:22.850 --> 00:00:25.070 align:middle line:84%
So you might be asking
yourself the question,

00:00:25.070 --> 00:00:26.200 align:middle line:90%
why is this important?

00:00:26.200 --> 00:00:30.010 align:middle line:84%
I can understand why enumerating
users and groups is important.

00:00:30.010 --> 00:00:32.860 align:middle line:84%
I can understand why
enumerating network information

00:00:32.860 --> 00:00:33.460 align:middle line:90%
is important.

00:00:33.460 --> 00:00:35.590 align:middle line:90%
But why processes and services?

00:00:35.590 --> 00:00:38.830 align:middle line:84%
Well, like the previous
steps, you know that fall

00:00:38.830 --> 00:00:40.480 align:middle line:90%
under local enumeration.

00:00:40.480 --> 00:00:43.480 align:middle line:84%
It's always important to
learn more about the system

00:00:43.480 --> 00:00:47.110 align:middle line:84%
that you've just exploited,
like what processes, services,

00:00:47.110 --> 00:00:48.850 align:middle line:84%
and schedule tasks
are currently running.

00:00:48.850 --> 00:00:50.810 align:middle line:90%
But why is it important?

00:00:50.810 --> 00:00:53.420 align:middle line:84%
Well, it's important
for a few reasons.

00:00:53.420 --> 00:00:55.840 align:middle line:84%
In the case of
running processes,

00:00:55.840 --> 00:00:59.320 align:middle line:84%
the reason why we ought to
enumerate a list of running

00:00:59.320 --> 00:01:01.870 align:middle line:84%
processes is, in
the event that we

00:01:01.870 --> 00:01:04.819 align:middle line:84%
want to actually migrate
our current process

00:01:04.819 --> 00:01:06.060 align:middle line:90%
to another process.

00:01:06.060 --> 00:01:08.470 align:middle line:84%
So an example of this
would be, if we have access

00:01:08.470 --> 00:01:11.230 align:middle line:84%
to a Windows target via
an Meterpreter session,

00:01:11.230 --> 00:01:14.290 align:middle line:84%
and the current process
that we're working on

00:01:14.290 --> 00:01:17.050 align:middle line:84%
or that we're working
with on the target system

00:01:17.050 --> 00:01:19.360 align:middle line:84%
is unstable and
is having issues,

00:01:19.360 --> 00:01:23.860 align:middle line:84%
we can migrate to a more stable
process like exploree.exe.

00:01:23.860 --> 00:01:25.630 align:middle line:84%
And in order to do
this, we actually

00:01:25.630 --> 00:01:30.760 align:middle line:84%
need to identify explorer.exe
and as well as its process ID.

00:01:30.760 --> 00:01:33.080 align:middle line:84%
And of course, that's
just one example.

00:01:33.080 --> 00:01:37.360 align:middle line:84%
Another example comes into
play when we're exploring

00:01:37.360 --> 00:01:41.110 align:middle line:84%
or when we will be taking a
look at the privilege escalation

00:01:41.110 --> 00:01:44.740 align:middle line:84%
stage of the post exploitation
phase of a penetration test,

00:01:44.740 --> 00:01:47.110 align:middle line:84%
and that's where
scheduled tasks--

00:01:47.110 --> 00:01:50.020 align:middle line:84%
this is where scheduled
tasks come into play, right?

00:01:50.020 --> 00:01:53.260 align:middle line:84%
So the reason we want to
enumerate a list of scheduled

00:01:53.260 --> 00:01:55.810 align:middle line:84%
tasks running on the
system is primarily

00:01:55.810 --> 00:01:58.580 align:middle line:84%
because during the
privilege escalation phase,

00:01:58.580 --> 00:02:02.530 align:middle line:84%
we will be trying to identify
weaknesses or misconfigurations

00:02:02.530 --> 00:02:04.660 align:middle line:84%
within each of these
scheduled tasks

00:02:04.660 --> 00:02:06.640 align:middle line:84%
that we can take
advantage of in order

00:02:06.640 --> 00:02:08.330 align:middle line:90%
to elevate our privileges.

00:02:08.330 --> 00:02:11.080 align:middle line:84%
So again, this information is
very, very important, right?

00:02:11.080 --> 00:02:13.130 align:middle line:84%
So in terms of what
we're looking for,

00:02:13.130 --> 00:02:16.120 align:middle line:84%
we are trying to identify the
running processes and services

00:02:16.120 --> 00:02:20.030 align:middle line:90%
as well as the scheduled tasks.

00:02:20.030 --> 00:02:22.360 align:middle line:84%
Now, if you have
never used Windows

00:02:22.360 --> 00:02:25.210 align:middle line:84%
before or if you have a basic
understanding of how Windows

00:02:25.210 --> 00:02:27.460 align:middle line:84%
works, you might be
a little bit confused

00:02:27.460 --> 00:02:30.790 align:middle line:84%
as to what a process is and
what a service is, right?

00:02:30.790 --> 00:02:32.890 align:middle line:84%
So a process is
essentially an instance

00:02:32.890 --> 00:02:36.950 align:middle line:84%
of a running executable, also
known as an exe or program,

00:02:36.950 --> 00:02:37.450 align:middle line:90%
right?

00:02:37.450 --> 00:02:40.450 align:middle line:84%
And a service is a process
which runs in the background

00:02:40.450 --> 00:02:42.520 align:middle line:84%
and does not interact
with the desktop.

00:02:42.520 --> 00:02:46.870 align:middle line:84%
So an example of a process is
when you launch Google Chrome.

00:02:46.870 --> 00:02:49.540 align:middle line:84%
So when you double-click
on Google Chrome.exe,

00:02:49.540 --> 00:02:50.620 align:middle line:90%
that's a process.

00:02:50.620 --> 00:02:54.790 align:middle line:84%
And that's primarily what we're
trying to identify firstly.

00:02:54.790 --> 00:02:56.830 align:middle line:84%
And then, in the
context of services,

00:02:56.830 --> 00:03:00.580 align:middle line:84%
these are really
programs or processes

00:03:00.580 --> 00:03:03.340 align:middle line:84%
that run in the
background and do not

00:03:03.340 --> 00:03:04.480 align:middle line:90%
interact with the desktop.

00:03:04.480 --> 00:03:08.260 align:middle line:84%
So they're not like end user
applications or third party

00:03:08.260 --> 00:03:10.360 align:middle line:84%
applications that
you typically find,

00:03:10.360 --> 00:03:14.210 align:middle line:84%
like Google Chrome, or VLC,
or Microsoft Word, et cetera.

00:03:14.210 --> 00:03:14.710 align:middle line:90%
All right.

00:03:14.710 --> 00:03:16.293 align:middle line:84%
And you'll actually
see the difference

00:03:16.293 --> 00:03:18.860 align:middle line:84%
as we move into the
practical demonstration.

00:03:18.860 --> 00:03:21.790 align:middle line:84%
So we are going to be utilizing
the same lab environment we've

00:03:21.790 --> 00:03:23.180 align:middle line:90%
used in this section.

00:03:23.180 --> 00:03:26.440 align:middle line:84%
And again, all you need
to do is just fire it up.

00:03:26.440 --> 00:03:30.170 align:middle line:84%
And this video has a lab
environment attached to it.

00:03:30.170 --> 00:03:33.670 align:middle line:84%
So we'll start off by gaining
access to the target system,

00:03:33.670 --> 00:03:35.470 align:middle line:84%
and we'll obtain a
Meterpreter session.

00:03:35.470 --> 00:03:37.780 align:middle line:84%
After which, we'll
begin exploring

00:03:37.780 --> 00:03:41.980 align:middle line:84%
how we can enumerate the list of
running processes and services

00:03:41.980 --> 00:03:45.140 align:middle line:84%
and why this information
is important.

00:03:45.140 --> 00:03:47.440 align:middle line:84%
So fire up the lab environment,
and I'll see you there

00:03:47.440 --> 00:03:48.400 align:middle line:90%
in a couple of seconds.

00:03:48.400 --> 00:03:51.410 align:middle line:90%


00:03:51.410 --> 00:03:53.720 align:middle line:84%
All right, so I'm back
within the lab environment.

00:03:53.720 --> 00:03:55.330 align:middle line:84%
And by default,
you'll be provided

00:03:55.330 --> 00:03:57.610 align:middle line:84%
with the target IP address,
which, in your case,

00:03:57.610 --> 00:03:58.490 align:middle line:90%
will be different.

00:03:58.490 --> 00:04:00.130 align:middle line:90%
All you need to do is copy it.

00:04:00.130 --> 00:04:02.860 align:middle line:84%
Now, given the fact that we know
the target system is running

00:04:02.860 --> 00:04:06.310 align:middle line:84%
a vulnerable version of the
Rejetto HTTP File Server,

00:04:06.310 --> 00:04:08.470 align:middle line:84%
we already know what
Metasploit exploit

00:04:08.470 --> 00:04:10.180 align:middle line:84%
module we can use
to gain access,

00:04:10.180 --> 00:04:12.220 align:middle line:84%
as we've explored this
in the previous videos

00:04:12.220 --> 00:04:13.460 align:middle line:90%
within this section.

00:04:13.460 --> 00:04:17.200 align:middle line:84%
So I'll open up a terminal,
and I'll open up MSF console.

00:04:17.200 --> 00:04:19.570 align:middle line:84%
And we can then search
for the Rejetto module,

00:04:19.570 --> 00:04:22.330 align:middle line:84%
and load it, and exploit
the target in order

00:04:22.330 --> 00:04:25.930 align:middle line:84%
to gain access or rather exploit
the vulnerability in order

00:04:25.930 --> 00:04:26.760 align:middle line:90%
to gain access.

00:04:26.760 --> 00:04:30.720 align:middle line:90%
So I'll say, search and rejetto.

00:04:30.720 --> 00:04:33.640 align:middle line:84%
I'll then say use and
specify the module ID,

00:04:33.640 --> 00:04:35.520 align:middle line:90%
which, in this case, is 0.

00:04:35.520 --> 00:04:37.400 align:middle line:90%
There we are.

00:04:37.400 --> 00:04:40.230 align:middle line:84%
And I specify the
target IP address.

00:04:40.230 --> 00:04:43.660 align:middle line:84%
So I'll say, set RHOSTS and
paste in the target IP address.

00:04:43.660 --> 00:04:45.910 align:middle line:84%
Of course, in your case,
that's going to be different.

00:04:45.910 --> 00:04:48.340 align:middle line:84%
Once that is done, we
can type in exploit,

00:04:48.340 --> 00:04:50.930 align:middle line:84%
and we should receive
a Meterpreter session.

00:04:50.930 --> 00:04:53.050 align:middle line:84%
So we'll give this
a couple of seconds.

00:04:53.050 --> 00:04:53.890 align:middle line:90%
There we are.

00:04:53.890 --> 00:04:55.480 align:middle line:90%
We get a Meterpreter session.

00:04:55.480 --> 00:04:57.430 align:middle line:84%
That's going to
begin the clean up.

00:04:57.430 --> 00:05:00.350 align:middle line:84%
And we should be able
to-- there we are.

00:05:00.350 --> 00:05:02.020 align:middle line:84%
So we get an
Meterpreter session.

00:05:02.020 --> 00:05:04.420 align:middle line:84%
Now, let's start
off by taking a look

00:05:04.420 --> 00:05:07.210 align:middle line:84%
at how we can enumerate a
list of running processes

00:05:07.210 --> 00:05:08.560 align:middle line:90%
with Meterpreter, right?

00:05:08.560 --> 00:05:10.750 align:middle line:84%
And then, we'll move on
to the manual commands

00:05:10.750 --> 00:05:13.160 align:middle line:84%
through a standard
command shell session.

00:05:13.160 --> 00:05:15.460 align:middle line:84%
So if you have access
to the Windows target

00:05:15.460 --> 00:05:19.480 align:middle line:84%
system via Meterpreter session,
you can type in the ps command.

00:05:19.480 --> 00:05:23.360 align:middle line:84%
So that will list out a list
of running processes, right?

00:05:23.360 --> 00:05:26.140 align:middle line:84%
And if we take a
look at the top here,

00:05:26.140 --> 00:05:29.590 align:middle line:84%
you can see that it'll tell you
that this is the process list.

00:05:29.590 --> 00:05:32.200 align:middle line:84%
And it'll then sort
the information

00:05:32.200 --> 00:05:33.610 align:middle line:90%
into various columns.

00:05:33.610 --> 00:05:35.320 align:middle line:90%
So you have your process ID.

00:05:35.320 --> 00:05:40.360 align:middle line:84%
You have your PPID, your Name,
Architecture, Session, User,

00:05:40.360 --> 00:05:41.290 align:middle line:90%
and Path.

00:05:41.290 --> 00:05:43.090 align:middle line:84%
The most important
of all are going

00:05:43.090 --> 00:05:45.700 align:middle line:90%
to be the actual process name.

00:05:45.700 --> 00:05:49.500 align:middle line:84%
You then have the process ID
of the a specific process.

00:05:49.500 --> 00:05:54.250 align:middle line:84%
So for example, if we are
trying to look for explorer.exe,

00:05:54.250 --> 00:05:59.530 align:middle line:84%
the process ID of
explorer.exe is 2176, right?

00:05:59.530 --> 00:06:01.510 align:middle line:84%
The architecture is
self-explanatory.

00:06:01.510 --> 00:06:04.570 align:middle line:84%
That is going to depend
on the actual architecture

00:06:04.570 --> 00:06:07.690 align:middle line:84%
of the version or rather the
architecture of Windows that's

00:06:07.690 --> 00:06:09.680 align:middle line:90%
running on the target system.

00:06:09.680 --> 00:06:12.070 align:middle line:84%
Now, one thing you need
to take into consideration

00:06:12.070 --> 00:06:16.780 align:middle line:84%
or that you actually need
to take a special note on

00:06:16.780 --> 00:06:18.250 align:middle line:90%
is the user column, right?

00:06:18.250 --> 00:06:20.530 align:middle line:84%
So this will display
the privileges

00:06:20.530 --> 00:06:23.620 align:middle line:84%
associated with a
particular process, right?

00:06:23.620 --> 00:06:28.510 align:middle line:84%
And in this case, you can see
that specific Windows processes

00:06:28.510 --> 00:06:31.430 align:middle line:84%
have NT AUTHORITY
system privileges.

00:06:31.430 --> 00:06:35.290 align:middle line:84%
Now, given the fact that we
have access to the target system

00:06:35.290 --> 00:06:37.450 align:middle line:84%
as the administrator
user, which, again,

00:06:37.450 --> 00:06:40.450 align:middle line:84%
is a privileged
user account, you

00:06:40.450 --> 00:06:42.550 align:middle line:84%
can see that when
we type in ps, it'll

00:06:42.550 --> 00:06:47.170 align:middle line:84%
display a list of all the
user privileges associated

00:06:47.170 --> 00:06:48.830 align:middle line:90%
with a particular process.

00:06:48.830 --> 00:06:51.820 align:middle line:84%
However, if we weren't
a privileged user,

00:06:51.820 --> 00:06:55.670 align:middle line:84%
and we typed in ps, we would
get the same information.

00:06:55.670 --> 00:07:00.220 align:middle line:84%
However, under the user column,
wherever the actual privileges

00:07:00.220 --> 00:07:04.720 align:middle line:84%
were displayed, in the case of
NT AUTHORITY system privileges,

00:07:04.720 --> 00:07:06.190 align:middle line:90%
that would not be displayed.

00:07:06.190 --> 00:07:09.250 align:middle line:84%
It would only display
the actual user

00:07:09.250 --> 00:07:13.290 align:middle line:84%
information pertinent to the
current user you have access

00:07:13.290 --> 00:07:13.790 align:middle line:90%
to.

00:07:13.790 --> 00:07:17.590 align:middle line:84%
So for example, if I gained
access to the target system

00:07:17.590 --> 00:07:20.800 align:middle line:84%
through a user called
Bob, and I typed in ps,

00:07:20.800 --> 00:07:22.540 align:middle line:84%
and Bob was not a
privileged user,

00:07:22.540 --> 00:07:25.090 align:middle line:84%
it would still display all
the processes as well as

00:07:25.090 --> 00:07:26.440 align:middle line:90%
the process IDs.

00:07:26.440 --> 00:07:29.680 align:middle line:84%
However, under the
actual user column,

00:07:29.680 --> 00:07:33.190 align:middle line:84%
it would not display all the
NT AUTHORITY system privileges.

00:07:33.190 --> 00:07:37.390 align:middle line:84%
It would only display privileges
associated with the user Bob,

00:07:37.390 --> 00:07:38.885 align:middle line:90%
right?

00:07:38.885 --> 00:07:40.760 align:middle line:84%
And the other column
right over here is path.

00:07:40.760 --> 00:07:43.830 align:middle line:84%
So that'll give you the path
to the executable itself.

00:07:43.830 --> 00:07:48.590 align:middle line:84%
So you can see that the
svchost.exe process is derived

00:07:48.590 --> 00:07:50.210 align:middle line:90%
from the following executable.

00:07:50.210 --> 00:07:55.130 align:middle line:84%
So that's on the C Windows
System32 svchost.exe.

00:07:55.130 --> 00:07:57.890 align:middle line:84%
Now, coming to the
example that I mentioned

00:07:57.890 --> 00:08:01.760 align:middle line:84%
during the slides, and that
was how we can essentially

00:08:01.760 --> 00:08:02.940 align:middle line:90%
migrate our process.

00:08:02.940 --> 00:08:05.060 align:middle line:84%
So let's say we wanted
to migrate our process

00:08:05.060 --> 00:08:06.620 align:middle line:90%
to explorer.exe.

00:08:06.620 --> 00:08:08.300 align:middle line:84%
Well, we could
use the ps command

00:08:08.300 --> 00:08:11.720 align:middle line:84%
to list out the list
of running processes,

00:08:11.720 --> 00:08:14.420 align:middle line:84%
and then identify the
explorer.exe process

00:08:14.420 --> 00:08:15.740 align:middle line:90%
as we did here.

00:08:15.740 --> 00:08:17.840 align:middle line:84%
And then, take a look
at the process ID.

00:08:17.840 --> 00:08:20.540 align:middle line:84%
And then, we can
essentially type in migrate,

00:08:20.540 --> 00:08:23.000 align:middle line:84%
specify the process
ID, et cetera.

00:08:23.000 --> 00:08:25.880 align:middle line:84%
However, you actually
do not need to list out

00:08:25.880 --> 00:08:27.860 align:middle line:90%
the actual list of processes.

00:08:27.860 --> 00:08:31.910 align:middle line:84%
You can utilize
the pgrep utility

00:08:31.910 --> 00:08:34.320 align:middle line:84%
to search for a
particular process name.

00:08:34.320 --> 00:08:36.380 align:middle line:84%
So I can say, for
example, I want

00:08:36.380 --> 00:08:40.102 align:middle line:90%
the process ID of explorer.exe.

00:08:40.102 --> 00:08:42.100 align:middle line:84%
I can hit Enter,
and you can see it

00:08:42.100 --> 00:08:47.050 align:middle line:84%
will tell me that the process
ID for explorer.exe is 2176.

00:08:47.050 --> 00:08:50.170 align:middle line:84%
So whenever you are trying to
obtain a stable Meterpreter

00:08:50.170 --> 00:08:53.290 align:middle line:84%
session, it's always recommended
to migrate to explorer.exe,

00:08:53.290 --> 00:08:57.880 align:middle line:84%
primarily because
explorer.exe is rarely stopped

00:08:57.880 --> 00:09:01.090 align:middle line:84%
or rarely has any issues
in terms of stability

00:09:01.090 --> 00:09:04.690 align:middle line:84%
as it is required in order for
the Windows operating system

00:09:04.690 --> 00:09:05.660 align:middle line:90%
to function.

00:09:05.660 --> 00:09:09.070 align:middle line:84%
So we can migrate to a
specific process or process

00:09:09.070 --> 00:09:11.560 align:middle line:84%
ID for that matter,
by typing in migrate,

00:09:11.560 --> 00:09:13.490 align:middle line:84%
and then specifying
the process ID.

00:09:13.490 --> 00:09:15.130 align:middle line:84%
So I can say
migrate to Explorer,

00:09:15.130 --> 00:09:18.820 align:middle line:84%
and I specify the actual
process ID of explorer.exe,

00:09:18.820 --> 00:09:22.480 align:middle line:90%
which, in this case, is 2176.

00:09:22.480 --> 00:09:24.370 align:middle line:84%
I'll hit Enter,
and that is going

00:09:24.370 --> 00:09:26.740 align:middle line:84%
to migrate to that
particular process,

00:09:26.740 --> 00:09:29.660 align:middle line:84%
and the migration is
completed successfully.

00:09:29.660 --> 00:09:33.040 align:middle line:84%
And if you remember,
we actually did not

00:09:33.040 --> 00:09:35.410 align:middle line:84%
type in the getuseid
command, but we

00:09:35.410 --> 00:09:39.160 align:middle line:84%
had obtained a 32-bit
Meterpreter session, right?

00:09:39.160 --> 00:09:42.550 align:middle line:84%
If we take a look at our
current Meterpreter session now,

00:09:42.550 --> 00:09:44.980 align:middle line:84%
and I can say
sysinfo, you can see

00:09:44.980 --> 00:09:48.370 align:middle line:84%
that if we migrate
to a 64-bit process,

00:09:48.370 --> 00:09:51.130 align:middle line:84%
we are going to obtain
the architecture

00:09:51.130 --> 00:09:54.610 align:middle line:84%
specific to the process
that we migrated to.

00:09:54.610 --> 00:09:57.980 align:middle line:84%
So explorer.exe was
a 64-bit process.

00:09:57.980 --> 00:10:01.750 align:middle line:84%
And when we migrated to it, we
obtained a 64-bit Meterpreter

00:10:01.750 --> 00:10:02.630 align:middle line:90%
session.

00:10:02.630 --> 00:10:05.500 align:middle line:84%
So again, that's a very,
very important information.

00:10:05.500 --> 00:10:10.720 align:middle line:84%
And of course, we can utilize
the pgrep utility, but not

00:10:10.720 --> 00:10:15.190 align:middle line:84%
really just a limited to
migrating to a process.

00:10:15.190 --> 00:10:17.530 align:middle line:84%
If we were trying to find
a particular process,

00:10:17.530 --> 00:10:22.240 align:middle line:84%
like, for example, the HTTP File
Server process, I can say pgrep

00:10:22.240 --> 00:10:24.650 align:middle line:84%
and then hfs to see
if it's running.

00:10:24.650 --> 00:10:27.100 align:middle line:90%
So I can say hfs.exe.

00:10:27.100 --> 00:10:29.450 align:middle line:84%
And if it is running, it'll
tell me the process ID.

00:10:29.450 --> 00:10:32.890 align:middle line:84%
So this is a good way of
identifying a specific process

00:10:32.890 --> 00:10:35.145 align:middle line:84%
that you're interested
in, and this will tell you

00:10:35.145 --> 00:10:36.020 align:middle line:90%
whether it's running.

00:10:36.020 --> 00:10:40.900 align:middle line:84%
So for example, if I
said pgrep and aws.exe,

00:10:40.900 --> 00:10:44.590 align:middle line:84%
you can see that if it doesn't
display a process a ID, that

00:10:44.590 --> 00:10:47.300 align:middle line:90%
means that it's not running.

00:10:47.300 --> 00:10:49.910 align:middle line:84%
All right, so now that
we've explored this

00:10:49.910 --> 00:10:52.880 align:middle line:84%
or we've explored the process
of enumerating processes

00:10:52.880 --> 00:10:55.550 align:middle line:84%
with Meterpreter,
let's take a look

00:10:55.550 --> 00:10:58.850 align:middle line:84%
at how to enumerate
processes and services

00:10:58.850 --> 00:11:00.530 align:middle line:84%
with a standard
command shell, right?

00:11:00.530 --> 00:11:03.710 align:middle line:84%
Because in most
cases, you will not

00:11:03.710 --> 00:11:07.320 align:middle line:84%
have access to a Meterpreter
session right out of the box.

00:11:07.320 --> 00:11:09.890 align:middle line:84%
So I'll open up a command
shell session here.

00:11:09.890 --> 00:11:13.640 align:middle line:84%
And to get started,
we can list or obtain

00:11:13.640 --> 00:11:18.500 align:middle line:84%
a list of started services
by saying net start,

00:11:18.500 --> 00:11:19.910 align:middle line:90%
and I'll hit Enter.

00:11:19.910 --> 00:11:21.440 align:middle line:84%
And if we take a
look at the top,

00:11:21.440 --> 00:11:23.440 align:middle line:84%
you can see it's going
to tell you these Windows

00:11:23.440 --> 00:11:24.450 align:middle line:90%
Services are started.

00:11:24.450 --> 00:11:28.730 align:middle line:84%
So remember, these are
services, not processes.

00:11:28.730 --> 00:11:34.190 align:middle line:84%
So again, if we remember what
we explored in the slides,

00:11:34.190 --> 00:11:37.820 align:middle line:84%
I mentioned that a service
runs in the background, right?

00:11:37.820 --> 00:11:40.430 align:middle line:84%
And if you go through
this list, you

00:11:40.430 --> 00:11:42.590 align:middle line:84%
can see that we'll
not find processes

00:11:42.590 --> 00:11:45.990 align:middle line:90%
like hfs.exe, et cetera.

00:11:45.990 --> 00:11:48.800 align:middle line:84%
So these are all the background
services that are running.

00:11:48.800 --> 00:11:50.690 align:middle line:84%
And of course, it
makes sense to have

00:11:50.690 --> 00:11:52.070 align:middle line:90%
them running in the background.

00:11:52.070 --> 00:11:55.530 align:middle line:84%
We have DHCP client,
the Amazon SSM agent,

00:11:55.530 --> 00:11:57.980 align:middle line:90%
et cetera, et cetera.

00:11:57.980 --> 00:12:04.250 align:middle line:84%
All right, so if we wanted to
list out the services utilizing

00:12:04.250 --> 00:12:06.950 align:middle line:84%
another utility, like
WMIC, we could also

00:12:06.950 --> 00:12:11.030 align:middle line:84%
do that by saying
wmic, and then service.

00:12:11.030 --> 00:12:13.050 align:middle line:90%
And we can then say, list.

00:12:13.050 --> 00:12:15.620 align:middle line:84%
So at wmic service
list, and then

00:12:15.620 --> 00:12:17.570 align:middle line:90%
we can keep the output brief.

00:12:17.570 --> 00:12:21.410 align:middle line:84%
So we can do that by saying
wmic service list brief.

00:12:21.410 --> 00:12:22.490 align:middle line:90%
Hit Enter.

00:12:22.490 --> 00:12:24.200 align:middle line:84%
We'll give this a
couple of seconds.

00:12:24.200 --> 00:12:26.060 align:middle line:84%
And now, this is
going to display

00:12:26.060 --> 00:12:29.240 align:middle line:90%
a list of all running services.

00:12:29.240 --> 00:12:33.380 align:middle line:84%
And the way the output is sorted
is in the form of an ExitCode,

00:12:33.380 --> 00:12:35.930 align:middle line:84%
the name of the
service, the ProcessID

00:12:35.930 --> 00:12:39.620 align:middle line:84%
of that particular service,
the StartMode, the State,

00:12:39.620 --> 00:12:40.910 align:middle line:90%
and its Status, right?

00:12:40.910 --> 00:12:43.160 align:middle line:84%
So this is really
all the services

00:12:43.160 --> 00:12:44.840 align:middle line:84%
that are running
in the background,

00:12:44.840 --> 00:12:47.480 align:middle line:84%
and it'll provide you
with the process ID,

00:12:47.480 --> 00:12:49.430 align:middle line:84%
whether it's currently
running or stopped,

00:12:49.430 --> 00:12:51.380 align:middle line:84%
which is very, very
important, right?

00:12:51.380 --> 00:12:54.140 align:middle line:84%
And all of this information
is really relevant

00:12:54.140 --> 00:12:56.090 align:middle line:84%
when it comes down to
privilege escalation.

00:12:56.090 --> 00:12:59.750 align:middle line:84%
So it might not make a lot of
sense right now, but trust me,

00:12:59.750 --> 00:13:01.640 align:middle line:84%
this information
is very important.

00:13:01.640 --> 00:13:05.370 align:middle line:84%
And the ability to enumerate
it is equally as important.

00:13:05.370 --> 00:13:10.700 align:middle line:84%
So again, that's how to list
all the services with WMIC.

00:13:10.700 --> 00:13:16.910 align:middle line:84%
We can also list out the list
of services or other processes

00:13:16.910 --> 00:13:19.850 align:middle line:84%
and services using
the task list command.

00:13:19.850 --> 00:13:21.590 align:middle line:90%
And we can say SVC.

00:13:21.590 --> 00:13:24.800 align:middle line:90%
So tasklist/SVC.

00:13:24.800 --> 00:13:26.120 align:middle line:90%
Hit Enter.

00:13:26.120 --> 00:13:29.790 align:middle line:84%
And this is going to display
the list of processes running,

00:13:29.790 --> 00:13:32.000 align:middle line:84%
as well as the services
that are running

00:13:32.000 --> 00:13:34.320 align:middle line:90%
under a particular process.

00:13:34.320 --> 00:13:38.760 align:middle line:84%
So you can see that we have
the lsass.exe process here.

00:13:38.760 --> 00:13:41.930 align:middle line:84%
So that's lsass.exe,
the process ID, and then

00:13:41.930 --> 00:13:45.380 align:middle line:84%
the services that
run under lsass.exe.

00:13:45.380 --> 00:13:46.700 align:middle line:90%
So this is pretty--

00:13:46.700 --> 00:13:49.370 align:middle line:84%
I would say that this is
the most important command.

00:13:49.370 --> 00:13:51.260 align:middle line:84%
Because not only
does it list out

00:13:51.260 --> 00:13:53.660 align:middle line:84%
the list of running
processes, but also

00:13:53.660 --> 00:13:57.800 align:middle line:84%
the services that run under
a particular process, right?

00:13:57.800 --> 00:14:02.700 align:middle line:84%
So an example of this would be,
if we take a look at hfs.exe,

00:14:02.700 --> 00:14:05.120 align:middle line:90%
so that's the HTTP File Server.

00:14:05.120 --> 00:14:07.460 align:middle line:84%
You can see it provides
us with the process ID,

00:14:07.460 --> 00:14:10.640 align:middle line:84%
but we can see that it doesn't
have any services running

00:14:10.640 --> 00:14:14.360 align:middle line:84%
under hfs.exe or it doesn't
have any services that

00:14:14.360 --> 00:14:17.630 align:middle line:84%
are responsible for
maintaining the functionality

00:14:17.630 --> 00:14:20.650 align:middle line:90%
of the program itself.

00:14:20.650 --> 00:14:23.380 align:middle line:84%
So for Windows
specific processes

00:14:23.380 --> 00:14:26.680 align:middle line:84%
like svchost and
lsass.exe, it'll

00:14:26.680 --> 00:14:29.140 align:middle line:84%
display the list of
services that are running

00:14:29.140 --> 00:14:30.950 align:middle line:90%
under that particular process.

00:14:30.950 --> 00:14:35.260 align:middle line:84%
So again, this is a very,
very important information.

00:14:35.260 --> 00:14:39.430 align:middle line:84%
If you also want to list out
a list of these scheduled

00:14:39.430 --> 00:14:41.230 align:middle line:84%
tasks on the system,
that can also

00:14:41.230 --> 00:14:43.420 align:middle line:84%
be done via command
shell session,

00:14:43.420 --> 00:14:48.190 align:middle line:84%
by typing in schtasks, so just
an abbreviation for scheduled

00:14:48.190 --> 00:14:48.820 align:middle line:90%
tasks.

00:14:48.820 --> 00:14:49.840 align:middle line:90%
We can then query.

00:14:49.840 --> 00:14:51.640 align:middle line:90%
So /query.

00:14:51.640 --> 00:14:55.660 align:middle line:84%
And we can then say fo, and
we can then say list, right?

00:14:55.660 --> 00:14:58.930 align:middle line:84%
So that is going to provide
us with, essentially,

00:14:58.930 --> 00:15:00.940 align:middle line:84%
the entire list
of scheduled tasks

00:15:00.940 --> 00:15:04.610 align:middle line:84%
that have been configured to
run on this target system.

00:15:04.610 --> 00:15:06.370 align:middle line:84%
Now, this command
is going to output

00:15:06.370 --> 00:15:09.310 align:middle line:84%
a lot of information, which I
would recommend that you copy

00:15:09.310 --> 00:15:12.790 align:middle line:84%
and paste into a text
file for later use,

00:15:12.790 --> 00:15:15.700 align:middle line:84%
as this will really come into
play during the privilege

00:15:15.700 --> 00:15:18.820 align:middle line:84%
escalation phase of the
post-exploitation phase

00:15:18.820 --> 00:15:20.240 align:middle line:90%
of a penetration test.

00:15:20.240 --> 00:15:22.300 align:middle line:84%
So once I Enter,
you'll see that this

00:15:22.300 --> 00:15:24.740 align:middle line:84%
is going to enumerate
a lot of information.

00:15:24.740 --> 00:15:28.600 align:middle line:84%
So we'll give this
a couple of seconds.

00:15:28.600 --> 00:15:30.940 align:middle line:84%
You can see that
it's not enumerated

00:15:30.940 --> 00:15:33.700 align:middle line:84%
additional information
that's really important,

00:15:33.700 --> 00:15:36.500 align:middle line:84%
and that is because
we did not specify.

00:15:36.500 --> 00:15:40.510 align:middle line:84%
So I can say, scheduled tasks
again, and we can then specify.

00:15:40.510 --> 00:15:44.410 align:middle line:84%
In this case, we can
say /query /fo LIST,

00:15:44.410 --> 00:15:48.470 align:middle line:84%
and we can then say /v. They'll
display additional information.

00:15:48.470 --> 00:15:52.090 align:middle line:84%
And you can see that we have
more fields being populated now

00:15:52.090 --> 00:15:54.680 align:middle line:84%
for each specific
scheduled task.

00:15:54.680 --> 00:15:57.350 align:middle line:84%
So let's take a look at
some of these examples here.

00:15:57.350 --> 00:15:59.740 align:middle line:84%
So this is under
the folder Mozilla.

00:15:59.740 --> 00:16:01.900 align:middle line:84%
The hostname-- this provides
us with the hostname

00:16:01.900 --> 00:16:02.800 align:middle line:90%
of the system.

00:16:02.800 --> 00:16:07.000 align:middle line:84%
The task name, in this case, is
Mozilla Firefox Default Browser

00:16:07.000 --> 00:16:07.910 align:middle line:90%
Agent.

00:16:07.910 --> 00:16:09.520 align:middle line:90%
So that's for the browser agent.

00:16:09.520 --> 00:16:11.860 align:middle line:84%
The status is
currently set to ready,

00:16:11.860 --> 00:16:14.180 align:middle line:84%
and it provides us
with the task to run.

00:16:14.180 --> 00:16:16.060 align:middle line:84%
So we can see that
this is the task that

00:16:16.060 --> 00:16:17.620 align:middle line:90%
has been configured to run.

00:16:17.620 --> 00:16:20.210 align:middle line:84%
And then, you have the
schedule right over here.

00:16:20.210 --> 00:16:22.790 align:middle line:84%
So scheduling data is not
available in this format.

00:16:22.790 --> 00:16:25.510 align:middle line:84%
The schedule type is
daily, et cetera, right?

00:16:25.510 --> 00:16:28.280 align:middle line:84%
So you, again, might
be asking yourself,

00:16:28.280 --> 00:16:30.230 align:middle line:84%
why is this
information important?

00:16:30.230 --> 00:16:33.100 align:middle line:84%
Well, in certain
cases, scheduled tasks

00:16:33.100 --> 00:16:35.530 align:middle line:84%
could be misconfigured
or configured

00:16:35.530 --> 00:16:38.860 align:middle line:84%
in a way that makes them
vulnerable to exploitation,

00:16:38.860 --> 00:16:43.090 align:middle line:84%
and more specifically, they
can be exploited in some cases

00:16:43.090 --> 00:16:45.850 align:middle line:90%
to elevate our privileges.

00:16:45.850 --> 00:16:48.970 align:middle line:84%
So in the context of
privilege escalation,

00:16:48.970 --> 00:16:51.580 align:middle line:84%
we would typically be looking
for scheduled tasks that

00:16:51.580 --> 00:16:55.310 align:middle line:84%
are running with the NT
AUTHORITY system privileges,

00:16:55.310 --> 00:16:55.810 align:middle line:90%
right?

00:16:55.810 --> 00:16:58.630 align:middle line:84%
And that's typically what
we would be looking for.

00:16:58.630 --> 00:17:01.120 align:middle line:84%
In that, if we can get
that scheduled task

00:17:01.120 --> 00:17:07.960 align:middle line:84%
to run or execute our specific
executable, an executable

00:17:07.960 --> 00:17:11.230 align:middle line:84%
that we specify, then
we can potentially

00:17:11.230 --> 00:17:12.680 align:middle line:90%
elevate our privileges.

00:17:12.680 --> 00:17:15.130 align:middle line:84%
And of course, that's something
that, again, will fall

00:17:15.130 --> 00:17:16.750 align:middle line:90%
under privilege escalation.

00:17:16.750 --> 00:17:18.819 align:middle line:84%
So as I said, I would
recommend that you

00:17:18.819 --> 00:17:22.210 align:middle line:84%
copy all of this information
and paste it into a text file

00:17:22.210 --> 00:17:24.619 align:middle line:84%
as it will become
important later on.

00:17:24.619 --> 00:17:26.560 align:middle line:84%
And again, for all
the information

00:17:26.560 --> 00:17:28.780 align:middle line:84%
that you're gathering or
that you have gathered

00:17:28.780 --> 00:17:34.270 align:middle line:84%
during the local enumeration
phase of post-exploitation,

00:17:34.270 --> 00:17:36.790 align:middle line:84%
I would recommend that you
save all of that information

00:17:36.790 --> 00:17:39.340 align:middle line:84%
and you ensure that
you're documenting

00:17:39.340 --> 00:17:41.650 align:middle line:84%
all of the important information
that you're gathering,

00:17:41.650 --> 00:17:45.160 align:middle line:84%
so that you can actually use
it during the other phases

00:17:45.160 --> 00:17:49.240 align:middle line:84%
of post-exploitation and also
during the reporting stage

00:17:49.240 --> 00:17:51.827 align:middle line:84%
or phase of the
penetration test.

00:17:51.827 --> 00:17:53.410 align:middle line:84%
So again, you can
go through the list.

00:17:53.410 --> 00:17:56.830 align:middle line:84%
You can then copy this and
save it into a text file.

00:17:56.830 --> 00:17:58.660 align:middle line:84%
With that being
said, that is going

00:17:58.660 --> 00:18:00.640 align:middle line:84%
to conclude the
practical demonstration

00:18:00.640 --> 00:18:03.270 align:middle line:90%
side of this video.

00:18:03.270 --> 00:18:05.570 align:middle line:84%
All right, so now
that we've explored

00:18:05.570 --> 00:18:09.440 align:middle line:84%
the process of enumerating
system information, users

00:18:09.440 --> 00:18:13.310 align:middle line:84%
and groups, network information,
service information, service

00:18:13.310 --> 00:18:16.280 align:middle line:84%
and process information
on a Windows system,

00:18:16.280 --> 00:18:19.790 align:middle line:84%
we can now move on to the
final video within the Windows

00:18:19.790 --> 00:18:23.240 align:middle line:84%
local enumeration section,
which will essentially

00:18:23.240 --> 00:18:25.910 align:middle line:84%
cover the process of
automating everything

00:18:25.910 --> 00:18:28.520 align:middle line:90%
that we've done so far.

00:18:28.520 --> 00:18:32.180 align:middle line:84%
And the reason why I have this
at the end of this section

00:18:32.180 --> 00:18:34.700 align:middle line:84%
is primarily because you
need to have the ability

00:18:34.700 --> 00:18:37.400 align:middle line:84%
to enumerate all
of this information

00:18:37.400 --> 00:18:40.860 align:middle line:84%
manually before you can
move on to automating it.

00:18:40.860 --> 00:18:43.250 align:middle line:84%
So the objective
in the next video

00:18:43.250 --> 00:18:47.210 align:middle line:84%
is to automate all of these
local enumeration checks

00:18:47.210 --> 00:18:49.730 align:middle line:84%
that we've done
throughout this section.

00:18:49.730 --> 00:18:51.620 align:middle line:84%
And we will be doing
this through the use

00:18:51.620 --> 00:18:55.340 align:middle line:84%
of various Metasploit Framework
post-exploitation modules

00:18:55.340 --> 00:18:59.210 align:middle line:84%
in addition to a couple
of enumeration scripts

00:18:59.210 --> 00:19:02.660 align:middle line:84%
or utilities that will automate
all of this enumeration

00:19:02.660 --> 00:19:05.510 align:middle line:84%
and will speed things
up, therefore, making

00:19:05.510 --> 00:19:08.930 align:middle line:84%
the local enumeration
phase of post-exploitation

00:19:08.930 --> 00:19:11.690 align:middle line:84%
much more efficient
as you move along

00:19:11.690 --> 00:19:14.870 align:middle line:84%
or as you progress with your
career as a penetration tester.

00:19:14.870 --> 00:19:18.500 align:middle line:84%
So I'll be seeing you
in the next video.

00:19:18.500 --> 00:19:19.000 align:middle line:90%