WEBVTT

00:00:01.840 --> 00:00:04.170
So let's get started with our demos.

00:00:04.170 --> 00:00:08.160
In here, you'll learn how to gather and exfiltrate sensitive files,

00:00:08.170 --> 00:00:11.750
audio from microphones, and even webcam snapshots,

00:00:11.750 --> 00:00:14.130
but before we go to our demo,

00:00:14.140 --> 00:00:18.290
it is important for you to know the legal considerations of doing this.

00:00:18.290 --> 00:00:19.280
First,

00:00:19.290 --> 00:00:22.580
recording audio or video without the consent of the person

00:00:22.590 --> 00:00:24.470
is illegal in most of the countries.

00:00:24.570 --> 00:00:26.060
You can go to jail for that.

00:00:26.740 --> 00:00:29.160
So check in your country if you can do that,

00:00:29.160 --> 00:00:32.049
and if yes, get a formal approval from the client.

00:00:32.439 --> 00:00:34.040
Make sure you have everything in writing.

00:00:34.040 --> 00:00:38.050
And the best advice I can give you is stay out of trouble.

00:00:38.440 --> 00:00:41.460
Don't try to hack your ex‑girlfriend or record things.

00:00:41.840 --> 00:00:42.930
This is just wrong,

00:00:43.020 --> 00:00:46.230
and it is also illegal, and the last thing you want is going

00:00:46.230 --> 00:00:48.660
to jail for that, so don't be a criminal.

00:00:50.940 --> 00:00:52.460
So let's go to our lab environment.

00:00:52.940 --> 00:00:55.670
In there, we'll see how to gather sensitive files,

00:00:55.850 --> 00:00:59.860
how to record audio and video, and how to take screenshots of a computer.

00:01:02.540 --> 00:01:03.170
Hey there!

00:01:03.170 --> 00:01:05.280
Welcome back to our lab environment.

00:01:05.280 --> 00:01:08.750
In here, I already have a Meterpreter shell to my victim computer.

00:01:09.840 --> 00:01:12.060
This shell has administrator privileges,

00:01:12.060 --> 00:01:15.150
and I created this using the Meterpreter executable

00:01:15.150 --> 00:01:16.760
payload in my Windows machine.

00:01:17.640 --> 00:01:20.930
And actually, for this demo, it doesn't matter how you got the shell,

00:01:20.930 --> 00:01:23.060
as long as it has admin privileges.

00:01:24.340 --> 00:01:26.080
So to get this demo started,

00:01:26.090 --> 00:01:29.820
I want to show you how to search for sensitive files using Meterpreter.

00:01:31.140 --> 00:01:33.360
And the good news is, it couldn't be simpler.

00:01:34.040 --> 00:01:36.260
All I have to do is type search,

00:01:37.140 --> 00:01:42.060
and then use the flag ‑f to define the keywords that I want to search.

00:01:43.140 --> 00:01:46.900
For example, if I want to search for all the .key files,

00:01:46.910 --> 00:01:50.360
I just have to search * .key.

00:01:51.640 --> 00:01:56.290
If you're not familiar, the .key files are usually SSH private keys,

00:01:56.290 --> 00:02:00.360
and those you can use to log into other servers and move laterally.

00:02:01.040 --> 00:02:04.460
And if you find this in a pen test, you should consider yourself lucky.

00:02:05.840 --> 00:02:08.280
The cool thing about the search feature is that we can

00:02:08.280 --> 00:02:10.960
search multiple terms with just one command.

00:02:11.740 --> 00:02:16.820
For example, I can add here another ‑f flag, and then add one more search term.

00:02:16.820 --> 00:02:18.910
For example,

00:02:18.920 --> 00:02:23.610
if I want to find any file names that have the word user in the file name,

00:02:23.610 --> 00:02:26.680
I just use *user*.

00:02:26.680 --> 00:02:30.960
And again, you can do this as many times as you want.

00:02:31.340 --> 00:02:35.330
So I will also search for files containing the words pass and creds.

00:02:38.340 --> 00:02:39.830
Once I have the search defined,

00:02:39.840 --> 00:02:43.690
all I have to do is press Enter, and this might take a couple minutes,

00:02:43.690 --> 00:02:48.000
depending on the size of the disk of your victim computer, but to save us time,

