WEBVTT

00:05.500 --> 00:07.300
How is everyone doing?

00:09.960 --> 00:11.880
I'm genuinely surprised.

00:11.880 --> 00:14.720
So either y'all went to bed early or you never went to bed.

00:14.720 --> 00:16.260
So thank you so much for being here.

00:16.260 --> 00:18.140
This talk is Maldaptive.

00:18.140 --> 00:23.440
Diving really, really deep into LDAP obfuscation, de-obfuscation and detection.

00:24.060 --> 00:25.640
My name is Daniel Bohannon.

00:25.680 --> 00:29.020
Everyone I know calls me Debo for short, so feel free to call me that.

00:29.020 --> 00:34.220
I'm a principal threat researcher for a startup company called Permiso Security doing cloud and identity stuff.

00:34.220 --> 00:41.920
For the last better part of a decade , I've been really focused on end point security, doing some IR and threat research at Mandiant, Microsoft.

00:42.020 --> 00:44.520
And I have a little bit of a problem with obfuscation.

00:44.520 --> 00:50.920
It's kind of an obsession of mine of taking things that look normal and making them look just absolutely crazy.

00:51.120 --> 00:54.000
And then as a defender, looking for ways to detect those things.

00:54.040 --> 00:59.480
Another thing I'm really passionate about is coffee and books and all the great conversations that happen around both of those things.

01:00.780 --> 01:02.460
Hello, everyone.

01:02.460 --> 01:04.740
So I'm Sabayita.

01:04.740 --> 01:06.940
You can call me Sabi for short.

01:06.940 --> 01:08.980
I'm originally from Albania.

01:08.980 --> 01:16.160
I recently moved to Germany, Berlin, working for Solaris as a senior cyber security engineer.

01:16.300 --> 01:18.580
I'm passionate about cyber defense.

01:18.580 --> 01:28.180
Currently I'm also working on the field, doing a little incident response, detection engineering and time and time allows threat hunting.

01:28.260 --> 01:32.200
I do have also some experience in consulting and government.

01:32.460 --> 01:33.600
Love mountains.

01:33.600 --> 01:35.440
You can see even a goat there.

01:35.600 --> 01:39.100
And enjoy moving a lot at the Great Espresso.

01:40.660 --> 01:41.540
All right.

01:41.540 --> 01:46.040
So to kick things off, we're going to do a little historical lesson on Active Directory and LDAP.

01:46.040 --> 01:55.120
And then we're going to break down kind of the components of LDAP so we know which pieces we're talking about when we get into the main piece of the talk, which is diving crazy deep into all the obfuscation.

01:55.320 --> 01:57.260
And then at the end, we'll talk more about our solution.

01:57.260 --> 01:59.500
You know, we don't like to just create problems.

01:59.500 --> 02:04.760
We want to actually have some real solutions there so that defenders can walk away equipped with something really beneficial.

02:05.020 --> 02:09.040
And then we'll do a demo and a tool release at the end.

02:09.200 --> 02:10.500
So let's get going.

02:11.240 --> 02:16.360
We are going to go back in time to the days of disco balls and DeLoreans, talking about the 1980s.

02:16.600 --> 02:22.100
The Directory Access Protocol, or the DAP, was a directory service kind of at that time.

02:22.100 --> 02:23.920
LDAP is the lightweight version.

02:23.920 --> 02:25.680
That's the L in LDAP.

02:25.760 --> 02:29.780
Between 93 and 97, you have three different versions of LDAP come onto the scene.

02:30.040 --> 02:34.100
In 1998, the Open LDAP Project released Open LDAP.

02:34.100 --> 02:42.180
And then what's important for this presentation is in the year 2000, Microsoft released Active Directory, in which they kind of ensured compliance with LDAP.

02:42.460 --> 02:46.320
So it's important to remember there's a server and client side component here.

02:46.420 --> 02:55.100
So Active Directory, we chose that because it's the most popular, most widely used application service, or directory service application in use.

02:55.100 --> 03:02.340
And so we wanted to make sure all the rules of obfuscation that we were discovering and building would work against an Active Directory server.

03:02.520 --> 03:04.200
So that's the server side component.

03:04.200 --> 03:08.920
You have clients that will issue LDAP queries, or LDAP, what are called search filters.

03:09.040 --> 03:14.740
And LDAP is literally the protocol that allows that exchange of information between the client side and the server side.

03:15.600 --> 03:21.540
On the offensive side, LDAP, or AD in general, is quite a popular topic.

03:21.540 --> 03:30.080
And you look at open source tooling in the last decade, you have things like PowerView from the folks at SpectreOps, BloodHound, SharpHound, SoapHound, any kind of hound, right?

03:30.080 --> 03:36.120
Looking for really quick ways to get information from an offensive perspective, but also for defensive perspectives.

03:36.160 --> 03:53.160
With BloodHound and PingCastle, looking for ways to give defenders quick visibility into attack paths so that they can make better choices and increase the complexity for an attacker just to come in and get a really short path to DA or whatever else they want.

03:53.600 --> 03:59.060
So as defenders, we should then ask, okay, if attackers are using this, what are our data sources for defending?

03:59.520 --> 04:02.740
And so this is actually kind of a point of frustration for us.

04:02.740 --> 04:10.420
When we started this research, even until today, there's not that many options for production-ready telemetry gathering for LDAP search filters.

04:10.660 --> 04:14.640
What we use in our lab environment was Silk ETW by Ruben Boonen.

04:14.940 --> 04:23.900
And actually one of the modules that were released with Mount Adaptive is a telemetry module to allow you to install these things, configure them, so you can have locally that client-side visibility.

04:24.080 --> 04:30.480
And then on the server side, there are options like kind of like debug mode options, but those are not generally recommended to turn on in production.

04:30.640 --> 04:36.680
So if you want this visibility in production, the best case right now is get Microsoft Windows Defender.

04:37.160 --> 04:43.080
CrowdStrike has some stuff I've heard as well, but in terms of like, if you want to just trust the detections they have, cool.

04:43.140 --> 04:47.960
If you want to have all the data so you can validate, then maybe explore your options a little bit.

04:49.180 --> 04:54.840
So another thing to keep in mind is there are big differences between client-side and server-side logs when it comes to LDAP.

04:54.960 --> 05:01.040
For all the hackers in the room, you're going to love client-side logs because it's basically like WYSIWYG.

05:01.040 --> 05:07.080
Like any obfuscation we're going to talk about, you put that in, that's exactly what it looks like in those client-side logs.

05:07.080 --> 05:09.040
Awesome for obfuscation evasion.

05:09.040 --> 05:12.660
With an important caveat, it depends how you're issuing that query.

05:12.940 --> 05:22.540
So a lot of the mechanisms, like the ADDZ accelerator in PowerShell will use the WLDAP32.DLL to route that request.

05:22.540 --> 05:28.380
If that's the case, then the data will show up in an ETW stream for the LDAP provider and you can scoop it out.

05:28.880 --> 05:33.740
However, some folks have noticed there are many other ways to talk to an Active Directory server .

05:34.100 --> 05:42.420
So SOAP Hound is an example from Falcon Force where they said, hey, let's just make SOAP requests directly to the domain controller and avoid any kind of client-side logging.

