WEBVTT

00:00:00.464 --> 00:00:00.672
Yeah.

00:00:00.672 --> 00:00:01.297
So that's awesome.

00:00:01.297 --> 00:00:02.900
And so what we're going to talk about is kind of

00:00:02.900 --> 00:00:06.041
how to catch some of that stuff, and I know you've got some examples.

00:00:06.042 --> 00:00:10.268
What's one way that we can, if you're just browsing the internet,

00:00:10.268 --> 00:00:14.016
we're talking about the Bitcoin money, and I browse internet,

00:00:14.016 --> 00:00:15.835
where would I get this type of malware from?

00:00:15.835 --> 00:00:18.208
How would that get executed on my box?

00:00:18.209 --> 00:00:20.540
You could be going anywhere.

00:00:20.540 --> 00:00:24.448
If a site gets compromised, then you will,

00:00:24.449 --> 00:00:26.810
you could just land on a site that you go to every day,

00:00:26.810 --> 00:00:28.832
and then it just happens to get compromised,

00:00:28.832 --> 00:00:32.299
and you go there again, and it launches exploits.

00:00:32.299 --> 00:00:32.575
Okay,

00:00:32.575 --> 00:00:37.286
so it's got code on the site similar to code injection or a reflected attack.

00:00:37.287 --> 00:00:39.624
Or the example that we're going to look at.

00:00:39.624 --> 00:00:43.904
You could get a document in your email, and documents are,

00:00:43.904 --> 00:00:47.163
attackers love documents because they have their own

00:00:47.163 --> 00:00:49.477
scripting languages inside of it as well,

00:00:49.477 --> 00:00:55.077
and those scripting languages can be used to pivot to these fileless techniques.

00:00:55.078 --> 00:00:56.389
They could be used to launch PowerShell,

00:00:56.389 --> 00:01:01.475
to launch WMI commands, and so on, and so they're great for attackers.

00:01:01.475 --> 00:01:03.106
So phishing, of course,

00:01:03.106 --> 00:01:05.457
someone always clicks the button that they're not supposed to click every time.

00:01:05.458 --> 00:01:07.909
Or it downloads the document and opens it up.

00:01:07.909 --> 00:01:09.338
Yeah, it happens all the time.

00:01:09.339 --> 00:01:09.572
Yeah.

00:01:09.572 --> 00:01:09.806
Yeah.

00:01:09.806 --> 00:01:12.111
Like 99% of the time, it works every time.

00:01:12.112 --> 00:01:12.400
Yeah.

00:01:12.400 --> 00:01:14.842
Phishing is probably one of the number one,

00:01:14.842 --> 00:01:18.225
it probably is the number one way for attackers to get

00:01:18.225 --> 00:01:19.975
into a network because organizations,

00:01:19.975 --> 00:01:23.804
they're not going to block documents in email.

00:01:23.804 --> 00:01:25.806
You're not going to block Word documents or PDFs.

00:01:25.806 --> 00:01:27.397
Yeah, you can't do that.

00:01:27.398 --> 00:01:30.081
And so attackers know this, and so they,

00:01:30.082 --> 00:01:35.777
this is the hole in our organization's defenses that they can get through.

00:01:35.777 --> 00:01:39.321
So do you have some examples of a document and what that looks like?

00:01:39.321 --> 00:01:41.552
So here, I have a document.

00:01:41.552 --> 00:01:43.820
It's called invoice.

00:01:43.820 --> 00:01:46.814
If I was a, let's say, an accountant,

00:01:46.814 --> 00:01:51.182
and I received a document that was named invoice.

00:01:51.183 --> 00:01:53.329
It may--- it's not suspicious to me.

00:01:53.330 --> 00:01:55.315
I would go ahead and open it up.

00:01:55.316 --> 00:01:55.816
You do this every day,

00:01:55.816 --> 00:01:57.861
so of course you're going to open up the invoice

00:01:57.861 --> 00:01:59.255
document because that's your job.

00:01:59.255 --> 00:02:04.842
Now the one thing that I'll say is I've kind of neutered this one a little bit.

00:02:04.842 --> 00:02:05.994
So nothing just executed right now on your box.

00:02:05.994 --> 00:02:08.947
Nothing just executed, and I'll explain why.

00:02:08.947 --> 00:02:10.255
You're not pinging out to Russia right now.

00:02:10.256 --> 00:02:10.632
No.

00:02:10.632 --> 00:02:11.008
No.

00:02:11.008 --> 00:02:14.018
So here, if we dig down into it,