00:02:48.010 --> 00:02:49.160
I will speed up this video.

00:02:52.140 --> 00:02:54.540
There you go, Meterpreter found a lot of files,

00:02:54.540 --> 00:02:55.700
and to be honest,

00:02:55.710 --> 00:02:58.300
it is kind of hard looking at those results in this Meterpreter shell.

00:02:59.740 --> 00:03:01.450
So let me show you one trick.

00:03:01.840 --> 00:03:05.950
Let me show you how to save the result of any Metasploit command to a file.

00:03:07.140 --> 00:03:09.360
To do that, let me first background this session,

00:03:10.540 --> 00:03:13.740
and then use the command spool with the name of the

00:03:13.740 --> 00:03:15.250
file that I want to save the output.

00:03:16.840 --> 00:03:21.350
Basically, this is saving to a file, anything I type on Metasploit,

00:03:21.350 --> 00:03:23.660
and anything that Metasploit outputs to us.

00:03:24.640 --> 00:03:27.090
It is a good command to keep track of everything

00:03:27.090 --> 00:03:28.960
you do and everything you gather.

00:03:30.140 --> 00:03:30.780
Perfect!

00:03:30.790 --> 00:03:32.750
Now let's go back to our Meterpreter session,

00:03:33.340 --> 00:03:36.970
and let's run the same search command again.

00:03:36.970 --> 00:03:40.250
And a couple minutes later, we are done.

00:03:40.940 --> 00:03:43.250
So let's take a look at the spool file.

00:03:46.740 --> 00:03:47.240
There you go.

00:03:47.240 --> 00:03:47.880
Take a look.

00:03:47.890 --> 00:03:50.700
I have here a list of all the files that contain

00:03:50.700 --> 00:03:52.690
the keywords that I searched for.

00:03:52.690 --> 00:03:55.390
In here, there's a lot of useless stuff,

00:03:55.400 --> 00:03:57.960
but you might find some interesting files.

00:03:59.140 --> 00:04:00.950
And once you find the files you want,

00:04:00.960 --> 00:04:05.500
you can use any exfiltration techniques I mentioned in the slides.

00:04:05.500 --> 00:04:08.360
In here, as I just want to download one single file,

00:04:08.740 --> 00:04:11.760
I will simply copy the path of the file I want,

00:04:11.760 --> 00:04:15.060
and then use the Meterpreter download function.

00:04:18.640 --> 00:04:19.620
Oh, wait, take a look.

00:04:19.620 --> 00:04:21.899
It's saying here that the file was not found,

00:04:21.899 --> 00:04:25.010
and that's because I forgot to escape the forward slashes.

00:04:26.240 --> 00:04:28.210
Remember, this is a Linux environment,

00:04:28.220 --> 00:04:30.500
so we need to always have double forward slashes

00:04:30.500 --> 00:04:32.360
when referencing our Windows path.

00:04:35.540 --> 00:04:36.000
Perfect!

00:04:36.010 --> 00:04:40.640
Now let me rerun the download command, and that's it.

00:04:40.650 --> 00:04:45.060
Now I have the file saved on my disk, and I can easily go to that folder,

00:04:45.540 --> 00:04:47.550
and open the file to check what is inside.

00:04:48.940 --> 00:04:51.750
This technique is really useful to find credentials

00:04:51.760 --> 00:04:53.900
saved in plain text files on the disk,

00:04:53.900 --> 00:04:56.710
and those credentials could be used to log into

00:04:56.710 --> 00:04:58.560
other systems and move laterally.

00:04:59.640 --> 00:05:00.450
Pretty interesting, right?

00:05:02.040 --> 00:05:02.620
Perfect.

00:05:02.630 --> 00:05:05.040
Now let me quickly disable the spool recorder,

00:05:05.050 --> 00:05:08.160
because I want to show you some other cool features of Meterpreter.

00:05:09.140 --> 00:05:13.450
And to disable the spool, I will just use spool and then off.

00:05:16.040 --> 00:05:16.680
Perfect.

00:05:16.690 --> 00:05:17.210
Now,

00:05:17.220 --> 00:05:19.470
let's say that for some reason you want to see the