05:42.680 --> 05:48.940
So because of this, it's still a valuable data source, but it's important to look at the server-side logs as well.

05:49.720 --> 05:54.040
There is significant normalization that occurs in server-side logs.

05:54.040 --> 05:59.980
So a lot of the obfuscation we'll talk about is normalized, but there are still some interesting tricks that do persist.

06:00.680 --> 06:03.100
And yeah, that's all I'll say about that right now.

06:03.920 --> 06:14.620
So over the next 40-ish minutes, we're going to be doing an absolute speed run through all of the obfuscations that we've enumerated and built out for this research.

06:14.620 --> 06:18.020
This is something we've spent over 2,000 hours of R&D on.

06:18.140 --> 06:20.440
For the record, that's too much R&D.

06:20.440 --> 06:21.960
I don't recommend it to anybody.

06:22.040 --> 06:28.180
But here we are, so we're really happy to get this out there and then let our minds think about something else.

06:28.320 --> 06:32.100
And as I mentioned earlier, we're going to be doing a demo and tool release for MAL Adaptive.

06:32.100 --> 06:39.100
And the name comes from MAL Adaptive because typically people would think of LDAP queries as like a pretty simple, rigid kind of a language.

06:39.100 --> 06:41.460
So how flexible can it really be?

06:41.480 --> 06:44.820
And we hope to convince you pretty quickly that it can be pretty flexible.

06:45.540 --> 06:52.460
So with that, let's look at the LDAP overview so we know which pieces of an LDAP search request we're talking about for each obfuscation technique.

06:54.320 --> 07:00.960
So we're going to... let's dive deep into the anatomy of an LDAP search request.

07:00.960 --> 07:03.800
We'll be looking at RFC 4511.

07:04.040 --> 07:22.320
There are many components to an LDAP search request, but we are going to be focused on the four main ones, which is the base object, where in the active directory structure to start the search, the scope that says how far to let the search run, the filter,

07:22.320 --> 07:32.120
which is the logic of what to look for in the directory structure, and the attribute selection, which are the properties that we want to bring back.

07:32.660 --> 07:40.040
As defenders, most people focus on the filter for detecting malicious LDAP queries.

07:40.040 --> 07:44.940
So for this reason, it's also going to be our primary obfuscation focus.

07:44.940 --> 07:51.200
We don't want to overlook also the base object and attribute selection.

07:51.200 --> 07:56.540
So they are going to be our secondary and tertiary obfuscation focus.

07:56.540 --> 08:01.880
As filter is the main one, let's see what makes up a filter.

08:01.880 --> 08:04.320
So well, it's made up of tokens.

08:04.320 --> 08:15.600
There are five required tokens that we have group start and group end, the hold in the middle, the attribute and the value for it, and the comparison operator.

08:15.620 --> 08:19.700
So here, for example, we are looking, I'm looking for myself, basically.

08:20.740 --> 08:28.320
There are also two optional tokens, which is boolean operator and extensible match filter.

08:28.420 --> 08:32.260
Debo is going to talk about these in the upcoming slides.

08:32.260 --> 08:35.000
But just so you know, these are bitwise values.

08:35.000 --> 08:40.920
They have different meanings based on the attributes, and Microsoft documents all of these per attribute.

08:41.060 --> 08:45.640
So different numbers mean actually different things to different attributes.

08:48.200 --> 08:53.660
In this one, basically, we're looking for objects that are not disabled, let's say.

08:53.780 --> 08:57.520
Most people actually do not write simple filters like this.

08:57.520 --> 09:05.300
They do try to combine multiple filters, and they do that with a boolean operator to create a filter list.

09:08.490 --> 09:15.750
So it's not going to look actually as a pretty tree just like this one, but it's a single row, usually.

09:15.790 --> 09:26.910
So it's going to be composed of two filters, which together they make up a filter list, and the whole string is actually called a search filter for an LDAP search request.

09:28.910 --> 09:30.010
Uh-oh.

09:30.010 --> 09:30.650
Sorry.

09:30.970 --> 09:33.790
No, we don't don't need help with PowerPoint transitions.

09:33.950 --> 09:35.090
Moving on.

09:37.870 --> 09:38.650
Hold on.

09:38.750 --> 09:41.970
It looks like you could use some help with crowd work.

09:42.650 --> 09:43.350
Hilarious.

09:43.350 --> 09:44.370
Oh, Clippy.

09:44.450 --> 09:46.510
I have trivia and jokes.

09:46.510 --> 09:46.950
I don't know.

09:46.950 --> 09:48.090
I could use that on a Sunday morning.

09:48.090 --> 09:48.890
How about y'all?

09:49.990 --> 09:53.430
What do you call the biggest LDAP search request in history?

09:54.050 --> 09:55.030
Any takers?

09:55.850 --> 09:58.670
It's pronounced ten and a half megabytes.

09:59.190 --> 10:01.570
Because that's the limit for a search request.

10:02.210 --> 10:04.830
Now, Clippy actually comes armed with sources.

10:05.170 --> 10:07.790
But just know that that's a lot of data.

10:07.930 --> 10:10.150
And keep in mind, LDAP is not just for querying information.

10:10.150 --> 10:11.690
It's also for updating records.

10:11.690 --> 10:20.450
But for the purpose of recon, I encourage anybody in this room to issue something even close to ten and a half megs and see how much shows up in your logs.

10:21.330 --> 10:22.250
All right.

10:22.290 --> 10:23.050
Thanks, Sabi.

10:23.050 --> 10:29.790
So now that we had a good idea of the different components of LDAP that we're going to be looking at, let's actually do the fun stuff of obfuscation.

10:30.650 --> 10:35.150
For all the defenders in the room, it's going to get dark and bleak before it gets bright again.

10:35.150 --> 10:37.690
But we promise there is a light at the end of the tunnel.

10:38.470 --> 10:46.410
So as Sabi mentioned, the filter is going to be the primary obfuscation focus because it really is kind of the primary defensive detection focus today.

10:46.450 --> 10:48.710
And we're going to spend most of our time on the filter.

10:48.710 --> 10:54.770
And then a lot of the techniques that work on the filter will then be applied to the base object and attribute selection as well.

10:55.190 --> 10:59.690
There's a lot of things that we discovered that are not documented.

10:59.850 --> 11:01.230
Some of it was sheer luck.

11:01.230 --> 11:02.430
Some of it was brute forcing.

11:02.430 --> 11:09.990
Some of it was the fact that when you build an obfuscation framework, you're kind of defining the boundaries of a language and it's going to break out sometimes and teach you things that still work.

11:10.450 --> 11:16.630
And so we'll try to mention things that are undocumented and then also put this undocumented icon at the top.

11:17.010 --> 11:24.630
So we're going to start by looking at these five tokens and looking at obfuscation that can be applied to each, beginning with the attribute token.

11:27.150 --> 11:32.390
So let's see how what we can do to obfuscate the attribute.

11:32.390 --> 11:34.150
We can actually do casing.

11:34.150 --> 11:37.090
It is case sensitive, so we can play with it.

11:37.490 --> 11:42.410
We can use object, OID object identifier.

