WEBVTT

00:00:00.140 --> 00:00:04.630
Living off the Land techniques allow attackers to use native Windows binaries,

00:00:04.640 --> 00:00:09.030
scripts, and libraries to facilitate different stages of the attack lifecycle.

00:00:09.030 --> 00:00:12.670
In other words, instead of introducing their own tools,

00:00:12.770 --> 00:00:15.660
attackers simply use the built‑in Windows binaries.

00:00:16.340 --> 00:00:17.090
In this clip,

00:00:17.100 --> 00:00:20.090
I'm going to talk about how we can leverage Winlogbeat to

00:00:20.090 --> 00:00:21.950
detect Living off the Land attacks.

00:00:22.540 --> 00:00:26.020
Let's say we're in a relatively new environment and we decide

00:00:26.020 --> 00:00:29.600
to whitelist all Microsoft signed binaries in an attempt to

00:00:29.600 --> 00:00:31.560
curb malicious software execution.

00:00:32.439 --> 00:00:36.140
Well, that's still not a bad practice; however,

00:00:36.310 --> 00:00:39.720
now the adversary uses those same trusted binaries to

00:00:39.720 --> 00:00:42.260
perform their post‑exploitation activities.

00:00:43.240 --> 00:00:45.850
It all started with binaries like bitsadmin,

00:00:46.240 --> 00:00:49.360
which can be used to download additional resources for an attack,

00:00:50.040 --> 00:00:53.960
and MSBuild, which can be used to compile and execute code.

00:00:54.740 --> 00:00:58.060
These two binaries together will allow an attacker to download their

00:00:58.060 --> 00:01:01.480
source code and then build and execute their custom code,

00:01:01.480 --> 00:01:04.650
all with a high chance of evading detection.

00:01:04.650 --> 00:01:08.850
Collectively, the Living off the Land binaries are called LOLBins.

00:01:09.640 --> 00:01:13.550
Then, the security community found Microsoft signed scripts could be

00:01:13.550 --> 00:01:18.030
used maliciously, and thus, LOLBAS, or Living off the Land Binaries

00:01:18.030 --> 00:01:23.150
and Scripts, was born. Security researchers later demonstrated that

00:01:23.150 --> 00:01:27.790
native libraries like shell32.dll could be used for a proxy execution

00:01:27.790 --> 00:01:28.840
of arbitrary code,

00:01:29.120 --> 00:01:32.350
but the name of the project wasn't changed. So,

00:01:32.510 --> 00:01:35.160
LOLBAS implicitly refers to libraries.

00:01:36.340 --> 00:01:39.160
If I open a command interpreter on a Windows system,

00:01:39.540 --> 00:01:43.470
which I will sometimes refer to as the CLI, the programs or

00:01:43.470 --> 00:01:47.220
processes I start manually or programmatically are not logged by

00:01:47.220 --> 00:01:53.090
default; however, we can enable Windows event ID 4688, which is

00:01:53.090 --> 00:01:55.360
generated every time a new process starts.

00:01:56.310 --> 00:02:00.220
Event ID 4688 can generate a lot of events in some

00:02:00.220 --> 00:02:04.360
environments; however, one tradeoff is to enable the event ID

00:02:04.470 --> 00:02:06.960
only on critical or high‑value systems.

00:02:07.840 --> 00:02:10.539
Another step that could be helpful is to enable command line

00:02:10.539 --> 00:02:13.720
login, which will give you the command line arguments and any

00:02:13.720 --> 00:02:15.960
parameters used when a process is launched.

00:02:17.040 --> 00:02:18.360
I want to clarify something here.

00:02:19.140 --> 00:02:23.460
You don't have to run the program from the CLI or manually typed commands.

00:02:23.840 --> 00:02:27.100
Any process or program that runs on the system will likely

00:02:27.100 --> 00:02:31.740
generate a 4688 event; therefore, we should develop a

00:02:31.740 --> 00:02:33.950
baseline and conduct careful filtering.

