WEBVTT

00:00:00.440 --> 00:00:03.760
Modern versions of Windows will have PowerShell installed by default.

00:00:04.340 --> 00:00:05.320
In this clip,

00:00:05.330 --> 00:00:08.170
I will talk about configuring Winlogbeat to collect

00:00:08.170 --> 00:00:11.210
PowerShell logs that will provide defenders with the event

00:00:11.210 --> 00:00:13.360
data necessary to detect anomalies.

00:00:14.140 --> 00:00:17.230
PowerShell is a robust command shell and scripting

00:00:17.230 --> 00:00:20.520
language used by system administrators for various

00:00:20.530 --> 00:00:23.050
automation and remote management tasks.

00:00:23.840 --> 00:00:27.220
Adversaries understand the capabilities of PowerShell and

00:00:27.220 --> 00:00:29.150
will use it to enable their objectives.

00:00:29.540 --> 00:00:32.770
For example, threat intelligence reports from FireEye,

00:00:32.780 --> 00:00:33.650
CrowdStrike,

00:00:33.660 --> 00:00:36.760
and Microsoft show that malware has been seen using

00:00:36.760 --> 00:00:40.150
PowerShell to evade detection, download remote code,

00:00:40.540 --> 00:00:43.960
and make system configuration changes, among many other things.

00:00:44.740 --> 00:00:45.960
Let's look at an example.

00:00:46.740 --> 00:00:50.150
The PowerShell command you see on the screen will attempt to bypass

00:00:50.160 --> 00:00:54.290
any configured execution policy and then execute the command or

00:00:54.290 --> 00:00:57.420
commands obscured by the Base64 encoding.

00:00:58.340 --> 00:01:01.870
Sometimes, there could be additional layers of encoding or encryption,

00:01:02.060 --> 00:01:06.930
so copying and pasting the payload into a decoder won't get us the details.

00:01:06.930 --> 00:01:09.570
If you see something like this in your environment,

00:01:09.800 --> 00:01:12.090
it's a good chance it will be anomalous.

00:01:12.090 --> 00:01:16.690
If your organization has an operational need to encode PowerShell commands,

00:01:16.880 --> 00:01:20.160
then that should be well defined and documented so the

00:01:20.160 --> 00:01:22.540
security team can account for it.

00:01:22.540 --> 00:01:24.090
As defenders,

00:01:24.100 --> 00:01:27.450
we can use Winlogbeat to help us aggregate the PowerShell

00:01:27.450 --> 00:01:31.300
logs from across the enterprise into a central platform for

00:01:31.300 --> 00:01:33.070
threat hunting and analysis.

00:01:33.070 --> 00:01:40.760
In the Winlogbeat configuration, you will need to enable event ID 4103 and 4104.

00:01:41.340 --> 00:01:41.990
Together,

00:01:42.040 --> 00:01:46.260
these event IDs can show the encoded and decoded PowerShell commands

00:01:46.640 --> 00:01:49.170
and the entire contents of PowerShell scripts.

00:01:49.440 --> 00:01:53.960
In some cases, the output from malicious PowerShell execution is also logged.

00:01:54.940 --> 00:01:59.610
Another event ID we should employ is 4688, which I covered in a

00:01:59.610 --> 00:02:04.180
previous clip. Enabling this event ID will allow Winlogbeat to

00:02:04.180 --> 00:02:07.960
capture and ship process creation events generated by PowerShell

00:02:08.340 --> 00:02:09.360
and the command line.

00:02:10.039 --> 00:02:14.720
It's not enough just to put the event IDs in the configuration file, you will

00:02:14.720 --> 00:02:18.320
have to enable these event IDs using Group Policy explicitly,

00:02:18.560 --> 00:02:22.550
then remember to perform testing and tuning for your environment.