11:42.490 --> 11:56.870
OID object identifier, Microsoft defines it as a dotted string of numbers, which is actually quite true because you can also add this OID prefix at the beginning of it and it's still going to work, which is also case sensitive.

11:57.110 --> 12:08.410
Another thing that is really fascinating and undocumented is that we can add prefixes of zeros to each octet on this part and it executes just fine.

12:08.410 --> 12:12.070
It will also show just like this also on client side logs.

12:12.450 --> 12:18.010
Another thing we can do for attribute obfuscation is ambiguous name resolution.

12:18.150 --> 12:20.950
So the same applies as above.

12:20.950 --> 12:26.510
So we can use insensitive casing and OID notation even for the ANR.

12:26.510 --> 12:28.850
But what is exactly ANR?

12:28.850 --> 12:44.730
So in case you know some name, but you don't know in which property it actually is, you can search and what it would actually do depending on the version of active directory, it will logically transform this single term into this query.

12:44.850 --> 12:52.090
So basically everything is ended in a wildcard, except for some attributes that do not support this.

12:52.350 --> 13:03.970
And in case your search actually contains a space just like us, we're looking for domain admins, then it's going to be added another this one.

13:03.970 --> 13:09.490
So these four ones because it will treat it as a first name, last name, last name, first name.

13:10.350 --> 13:12.370
Some nice obfuscation tricks.

13:12.370 --> 13:16.790
So we can use ANR, for example, if we're trying to search for curb TGT.

13:17.050 --> 13:22.170
And we can also use which is the second example, only the some parts of it.

13:22.170 --> 13:24.770
And it's going to be an explicit wildcard.

13:24.770 --> 13:30.710
So we'll still even on the second example, we're still going to have the same results.

13:30.710 --> 13:42.650
And the third example, which is very nice, we actually discovered that if you add an implicit wildcard, after that, everything you add is going to be ignored.

13:42.750 --> 13:48.530
So you can play with it, but you're still going to be to get the result of ANR.

13:48.550 --> 13:51.870
And return the curb TGT.

13:52.370 --> 13:57.230
And just as this also going to be handled from our detection framework.

13:57.490 --> 14:10.270
If you don't want to do all the crazy stuff with a wildcard, and just be explicit, you can actually just add an equal sign, which is document the which is the documented way to get the information.

14:11.290 --> 14:19.890
As a recap for attribute obfuscation, we can do casing, object identify notation, and ambiguous name resolution.

14:21.150 --> 14:22.910
Ah, Clippy again.

14:23.110 --> 14:26.350
Do you know where else ambiguous name resolution exists?

14:26.350 --> 14:27.890
We don't know Clippy.

14:27.890 --> 14:28.810
Where?

14:29.030 --> 14:34.830
Microsoft, what is more ambiguous than resolving to rename your products every six months?

14:34.830 --> 14:35.730
Am I right?

14:37.050 --> 14:40.050
I did not know Clippy was allowed to make Microsoft burns.

14:40.050 --> 14:41.290
I don't know if that was cleared.

14:41.310 --> 14:42.770
Thanks, Clippy.

14:43.130 --> 14:44.690
So one token down.

14:44.690 --> 14:46.090
We've talked about attributes.

14:46.170 --> 14:48.050
Next, we're gonna look at the comparison operator.

14:48.130 --> 14:50.270
Most of the time, this is an equals sign.

14:50.290 --> 14:57.570
When it comes to Active Directory's implementation of LDAP, you also have the approximately equal to because casing doesn't matter.

14:57.570 --> 15:03.630
But it does prevent you from using the wildcard and hex characters that we'll be talking a lot more about later.

15:03.630 --> 15:05.930
But we're really going to focus on the range operator.

15:05.930 --> 15:08.370
So greater than equal to less than equal to.

15:08.410 --> 15:17.030
So here's an example a lot of red teamers would be familiar with service principal name equal star means give us the objects that have an SPN, any value, I don't care, but it must be defined.

15:17.090 --> 15:30.770
Well, technically, we could rewrite this with a string operator and say, hey, make sure it's present, it has a value that is greater than or equal to the alphabetical sorting of a string that begins with equals, or the exclamation point , or is less than ZZZ.

15:30.950 --> 15:36.030
So there are other ways logically that you can accomplish this equivalence, this presence filter .

15:36.810 --> 15:46.150
One really important note, if you think about the printable range of ASCII characters, this is the proper ordering that we all know and love and have agreed upon as a standard as an industry.

15:46.230 --> 15:53.410
We do not know why, but there is an abnormal range or sorting for strings in Active Directory casing doesn't matter.

15:53.410 --> 15:54.110
So we get rid of those.

15:54.110 --> 16:01.710
But you have all of the digits and alpha characters at the end, you have this very specific grouping of special characters, and then all the other characters fall right into the middle.

16:01.710 --> 16:07.870
This took us probably five days to find because it only occurred this bug only occurred like one out of 1000 iterations.

16:07.950 --> 16:10.550
But this is the ordering.

16:10.550 --> 16:14.350
So our obfuscation framework handles that, but just know it's kind of weird.

16:14.610 --> 16:18.390
Another thing we can do is use the range filters for precise values.

16:18.390 --> 16:21.690
So SAM account type equals this number ending with 368.

16:21.690 --> 16:23.130
This is another bitwise value.

16:23.130 --> 16:25.470
But let's say that detections were looking at this.

16:25.470 --> 16:34.070
Well, you could also instead of saying ends with 368, say greater than equals to 7, less than equal to 9, and then specifically exclude the 7 and 9.

16:34.070 --> 16:35.850
So logically, you're left with an 8.

16:36.010 --> 16:39.910
If you're like me and are more visual person, I like to think of it as a timeline.

16:40.370 --> 16:45.470
And so greater than equal to 7, less than equal to 9, and then let's just pop off the 7 and 9.

16:45.470 --> 16:46.850
So you're left with the 8.

16:47.170 --> 16:53.790
There are a lot of kind of flavors or recipes we built into the obfuscation module, showing a couple of them here.

16:53.790 --> 16:56.790
One of my favorites is actually using ranges for exclusions.

16:56.990 --> 17:04.310
In this last example, where you can say give me the presence filter, but then exclude everything outward and inclusive of the numbers 7 and 9.

17:04.310 --> 17:05.230
So you're left with 8.

17:05.230 --> 17:09.350
So again , those are all random options in the obfuscation filter, the obfuscation module.

17:09.350 --> 17:10.550
This works for numbers.

17:10.550 --> 17:14.310
It also works for strings with a caveat that suffixes are a little tricky.

17:14.730 --> 17:18.710
But yeah, it is still quite effective for those things.

17:18.710 --> 17:30.510
So in review for the second token type of comparison operator, we have approximately equal to, we have the logical equivalence for the presence filter, and then we can use the range operators to do some really fun stuff for precise values, whether they're strings or numbers.

17:30.670 --> 17:37.530
And defenders should be pretty familiar with some of these we just looked at because it's actually part of the Sharp Hound project.

17:37.990 --> 17:40.210
So that same account type, service principal name.

17:40.210 --> 17:47.230
So again, these are pretty relevant examples, and you can see that if a detection was looking for this, it would probably get smoked by what we just showed you.