00:02:14.018 --> 00:02:17.277
you'll see that there's a macro called Document_Open.

00:02:17.277 --> 00:02:19.981
If it had been renamed to Auto_Open,

00:02:19.981 --> 00:02:24.092
then it would have automatically executed when I opened the document.

00:02:24.092 --> 00:02:24.419
That's it.

00:02:24.419 --> 00:02:26.409
So instead of saying Document_Open, it just says Auto_Open,

00:02:26.410 --> 00:02:30.355
and now as soon as you click it, it opens up inside of Macro.

00:02:30.355 --> 00:02:32.899
And I just did this to neuter it so that we can go in and it's not

00:02:32.899 --> 00:02:35.225
going to be doing anything bad in the background.

00:02:35.225 --> 00:02:42.707
But if we go in and we edit it, we'll see exactly what the macro is doing.

00:02:42.708 --> 00:02:48.907
And here, we see that there is a shell command within the macro,

00:02:48.908 --> 00:02:51.081
and it's launching PowerShell.

00:02:51.082 --> 00:02:52.340
One of the ways when you look at PowerShell,

00:02:52.340 --> 00:02:54.114
and we'll see this later on too,

00:02:54.114 --> 00:02:56.944
you know that there's something suspicious going on when

00:02:56.944 --> 00:03:00.662
you see the -EncodedCommand on there.

00:03:00.662 --> 00:03:01.450
And the EncodedCommand,

00:03:01.450 --> 00:03:05.064
you're going to see a string of hex characters after that,

00:03:05.065 --> 00:03:07.480
and that's just Base64 code.

00:03:07.480 --> 00:03:11.032
If we see some equal signs, that's kind of a pretty good--- If we scroll over,

00:03:11.032 --> 00:03:12.434
I bet we see some equal signs.

00:03:12.434 --> 00:03:13.218
Yeah, there we go.

00:03:13.218 --> 00:03:15.409
You'll also see one or two equal signs at the end,

00:03:15.409 --> 00:03:19.295
and that is a key indicator that you're dealing with a Base64 encoded string.

00:03:19.296 --> 00:03:22.875
Is it always Base64 if it says Encoded in the PowerShell?

00:03:22.875 --> 00:03:23.213
You know what?

00:03:23.213 --> 00:03:23.663
I think it is.

00:03:23.664 --> 00:03:27.915
I have not seen anything outside of Base64.

00:03:27.916 --> 00:03:28.890
_____ unencrypt it.

00:03:28.891 --> 00:03:31.242
It is, and it's actually very easy to do it.

00:03:31.243 --> 00:03:32.768
And in fact, we'll go ahead and do that.

00:03:32.769 --> 00:03:34.710
Let me copy this out.

00:03:34.711 --> 00:03:36.740
I'm just copying out this whole string.

00:03:36.741 --> 00:03:37.029
See?

00:03:37.029 --> 00:03:39.603
And this is where CTF experience comes in handy for security operations.

00:03:39.604 --> 00:03:42.258
Base64 is used all the time with capture the flags.

00:03:42.258 --> 00:03:45.651
And so just to explain what's going on here.

00:03:45.651 --> 00:03:48.278
So what happens is when you open the documents,

00:03:48.278 --> 00:03:50.554
it's going to launch PowerShell,

00:03:50.554 --> 00:03:56.377
and whatever the deobfuscated version of whatever this Base64 code is,

00:03:56.378 --> 00:03:57.832
which is what we'll look at in a second,

00:03:57.832 --> 00:03:59.672
that's going to be run by PowerShell.

00:03:59.672 --> 00:04:03.988
So the accountant was sitting here, he thought he was opening up an invoice,

00:04:03.989 --> 00:04:08.032
and little to his knowledge in the scenes behind him,

00:04:08.032 --> 00:04:11.524
it's launching PowerShell and doing all of this other stuff.

00:04:11.524 --> 00:04:13.489
So let me, I've copied it.

00:04:13.490 --> 00:04:15.544
And this is a VBScript or is it macro?

00:04:15.544 --> 00:04:16.338
A VBA script.

00:04:16.338 --> 00:04:16.603
Yeah.

00:04:16.603 --> 00:04:17.843
You use VBA?

00:04:17.843 --> 00:04:18.257
Okay.

00:04:18.257 --> 00:04:18.967
Yeah.

00:04:18.967 --> 00:04:25.121
Word docs, they support VBA, Excel docs now support JavaScript,

00:04:25.121 --> 00:04:27.228
and PDFs support JavaScript,

00:04:27.229 --> 00:04:32.632
so there's lots of different languages that you can go to.