00:05:19.470 --> 00:05:23.710
webcam of your victim computer. First, remember,

00:05:23.720 --> 00:05:25.430
this might be illegal in some countries,

00:05:25.440 --> 00:05:27.560
so make sure you have the authorization for that.

00:05:28.840 --> 00:05:31.360
Once we have the authorization, then we can proceed.

00:05:31.840 --> 00:05:34.660
The first step is to see if the victim computer has a webcam.

00:05:35.640 --> 00:05:41.820
And for that, I'll use the command webcam_list, and this will tell me

00:05:41.820 --> 00:05:43.960
all the webcams connected to the victim computer.

00:05:45.640 --> 00:05:48.960
As you can see here, my victim computer has no webcams,

00:05:49.340 --> 00:05:50.360
and that's kind of normal.

00:05:50.740 --> 00:05:52.700
If you're doing a pen test against the server,

00:05:52.710 --> 00:05:54.960
it most likely will not have a webcam.

00:05:55.940 --> 00:05:58.850
Normally, you see webcams on laptops of employees.

00:05:59.640 --> 00:06:02.810
So if in your case you have a laptop as the victim computer,

00:06:02.820 --> 00:06:08.340
you could simply type webcam_snap, and then Meterpreter will take a

00:06:08.340 --> 00:06:10.660
snapshot of the webcam of your victim computer,

00:06:11.840 --> 00:06:16.800
or even cooler than that, we could use webcam_stream to

00:06:16.800 --> 00:06:18.460
get a livestream from the webcam.

00:06:19.440 --> 00:06:21.390
And in my opinion, that's really creepy.

00:06:21.420 --> 00:06:26.250
And that's why I always have something covering my webcam. Similar to this

00:06:26.250 --> 00:06:30.310
webcam command, we can also use the feature called record_mic,

00:06:32.340 --> 00:06:36.280
and this would record the microphone of your victim computer. Again,

00:06:36.280 --> 00:06:41.160
as I'm exploiting a server, there's no microphone connected to it, but

00:06:41.160 --> 00:06:44.260
if you're exploiting someone's laptop, then that would work.

00:06:46.040 --> 00:06:48.760
Okay, the next one is one of my favorite features.

00:06:49.240 --> 00:06:53.260
I can use the command screenshot to take a screenshot of my victim computer.

00:06:54.940 --> 00:06:56.380
Take a look. Easy like that.

00:06:56.390 --> 00:07:00.160
I've got an image file in my attacker machine. So let's check it out.

00:07:02.240 --> 00:07:04.960
See, this is a perfect screenshot of my victim computer,

00:07:05.940 --> 00:07:08.250
and I could take as many screenshots as I want,

00:07:08.640 --> 00:07:11.900
and this could be really useful to know what the machine is used for,

00:07:11.910 --> 00:07:15.260
or even to discover some services that you didn't know about.

00:07:16.840 --> 00:07:20.950
But wait, cooler than the screenshot command is the screenshare command.

00:07:21.940 --> 00:07:22.570
Basically,

00:07:22.580 --> 00:07:26.760
this creates a live feed from the victim computer to our computer, so then

00:07:26.770 --> 00:07:31.400
we can watch what the person is doing. After running the command, all we

00:07:31.400 --> 00:07:40.620
have to do is open this HTML file that Meterpreter created for us. And take

00:07:40.620 --> 00:07:42.660
a look. We have here a live feed.

00:07:43.340 --> 00:07:45.630
So if you do anything on the victim computer,

00:07:45.640 --> 00:07:48.050
I will be able to see that in my attacker machine.

00:07:49.240 --> 00:07:52.050
And this can be really useful to see what the administrators

00:07:52.050 --> 00:07:54.550
are doing and where they serve their files.

00:07:55.440 --> 00:07:56.200
For example,

00:07:56.210 --> 00:07:58.470
in here we found out that the administrator has

00:07:58.470 --> 00:07:59.960
some credentials saved in a file.

00:08:01.040 --> 00:08:04.540
Pretty cool, right? Now, after we are done with this spying thing,

00:08:04.550 --> 00:08:07.770
you can just go back to the Meterpreter shell, and press Ctrl+C,

00:08:08.740 --> 00:08:10.960
and this will stop the live feed collection.