17:48.450 --> 17:51.070
So the third token type is the Boolean operator.

17:51.070 --> 17:56.830
Mostly we think of ands and ors, but when it comes to LDAP, the not is where things get really crazy really fast.

17:57.290 --> 17:59.150
So let's take a really practical example.

17:59.150 --> 18:01.230
Let's say you're looking for country equals Albania.

18:01.230 --> 18:03.770
You want to have all those objects that come out of Active Directory.

18:03.930 --> 18:11.430
One thing you can do is just throw a bunch of Boolean operators inside of it, and logically it doesn't matter if you and and or one thing, it's still going to be that same one thing.

18:11.510 --> 18:14.190
Additionally, you can also put in double negation.

18:14.250 --> 18:18.970
Again, logically this is still going to give you country equals Albania, the same number of objects.

18:20.430 --> 18:26.250
Additionally, if you wanted to do a Boolean operator, you can technically slide it right inside of the filter itself.

18:26.250 --> 18:36.230
So in this case, if we're looking for location equals Kukic, which is a city inside of Albania, you can see that bottom example, that Boolean is sitting directly inside of the group start, group end filters or tokens.

18:36.350 --> 18:47.770
In our parser that we wrote for this research, we handle this similarly, but do call out the distinction because it is extremely important for certain kinds of detections, as well as obfuscation and deobfuscation scenarios.

18:47.950 --> 18:51.790
Most of the time, though, you're dealing with a slightly more complex filter like this.

18:51.790 --> 18:58.750
So this is saying, I want to know when the country is Albania, and either the location is Kukic or Tirana, two cities.

18:58.990 --> 19:03.170
It's important to know that the Boolean operator has kind of a scope of influence.

19:03.170 --> 19:07.810
So in this case, there are two Booleans, and you can see the boxes around the filters that they affect.

19:07.810 --> 19:10.710
If we added in a third set, there are now three groups.

19:10.710 --> 19:18.350
And so as we're parsing it, we basically create a stack of Boolean operators to know exactly how many Booleans are affecting the filter that we're looking at.

19:18.550 --> 19:22.090
One really, really fun feature is the not Boolean operator.

19:22.090 --> 19:23.410
So let's slide that in there.

19:23.410 --> 19:28.750
The not only affects the first filter or the first Boolean operator that it modifies.

19:28.830 --> 19:36.750
So we can see location equals Kukic is modified by that not, but the filter just below it is completely, it doesn't modify it at all.

19:36.750 --> 19:45.950
So this is another one that we have to track, as well as a lot of crazy things like negation, traversal, because you can have lots of layers in between, and you have to track the Booles all the way.

19:45.970 --> 19:46.870
Lots of fun.

19:46.870 --> 19:48.130
Honestly, a lot of headaches.

19:48.490 --> 19:51.730
But yeah, it's built into the parser, so we don't have to think about that anymore.

19:51.730 --> 19:53.650
And we'll see that in the demos towards the end.

19:54.310 --> 19:58.610
My personal favorite obfuscation technique with Boolean operators is logical inversion.

19:58.650 --> 20:07.550
So for any math nerds in the house, this is known as DeMorgan's law, but basically not A or B is the same as not A and not B with the inverse sitting below.

20:07.570 --> 20:12.050
So what you can do is take any LDAP search filter, choose a spot and negate it.

20:12.050 --> 20:13.910
In this case, we're going to choose the whole filter.

20:13.930 --> 20:18.370
And now everything else kind of to the right of that is going to be in scope for obfuscation.

20:18.470 --> 20:24.050
So step number two is identifying within that in scope section, all the ands and ors and inverting them.

20:24.310 --> 20:28.930
And then the third step is locating all the filters and inverting them from a negation perspective.

20:28.930 --> 20:30.410
So none of these filters are negated.

20:30.410 --> 20:33.130
So we're going to add that not and those are now negated.

20:33.210 --> 20:36.550
Now, this is logically the same as what we started with.

20:36.650 --> 20:39.530
Again, this is a lot of headaches if you're parsing this manually.

20:39.730 --> 20:43.830
And so in the parser, we basically have a concept of what's the logical inclusion ?

20:43.830 --> 20:45.030
Is this included, true or false?

20:45.030 --> 20:46.530
What's the logical Boolean?

20:46.530 --> 20:47.470
Is it and or?

20:47.470 --> 20:51.350
And we also maintain a stack of all those Boolean operator tokens for your convenience.

20:51.590 --> 20:59.550
So interview for the third token type of Boolean operator, we have the additive nature, double negation, and then DeMorgan's laws for the Boolean operator inversion.

21:01.170 --> 21:02.170
Oh, goodness.

21:02.170 --> 21:02.590
Okay.

21:02.630 --> 21:05.410
What is my least favorite LDAP token type?

21:05.430 --> 21:08.510
I'm assuming Boolean operator, but let's see what happens here.

21:08.930 --> 21:12.550
Yep, Boolean operator, because I'm afraid of getting tied up in knots.

21:12.770 --> 21:14.670
Oh, that's cringe, Clippy.

21:14.770 --> 21:15.990
Clippy's losing steam fast.

21:15.990 --> 21:16.910
Yeah, get that out of the way.

21:16.910 --> 21:17.550
Okay.

21:17.670 --> 21:20.270
All right, the fourth token type extensible match filter.

21:20.470 --> 21:21.590
So Sabi mentioned this before.

21:21.590 --> 21:24.070
This is for attributes that have bitwise values.

21:24.070 --> 21:32.290
It's an integer number, but it actually represents a base two add-ins for all the bitwise flags based on which attribute that it is.

21:33.050 --> 21:44.670
So it is, there are four values that are supported by the by active directories LDAP implementation, we're going to focus on the first two, because they're the most interesting in terms of obfuscation.

21:44.670 --> 21:46.230
And that's the and and the or.

21:46.290 --> 21:49.510
For me, I remember the or because it ends with dot 804.

21:49.510 --> 21:52.850
So 804 is or 803 is not or.

21:53.870 --> 21:55.390
All right, so here's an example.

21:55.390 --> 21:58.730
User account control, and you can see in the red is the extensible match filter.

21:58.830 --> 22:06.030
In this case, it's an 803, so that's an and, and it's the number 515, which is the base two add-ins 1, 2, and 512.

22:06.090 --> 22:08.870
So one of the things we can do is what we've called bitwise breakout.

22:08.890 --> 22:12.330
So we can break that 515 out into 1 and 514.

22:12.330 --> 22:16.170
Again, as long as we have the proper grouping of add-ins, we can do this.

22:16.290 --> 22:18.410
514 is actually 2 and 512.

22:18.410 --> 22:20.250
So we can break that out even further.

22:20.390 --> 22:25.590
So from a detection perspective, we can spread our logic across many different filters, which is really, really complicated.

22:26.510 --> 22:27.890
But it's also fun.

22:27.990 --> 22:30.610
If you started with an or, the same trick applies.

22:30.610 --> 22:35.710
Just make sure that the Boolean operator you add is an or instead of an and and that it matches the extensible match filter.

22:36.990 --> 22:41.130
This is a pretty trivial example, but a lot of real world examples can get pretty crazy.