00:02:34.840 --> 00:02:39.510
So how do we go about enabling this event ID? I recommend using a GPO so you

00:02:39.510 --> 00:02:44.190
can scale or scope the effects of this configuration. Log on to your domain

00:02:44.190 --> 00:02:48.790
controller, and using the Group Policy Management Editor, you need to change

00:02:48.870 --> 00:02:51.860
Audit Process Creation to at least Success.

00:02:52.640 --> 00:02:55.960
This setting is found under Policies, Windows Settings,

00:02:56.180 --> 00:02:57.260
Security Settings,

00:02:57.510 --> 00:03:02.960
Advanced Audit Policy Configuration, Audit Policies, and Detailed Tracking.

00:03:02.960 --> 00:03:08.570
We could stop there, but we should configure command line login and either

00:03:08.570 --> 00:03:14.290
use a new GPO or modify the previous. Here, we need to change the Include

00:03:14.430 --> 00:03:19.350
command line and process creation events to enable found under Policies,

00:03:19.740 --> 00:03:25.440
Admin Templates, System, Audit Process Creation. Once you have correctly

00:03:25.440 --> 00:03:31.120
applied the GPOs, Winlogbeat will pick up event ID 4688 and ship it to our

00:03:31.120 --> 00:03:32.350
Elasticsearch cluster.

00:03:33.740 --> 00:03:36.630
So how do we take all of this information and turn it into

00:03:36.630 --> 00:03:38.660
detection of Living off the Land attacks?

00:03:39.440 --> 00:03:43.040
The naive approach is to just search for the 100+ LOLBAS

00:03:43.040 --> 00:03:45.860
files and then investigate each log event.

00:03:46.840 --> 00:03:50.650
A better approach is to first determine what is normal for your environment.

00:03:51.540 --> 00:03:54.660
At the bare minimum, you should have good observation of the

00:03:54.660 --> 00:03:57.460
LOLBAS list and how it relates to your environment.

00:03:58.240 --> 00:04:00.870
Then, block execution of the binaries,

00:04:00.880 --> 00:04:06.110
scripts or libraries you do not need or use. For example, is

00:04:06.120 --> 00:04:10.160
MSBuild routinely executed? What about certutil?

00:04:11.040 --> 00:04:14.460
Once you have that baseline, then we need to look at context.

00:04:15.240 --> 00:04:18.510
The LOLBin certutil, which is a command line utility

00:04:18.519 --> 00:04:20.160
used for handling certificates,

00:04:20.540 --> 00:04:24.940
can also be used to download files, so if I have

00:04:24.940 --> 00:04:28.060
certutil executed in my environment daily,

00:04:28.250 --> 00:04:28.940
weekly,

00:04:28.950 --> 00:04:34.060
monthly, etc, does it use the following command line parameters? What

00:04:34.060 --> 00:04:39.120
about the arguments? If not, then create your alert conditions around

00:04:39.120 --> 00:04:40.760
what is anomalous for your environment.

00:04:41.740 --> 00:04:45.060
Another mistake is to focus too much on the LOLBAS names.

00:04:45.740 --> 00:04:52.840
If I rename certutil.exe to notevil.exe, it will still maintain its

00:04:52.840 --> 00:04:57.970
cryptographic signature, which means it will escape searches for certutil.exe.

00:04:59.240 --> 00:05:02.150
Attackers know this and won't always use the default names.

00:05:03.240 --> 00:05:06.160
The last thing I'll mention here is to be cautious when it comes to

00:05:06.160 --> 00:05:10.490
case sensitivity and searching your dataset. Attackers will try to

00:05:10.490 --> 00:05:14.540
avoid detection by mixing upper and lowercase letters in the LOLBAS

00:05:14.540 --> 00:05:16.760
names and associated arguments.

00:05:17.540 --> 00:05:18.560
That's it for this clip.

00:05:19.040 --> 00:05:19.960
Thanks for watching.