22:41.130 --> 22:43.550
Like this is a git domain user from PowerView.

22:43.610 --> 22:44.570
Massive number.

22:44.570 --> 22:51.470
You can imagine all the random groupings and regroupings of base two add-ins to produce the same value in your overall search filter.

22:53.190 --> 22:56.930
So another thing we can do is if you have a filter that is a precise value.

22:56.930 --> 23:01.090
So this is looking for the exact ones and zero set to equal this number.

23:01.410 --> 23:04.450
What you can do is use this little formula.

23:04.450 --> 23:08.350
You can add the extensible match filter of and for all the one bits.

23:08.350 --> 23:14.450
You can add the or extensible match filter for all the zero bits and negate it and then and both of those filters together.

23:14.970 --> 23:24.430
What's really cool about this is now we have extensible match filters and we can use the first breakout type to break those into smaller and smaller random groupings of those base two add-ins.

23:24.430 --> 23:30.570
So we're not going to take this further, but this could explode into 10, 15, 20 different filters all slammed together.

23:31.170 --> 23:40.810
So interview for the fourth token type of extensible match filter, we have the bitwise breakout with and and or and then also the precise breakout, which kind of combines the second one with the first one.

23:43.770 --> 23:45.190
Thanks, Thibaut.

23:45.610 --> 23:49.490
Let's look at what we can do to obfuscate a little the value.

23:49.490 --> 23:51.470
We are still in the filter section.

23:51.530 --> 23:58.590
So excluding a couple of attribute types, just like seeing here, it is still casing doesn't matter.

23:58.590 --> 24:00.110
So it's case sensitive.

24:00.810 --> 24:07.870
And we can also do prepended zeros to anything that are bitwise digits or numbers.

24:08.430 --> 24:21.090
And we got some undocumented feature regarding timestamps is that we originally noticed that sometimes milliseconds were present, but it didn't actually seem to matter.

24:21.090 --> 24:33.130
If you change the millisecond values or remove them, it turns out you can add actually add literally anything as long as you have a capital Z in it.

24:33.130 --> 24:39.790
So and technically, it is going to be treated still as a correct timestamp in the results.

24:39.790 --> 24:53.710
And it doesn't need to be only capital Z, it can also be it's hex encoding representation, which leads us to the next point, which is hex encoding for value obfuscation.

24:53.950 --> 25:06.890
And it's our favorite thing to do to be honest, the hex encoding itself, it exists to be able to to escape certain special characters, which Microsoft has detailed here very well.

25:06.890 --> 25:11.750
But you can also escape any printable characters that you want to as well.

25:12.170 --> 25:19.290
So you can swap these with the hex representations, and it's still going to be to give you the same results.

25:19.290 --> 25:23.030
And it's going to show just like this on the client side logs.

25:23.310 --> 25:28.970
Again, our parser, our parser parses codes decodes all the values.

25:28.970 --> 25:31.510
So it's all being handled.

25:32.050 --> 25:42.850
One undocumented thing is that Microsoft says that the hex representation should be followed by two characters representative SK hex character.

25:42.850 --> 25:50.510
But that's actually not true for the first 16 characters, you can drop the leading zero and it's still going to work.

25:51.190 --> 25:55.450
Wildcards, we mentioned a little bit even on the wildcards.

25:55.490 --> 26:03.310
So for example, instead of looking for the curb TGT, you can also just look for RBG and see what you get.

26:04.730 --> 26:11.590
These actually for wildcards, we are not the only ones who have been looking for evasion purposes.

26:11.590 --> 26:25.050
So even the researcher Hope Walker, these are two very well great posts blog posts recent, it's a researcher at specter ops, and she outlines using wildcards for evasion purposes.

26:26.570 --> 26:33.970
As a recap , for value, we can do casing, we can do prepended zeros , timestamps, hex encoding, and wildcards.

26:34.870 --> 26:38.610
The good news is that's all you can do with obfuscation.

26:39.030 --> 26:41.990
Nah, I'm lying, you guys, we got much more.

26:42.350 --> 26:46.370
So until now, we actually were looking for top and obfuscation.

26:46.370 --> 26:48.730
Let's see outside of it a little.

26:49.350 --> 27:01.430
And for example, for filter wide obfuscation, you can actually add group start and group end, as long as as much as you want, as long as you stay until the depth of 99.

27:01.610 --> 27:07.250
You can also add white space all over, and it is significant.

27:07.270 --> 27:10.370
And it can be new line, tab, etc.

27:10.670 --> 27:27.250
Garbage filters, again, need here actually you need to be careful if you're looking for if you're actually using logical or or logical end, because in case you're looking for logical end, you need to make sure the properties exist.

27:27.250 --> 27:29.950
But you can go crazy with ours.

27:30.270 --> 27:33.910
And lastly, is filter filter reordering.

27:34.410 --> 27:38.530
So until now, we only handled the filter.

27:38.530 --> 27:41.270
Let's see what we can do with base object.

27:42.230 --> 27:46.530
As a reminder, the base object is where in the active directory.

27:46.530 --> 27:54.870
So structure, we want to see we want to start the search, there are some good detection opportunities that we feel aren't discussed as much.

27:54.930 --> 28:04.130
And for example, like some offensive tools, just like certify, they have a very benign common and super search, super common search filter.

28:04.170 --> 28:17.770
So in this case is the base object, and it's looking for public key services, we are going to focus from a syntax perspective on a simple, really simple object like this.

28:18.050 --> 28:37.370
All the tricks we've seen until now, okay, for example, they still work, which is the casing, we can play, you can do also the hex encoding for the value portion, you can use the ID notation of the attributes, and also supports the ID prefix as well as your prefix.

28:38.530 --> 28:46.950
And white space, it actually can be added at the end, as well as between the slashes of the LDAP prefix.

28:47.770 --> 29:07.630
Something interesting is that it's true for the base object, but not for the value in the filter is that as long as hex is not present, you can actually encapsulate it with double quotes, and it will show up this way in client side logs, but it's not going to look like this on server side logs.

29:08.990 --> 29:11.970
Lastly, is the attribute selection.

29:11.970 --> 29:17.030
Basically, it's which attributes properties do you want to be returned in the results.

29:17.390 --> 29:37.570
And here also, casing doesn't matter, you can substitute just like previously, you can also use object identifier notation, also supports adding OID prefix and prepended zeros, add white space only after the attributes that are on the OID syntax.

29:37.570 --> 29:41.310
Not sure why, but yeah, a lot of trial and error, to be honest.

29:41.450 --> 29:49.650
We have the option also to add duplicate attributes, and garbage attributes, literally anything you want.

29:50.790 --> 29:56.150
And the person who's going to answer about this is no one else than Clippy.

29:57.070 --> 30:00.090
Hey, Daniel, what do you call this character?

30:00.270 --> 30:02.570
Asterix, wildcard or splat?

30:03.710 --> 30:05.870
I think this is an ages question.

30:05.870 --> 30:07.890
But all three are true.

30:07.890 --> 30:10.070
But there's a lot of space down there.

30:10.070 --> 30:11.610
So let's see what Clippy has to say.

30:12.010 --> 30:13.530
F, all the above.

30:13.530 --> 30:17.370
So two more important things here is from an input perspective and the attribute selection.

30:17.490 --> 30:25.150
If the only value defined is a wildcard, it will return all the properties, even just the same as if you don't define any attribute selection.

30:25.150 --> 30:33.090
What's fascinating is that in the server side logs, that wildcard is going to literally be printed as the string square brackets, all A-L-L, all lowercase.

30:33.310 --> 30:44.830
Now, if you'll notice, E is that if you have a list of attributes, and any one of those is a wildcard, then it will, the server side logs will translate that wildcard into this other string all with list.

30:44.990 --> 30:53.550
If you are, and you should be, if you are parsing these attribute selection values, you need to know that this weird string is prepended to the first attribute.

30:53.550 --> 30:58.490
So you have to do a really specific split and translation that we that we do in the logging module.

30:58.490 --> 31:00.670
But just know there's some weirdness that goes on there.

31:01.150 --> 31:02.170
Thanks, Clippy.

31:02.590 --> 31:05.970
All right, now that is actually the end of the obfuscation portion.

31:05.970 --> 31:09.830
So we've talked about the search filter, we've talked about the base object, the attribute selection.

31:09.830 --> 31:12.710
So for all the defenders in the room, what now?

31:12.730 --> 31:16.770
So from a solution perspective, we're going to focus on three steps.

31:16.770 --> 31:21.270
One is parsing, two is enriching, and then three is the actual detection itself.

31:21.550 --> 31:26.630
So from a parsing perspective, when we started this research, there was no parser for LDAP search filters.

31:26.870 --> 31:29.330
And so we naively said, let's just build a parser.

31:29.330 --> 31:30.410
How hard could it be?

31:30.410 --> 31:36.490
To be honest, that was over half of the research, but it was one of the most interesting and fulfilling parts of this.

31:36.490 --> 31:40.690
And so we wrote a C sharp state machine parser to firstly do tokenization.

31:40.690 --> 31:44.650
So that means when you have a string come in, that's the entire search filter, let's break it into tokens.

31:44.650 --> 31:48.310
So we know which ones are attributes, values , comparison operator, etc.

31:48.330 --> 31:57.650
Next, you want to organize those tokens into a representation that allows you to understand the structure of nested Boolean operators and filters and filter lists and all those sorts of things.

31:57.650 --> 32:01.090
And then you can move on to actual enrichment, which is step number two.

32:01.090 --> 32:11.550
So here's an example of using all the conversion modules within Mount Adaptive to start with a string, break it into tokens, and then every step of the way, we try to decode and enrich however much we can.

32:11.550 --> 32:15.190
So as Sabi mentioned, when there are hex values, we'll automatically decode them for you.

32:15.190 --> 32:18.270
But we leave the original syntax as well.

32:18.390 --> 32:32.070
One distinction between... so in our parsing, we do tokenization, and then we basically create a parse tree or a syntax tree, which is almost an abstract syntax tree, but we drop the abstract part because abstract says, let's drop things that don't need to be there,

32:32.070 --> 32:33.790
like insignificant white space.

32:33.870 --> 32:36.290
Well, by definition, obfuscation doesn't need to be there.

32:36.290 --> 32:41.990
So we actually want to keep all those insignificant things so we can recreate the input from that parse tree.

32:42.250 --> 32:55.250
And then after we break this into tokens and do those enrichments, we'll then group them into filters and branches and a tree structure to do certain kinds of obfuscation and detections that require that kind of tree grouping functionality as we go through and parse it.

32:55.430 --> 32:57.810
And then the final step is actually detect.

32:57.810 --> 33:00.050
So we try to make it as simple as possible.

33:00.050 --> 33:03.130
We wrapped all this inside of a single function called find evil.

33:03.310 --> 33:06.250
So you can pipe any number of search filters you want into find evil.

33:06.250 --> 33:10.090
And for each of those filters, it will parse it, do all the enrichment we just talked about.

33:10.090 --> 33:14.170
It will run it through all our complete detection rule set, which we are releasing with maladaptive.

33:14.170 --> 33:15.850
So 65 rules and counting.

33:16.010 --> 33:22.010
And then for each of those detections, the rule carries with it a dynamic score or weight, if you will, as well as an explanation.

33:22.010 --> 33:24.330
So it'll give you an example of what kind of thing it's looking for.

33:24.330 --> 33:31.650
And then it will actually show you the specific part of your search filter that flagged on that rule, as well as in the name, you can see.

33:31.650 --> 33:33.250
It'll actually pull out specific values.

33:33.250 --> 33:39.230
So it should be really colorfully obvious, as you'll see in the demo, of exactly why this thing was flagged for this rule.

33:39.390 --> 33:44.030
And if you look at the bottom, as I said, we spent over half the time just building this parser.

33:44.190 --> 33:49.770
We wrote and rewrote every piece of this parser two to three times to make it as fast as we possibly could.

33:49.910 --> 33:59.350
And in this example, we're parsing this search filter 100,000 times, doing full parsing, full detections, and it's clocking in at just under 4.4 seconds.

33:59.390 --> 34:01.590
And that's on a moderately spec laptop.

34:01.610 --> 34:05.990
Because we know that the number, the volume of search filters in production environments is massive.

34:05.990 --> 34:08.970
And so we wanted this to be really usable right out of the box .

34:08.970 --> 34:12.850
Oh, and shout out to Olaf Hartung at Falconforce.

34:12.850 --> 34:23.370
He was really instrumental in taking all these rules for us and running them multiple times across his entire client data set, since we don't have that data set, and then giving us feedback and stats on, hey, which rules need to be tuned a little bit .

34:23.370 --> 34:25.310
So, Olaf, if you're watching, thanks so much, buddy.

34:25.310 --> 34:26.150
We really appreciate it.

34:27.070 --> 34:31.870
So instead of talking more about the solution, let's go into the last section and actually just show a demo.

34:32.330 --> 34:35.210
If you haven't picked up on it by now, we really like to have fun.

34:35.210 --> 34:40.910
When you spend 2,000 hours on something, you have to trick yourself into being motivated, so we added colors however we can.

34:41.250 --> 34:47.370
This is our ASCII art, and it's actually a fully functioning LDAP query that will return any object that has a name property.

34:48.470 --> 34:49.630
Clippy seems to like it as well.

34:49.630 --> 34:53.190
I can't tell if he's hanging out or trying to eat the terminal or what's going on.

34:53.510 --> 34:59.710
So in the first example, this is that Albania, Cucos, Tirana filter example with a little bit of obfuscation.

34:59.750 --> 35:04.590
So if we tokenize it, we can see it breaks out which things are attributes, values, et cetera.

35:04.590 --> 35:10.170
If we do the enriched tokens, we can now see it says, hey, this is a defined attribute, and it translates to the letter L.

35:10.170 --> 35:12.490
And we have these other context objects as well.

35:12.490 --> 35:16.270
So if we look at the context object, remember this is things like the Boolean operator.

35:16.270 --> 35:21.010
We group all these things into filters so that we can write detection logic against the entire filter.

35:21.010 --> 35:25.490
So we can easily access the string values, but then we have a dictionary and list of the full token objects.

35:25.490 --> 35:28.870
So all the metadata nested from tokenization we can find in the filter.

35:29.030 --> 35:33.810
And then if we look at the context object for the Boolean operator, we'll see this is a logically inclusive filter.

35:33.870 --> 35:37.810
This is tracking that full stack of Boolean operators that you still have direct access to.

35:37.810 --> 35:41.110
And then every single value goes through the full value parsing.

35:41.110 --> 35:42.830
So any hex characters are parsed.

35:42.830 --> 35:46.050
At any time, you can look for the raw content or the decoded content.

35:46.110 --> 35:51.610
Pipe that into Find Evil, and we can see these are the individual rules that matched for this particular search filter.

35:51.670 --> 35:53.110
This is just showing a couple properties.

35:53.110 --> 35:56.850
In the next demos, you'll see a little better view of the entirety of the rules.

35:57.810 --> 36:00.650
Let's do another parsing example, this time using the bitwise value.

36:00.650 --> 36:04.550
So remember all the bitwise breakout where like 515 can be 1 , 2, 5, 12?

36:04.650 --> 36:11.530
Well, here's a rule that flag and says, hey, if user account control attribute has the flag 128 set to true, then flag this alert.

36:11.530 --> 36:24.890
I won't go into the details of why that's an interesting detection, but what we want to show you is when we parse this value, we automatically know this is a bitwise attribute, and we parse the value to get those base two add-ins, either in a dictionary format or a list format.

36:24.890 --> 36:28.430
So you can immediately write detections for combinations of true and false.

36:28.430 --> 36:39.710
Now keep in mind, this is per filter, so that breakout stuff does complicate it a bit, but you can at least extract the flags and aggregate it back together for your final detections across the entirety of the search filter.

36:40.470 --> 36:45.370
The last parsing example is looking for some actually kind of crazy stuff.

36:45.370 --> 36:48.850
So decoding hex characters in this first example, that's easy sauce.

36:48.850 --> 36:50.910
So this is trusted domain, easy detection.

36:50.910 --> 36:57.310
But when it's things like wildcards, they're actually missing characters, so we can't precisely say what the person was looking for.

36:57.310 --> 37:11.710
But in our detection module, you have the ability to define strings of interest, like curbtgt, domain admins, domain controllers, and the parser and the detection rules will go through and actually expand the wildcards and say, hey, does this wildcarded string match any of your sensitive terms?

37:11.710 --> 37:18.050
And that also handles the two ANR scenarios that Sabi mentioned earlier, with the implicit wildcard or the explicit wildcard.

37:18.150 --> 37:26.530
So yeah, those are some really fun detections that go beyond just pure deobfuscation, but really kind of logically looking at some suspicious strings of interest.

37:27.390 --> 37:35.070
And finally, we've put all this together into a colorful interactive menu to make it fun to explore.

37:35.070 --> 37:46.790
We can test our input, the LDAP search filter, and we can explore the obfuscation menus for all the techniques we covered in this presentations.

37:46.870 --> 37:49.710
Wildcards are also supported.

37:50.730 --> 37:55.670
We can add obfuscation layer by layer, and we can also remove it.

37:55.670 --> 38:01.670
And if you're lazy, you can use all wildcards to randomly apply all the options.

38:02.530 --> 38:04.730
Let's test again.

38:05.210 --> 38:07.870
The search filter still works.

38:07.870 --> 38:18.200
Detection module is built in and findevils shows a full summary of detections, scores, explanations, and more colors.

38:19.090 --> 38:24.430
Lastly, if you don't like interactive menus, we have full CLI support.

38:24.430 --> 38:34.470
So the interactive menu lets you randomly choose ingredients, and you can copy out the receipt for non interactive user.

38:34.530 --> 38:40.730
All the pictures for pretty printing and detection summaries are also available via CLI.

38:49.930 --> 38:50.790
Thank you.

38:50.950 --> 38:52.910
It's always awkward in blue teamer talks.

38:52.930 --> 38:54.210
Was that a shell ?

38:54.210 --> 38:55.410
Do we clap or not?

38:55.970 --> 38:58.190
Our apologies for not including a dramatic pause.

38:58.710 --> 39:00.550
Hopefully that was fun for everyone.

39:01.510 --> 39:02.850
We're almost done here.

39:02.850 --> 39:12.230
We just want to reiterate that Sabi and I are both defenders, and from the very beginning of this research, we knew that we had not seen people talking about this, and to be honest, attackers didn't really need this help.

39:12.230 --> 39:17.250
So why hand them a fully loaded machine gun when defenders still often don't even have the telemetry in the first place?

39:17.250 --> 39:19.130
So from the very beginning , we weren't strong armed.

39:19.130 --> 39:23.150
We decided that we wanted to release this in a unique kind of two-stage approach.

39:23.150 --> 39:28.010
So today what we've released is everything we've talked about, minus the obfuscation module.

39:28.110 --> 39:36.450
We're releasing a corpus of 1,337 benign obfuscated examples, so you only have to run our code to look at examples of obfuscated search filters.

39:36.850 --> 39:43.670
For anyone who's really ambitious, you have the full parser, and the deobfuscation modules look suspiciously like the obfuscation ones.

39:43.670 --> 39:45.550
So if you want to do a little bit, go for it.

39:45.550 --> 39:51.770
But just keep in mind, we spent over 1,000 hours on the obfuscation module, so there is a heck of a lot of craziness that we put in there.

39:51.890 --> 40:06.530
Our goal, pending a CFP response, is hopefully by the end of this year, to do a part two of this presentation to focus really deeply on all the differences in client and server-side logging, a lot of the weird scenarios we had to build into the parser to support all of this,

40:06.530 --> 40:09.750
and then at that point, releasing the obfuscation module.

40:10.670 --> 40:12.610
So yeah, just want to make that really clear.

40:12.610 --> 40:15.210
That's clear on the GitHub, which will be on the last slide as well.

40:15.210 --> 40:22.930
But again, as defenders, we wanted to try to be as creative as possible and help defenders not be completely throwing tomatoes at us up on the stage.

40:22.930 --> 40:24.890
And we made this very clear in the CFP process.

40:24.890 --> 40:26.610
Big red text, no surprises.

40:26.610 --> 40:30.510
So we're really happy that there was support in us doing that kind of a release.

40:30.810 --> 40:35.090
So the final takeaways, LDAP is still widely used by attackers.

40:35.090 --> 40:36.210
It's very valuable.

40:36.210 --> 40:41.490
And in our opinion, defensively, it's still kind of immature in terms of detection.

40:41.530 --> 40:43.650
It seems to be a lot of kind of string-based detections.

40:43.650 --> 40:50.770
And even looking at blog posts of people doing LDAP hunting, there just aren't as many of them as I would like to see, that we would like to see.

40:51.030 --> 41:02.530
And then lastly, we released maladaptive to help try to bring awareness to what can happen, to show that we shouldn't just be doing string-based detections, and we're providing the parser in all of our detection modules so that hopefully you can, right out of the gate,

41:02.530 --> 41:06.910
start using it in your environment if you already have a mechanism to get all of those search filters.

41:07.770 --> 41:12.030
Our unofficial takeaway is we wanted to leave you with something a little different.

41:12.190 --> 41:17.730
And so we wanted to leave you with our, each of our favorite Albanian proverb.

41:17.930 --> 41:18.670
So I'm going to go first.

41:18.670 --> 41:21.330
I'm not a native speaker, so forgive my pronunciation.

41:21.330 --> 41:26.710
But mine is rofsah malet, which literally means live long like a mountain.

41:26.710 --> 41:28.710
It's kind of a blessing of well-being.

41:28.950 --> 41:32.610
I like to think of it in this scenario as we just climbed a crazy mountain together.

41:32.610 --> 41:34.550
I'm a little out of breath, personally.

41:34.710 --> 41:37.110
But in this industry, we have to help each other out.

41:37.110 --> 41:39.950
We have to recognize the shoulders that we stand on.

41:39.950 --> 41:50.010
And so when you see someone else struggling up the mountain, trying to understand what you're learning, help them up, get them to the top, and then they'll be able to see the next mountain they're going to climb and the person they're going to bring along with them.

41:51.710 --> 42:04.890
And my favorite expression, and I think the audience would agree with me here, Debo, is tlutom jomokapsa letras, which it means, please no more paperclips.

42:07.590 --> 42:09.710
It was fun while it lasted.

42:10.270 --> 42:10.910
All right.

42:10.910 --> 42:13.810
And with that, we just want to say thank you so much for your time.

42:13.810 --> 42:15.370
Thank you, DEF CON and to all the organizers.

42:15.370 --> 42:20.250
We had such a great time putting this research together, and we're really happy to be here.

42:20.250 --> 42:21.950
Here's all of our contact information.

42:21.990 --> 42:23.930
Here's the link to Mount Adaptive.

42:23.930 --> 42:25.930
Please reach out, and we'll be up here for questions.

42:25.930 --> 42:27.410
But thank you again for your time.

42:37.170 --> 42:39.330
Any brave souls for questions?

42:41.550 --> 42:44.130
Questions or criticisms, everything is welcome.

42:46.550 --> 42:48.030
One right here, yeah.

42:53.930 --> 42:58.610
So the question is, what was our process for finding all the undocumented stuff?

42:59.630 --> 43:07.810
Well, sometimes luck, sometimes... I think the best answer that we can give is, people ask us, why do you make obfuscation frameworks?

43:07.810 --> 43:14.590
It's kind of a little twisted, but it's really a way of kind of working backwards and defining a grammar.

43:14.590 --> 43:15.810
Because it's all a language , right?

43:15.950 --> 43:19.090
What's linguistically, syntactically allowed in a language?

43:19.090 --> 43:21.890
Whether that's PowerShell or LDAP or anything else.

43:21.890 --> 43:34.890
So our understanding is, let's say, actually , when Sabi wrote the hex encoding function, to take values and do hex encoding, we wrote that function, we plugged it into our test harness, and one out of every 500 examples would fail.

43:34.890 --> 43:36.810
It wouldn't return the same results we expected.

43:36.810 --> 43:44.770
And we eventually realized that's because hex values, or hex characters in the value, is not allowed when the extensible match filter is defined, right?

43:44.770 --> 43:52.030
So that is now an incompatibility that no one said anywhere, but our tool helped us find because it found an example that broke what we'd expected to see.

43:52.250 --> 43:54.110
So that's how we found a lot of these examples.

43:54.110 --> 44:03.770
And then just some tricks you kind of learn along the way, like, hey, pre-pinning zeros, that seems like something that someone might have thought to ignore, because it's insignificant, but it still shows up in logs, therefore, it's meaningful to us.

44:03.770 --> 44:06.810
And so some of those tricks, you just kind of pick up along the way and keep carrying forward.

44:07.770 --> 44:08.650
But yeah, great question.

44:08.650 --> 44:09.050
Thank you.

44:09.750 --> 44:10.630
Yeah.

44:20.360 --> 44:21.360
Yeah, good question.

44:21.360 --> 44:28.780
So the question was, in our research, against the obfuscation techniques we found, how effective is Windows Defender or other tools like that?

44:28.800 --> 44:30.380
We don't have access to those tools.

44:30.380 --> 44:32.600
So actually don't know.

44:33.020 --> 44:44.200
In general, I'd say, you know, I've spent the last decade doing real-time detections, actually spending some time at Microsoft in Defender telemetry, looking at how we detect processes and stuff like that on the endpoint.

44:44.200 --> 44:50.160
So what I would say that a lot of red teamers criticize blue teamers for is why do you make static kind of rigid detections?

44:50.160 --> 44:54.360
Sometimes it's out of ignorance, sometimes more likely it's out of performance.

44:54.620 --> 45:04.440
So I mean, there are millions and millions and millions of search filters flying around doing crazy regexes to try to find it to try to find these bizarre scenarios probably is going to bring down performance overall.

45:04.440 --> 45:12.780
So from a product's perspective, that's I think why a lot of decisions are made, but we don't have any direct insight into Defender or anyone else on how they're stacking up against this.

45:13.220 --> 45:22.440
If anyone from Microsoft or anyone else wants to reach out, we'd be more than happy to share more of the research in detail and help if there's anything that we can do to protect the community in that regard.

45:22.920 --> 45:23.720
Great question.

45:23.720 --> 45:24.460
Thank you.

45:25.500 --> 45:27.020
Any last questions?

45:29.020 --> 45:29.900
Yes.

45:34.280 --> 45:38.500
The question was, did we have trouble with all the colors for formatting?

45:38.740 --> 45:39.840
Trouble to who?

45:39.840 --> 45:40.340
The answer is

45:47.500 --> 45:47.780
yes.

45:47.780 --> 45:47.860
Yeah.

45:49.400 --> 45:57.940
So in terms of we actually did, we split our programming actually partially.

45:57.940 --> 45:58.920
We use PowerShell core.

45:58.920 --> 46:02.760
So we did a lot of it in Windows, a lot of it on Mac, a little bit in Linux just to test compatibility.

46:03.000 --> 46:06.820
But yeah, in terms of color differences, we actually stuck with the original colors, the original 16.

46:06.980 --> 46:12.180
We experimented with the dark colors for things like distinguished name values.

46:12.460 --> 46:17.400
Those are the darkened version of all the RDNs to represent the overall tokens.

46:17.400 --> 46:20.500
But that darkness shows up better on Windows.

46:20.500 --> 46:23.000
On Mac, it actually doesn't quite show up as much.

46:23.000 --> 46:26.900
But yeah, so that was a factor we had to kind of play around with.

46:27.620 --> 46:28.980
But yeah, I like the color question.

46:28.980 --> 46:29.920
I've never gotten that before.

46:29.920 --> 46:30.780
So thank you.

46:33.060 --> 46:33.580
All right.

46:33.580 --> 46:34.680
I think with this, we're at time.

46:34.680 --> 46:36.840
We'll be around front if anyone else wants to talk or ask questions.

46:36.840 --> 46:38.520
But again, thank you everyone for coming to the talk.

46:38.520 --> 46:39.240
Have a good one.

46:39.460 --> 46:39.780
.

46:40.220 --> 46:40.540
.

