WEBVTT

00:00.000 --> 00:01.520
All right, let's get moving.

00:01.520 --> 00:04.160
Hope you guys have had an awesome DEF CON so far.

00:04.180 --> 00:05.020
Let's dive right in.

00:05.020 --> 00:07.320
So this is Bad Salt Adversarial DevOps.

00:07.760 --> 00:11.360
I'm going to start with a quick introduction, some background about myself.

00:11.360 --> 00:12.740
My name is Casey Erdman.

00:12.880 --> 00:17.140
You may know me by my handle Ngame on Twitter or other aspects of the interwebs.

00:17.280 --> 00:20.820
I'm a giant offensive security nerd, that's why I'm here in the Red Team Village.

00:21.280 --> 00:27.820
I am the co-founder of DC706, which is a Columbus, Georgia DEF CON group, so if you're ever in the area, feel free to roll through.

00:28.400 --> 00:31.560
These are some of my professional certifications, if you care about that type of thing.

00:31.560 --> 00:35.120
In my day-to-day, though, I am a manager of an information security department.

00:35.200 --> 00:37.600
We are a very small team, so I touch pretty much everything.

00:37.600 --> 00:46.660
We're in the kind of financial space, so lots of offensive security stuff, pin testing, that type of thing, incident response, good old PCI compliance, stuff like that.

00:46.800 --> 00:50.580
But I think the most interesting thing you should all know about me is that I'm a programmer gone rogue.

00:50.580 --> 01:00.500
Most of my background is in software development, and I just kind of got into CTFs and started hacking, and I decided, no more software development, let's do the offensive security stuff.

01:00.500 --> 01:01.620
That's a lot more fun.

01:01.620 --> 01:04.400
So that's where a lot of my passion is, and that's just a little bit about me.

01:05.020 --> 01:07.380
This is probably the most important slide today.

01:07.400 --> 01:11.460
If you don't take a picture of anything else, I'm going to give everybody a second to take a picture of this.

01:11.460 --> 01:18.080
All of the code, the slides for this talk, any of the PCAPs or stuff like that are at this GitHub repo, and we'll be there.

01:18.900 --> 01:20.120
So I'll give you guys a minute.

01:24.280 --> 01:25.260
All right.

01:28.140 --> 01:28.760
Perfect.

01:28.760 --> 01:29.880
So let's move along.

01:30.120 --> 01:31.560
Here's our agenda for today.

01:31.860 --> 01:42.560
First, we're going to hit some of the high points, introduce anybody to the concepts of configuration management, how we landed on SaltStack, why this technology is even the focal point of this talk today.

01:42.600 --> 01:46.040
Then we're going to talk about some attacks against that platform.

01:46.300 --> 01:49.400
And then the meat of the talk is actually going to be hacking with that platform.

01:49.400 --> 01:56.400
When we're talking about adversarial DevOps, we're talking about using these new fancy tools that are in our industry as an offensive person.

01:56.400 --> 01:58.180
How can I take advantage of these?

01:58.180 --> 02:01.180
And that's really where we're going to dive in and look at a couple of those things.

02:01.240 --> 02:09.920
And then, of course, we're going to also give our blue teamers the chance to stop anything that they see like this, and we'll cover those investigation techniques at the end.

02:10.680 --> 02:11.220
All right.

02:11.220 --> 02:13.180
So what is SaltStack?

02:13.840 --> 02:17.500
So to talk about SaltStack, first we need to talk about configuration management.

02:17.500 --> 02:20.400
So configuration management isn't really new.

02:20.400 --> 02:23.940
We've got configurations we've been managing for a long time in the industry.

02:23.940 --> 02:27.780
But there's kind of new technologies that help us facilitate this idea.

02:27.780 --> 02:36.620
And the goal here is to establish some baseline and some integrity across our systems to make sure they look and act how they should and don't have any variants here.

02:36.680 --> 02:44.100
Some common new tools for configuration management you may have heard of are things like Puppet, Chef, Ansible, and SaltStack.

02:44.100 --> 02:47.080
So we're going to take a high-level look at some of these tools.

02:47.160 --> 02:50.140
All of these tools can essentially accomplish the same goal.

02:50.140 --> 02:52.100
So I'm not saying any one tool is better than the other.

02:52.100 --> 02:53.860
I'm not sponsored by any of these companies.

02:53.860 --> 02:57.460
I just want to kind of give a narrative of how I landed on what I landed on.

02:58.180 --> 03:03.440
So starting with Puppet, Puppet's kind of one of the industry-leading tools in this space here.

03:03.440 --> 03:04.860
They've been around for a while.

03:05.420 --> 03:11.720
It integrates really well with other products because its baseline purpose is the concept of configuration management.

03:11.720 --> 03:17.700
So when these tools first started coming out, you may have heard things like maybe Puppet and Chef.

03:17.700 --> 03:27.340
And it's this bundle of tools where Puppet would be the foundation and help you do the configuration management where something like Chef or Ansible would go then execute on those configurations.

03:27.640 --> 03:30.360
So that's kind of where things kind of got started.

03:30.360 --> 03:37.080
It's got a little bit of maturity, good foundation, but there's also other tools out there that have matured a lot more.

03:37.080 --> 03:40.860
And so Puppet and Chef can kind of just be replaced by Chef nowadays.

03:40.860 --> 03:41.800
Chef has come a long way.

03:41.800 --> 03:47.500
But at first, it was more focused on infrastructure as code and not really configuration management.

03:47.500 --> 03:55.240
However, inherently, when you're talking about infrastructure as code, you're defining how your machines look in some kind of code syntax or configuration.

03:55.240 --> 04:01.500
So naturally, Chef kind of became its own configuration management utility.

04:01.840 --> 04:04.460
And the focus here is, of course, that continuous automation.

04:04.460 --> 04:10.840
You can continue upgrading, changing your configurations in your systems, and also manage those configurations.

04:11.120 --> 04:15.440
Chef also provides a couple neat other tools like Inspect or Habitat.

04:15.440 --> 04:16.600
I don't know a whole lot about these tools.

04:16.600 --> 04:19.940
I know Inspect is supposed to be some kind of cool code audit tool of some sort.

04:19.980 --> 04:23.260
But the point is, it's matured a lot more now and there's a lot of feature sets.

04:23.260 --> 04:28.160
It could be a good option when you're looking to explore the concept of configuration management for your infrastructure.

04:29.360 --> 04:32.580
Now, Ansible is a little bit different from these other tools.

04:32.580 --> 04:37.660
So Ansible is more about the infrastructure automation, not so much the configuration management.

04:37.660 --> 04:44.560
While, again, you can do pretty much everything with all of these tools, Ansible I like to think of as like mass SSHing or something like that.

04:44.560 --> 04:52.040
You're able to go and execute on hundreds and hundreds of systems at one time to apply whatever state or configuration that you're trying to apply.

04:52.760 --> 04:58.280
And so I like to equate maybe Puppet and Ansible as something a little bit closer to what Salt Stack is.

04:58.740 --> 05:06.120
But again, it's less about configuration management and just more about the execution of the automation of whatever your configurations are.

05:07.100 --> 05:10.360
All right, so we got all these great tools.

05:10.360 --> 05:12.060
Why did it land on Salt Stack?

05:12.060 --> 05:25.700
So from a professional standpoint, when myself and the other members of the DevOps team are coordinating and looking at different ways to do configuration management on our infrastructure, we found that Salt Stack scales a little bit easier.

05:25.700 --> 05:27.560
And the reason is because it's agent-based.

05:27.560 --> 05:36.100
So a lot of these other tools may require you to have access or credentials or go open up some firewall rules or network communications.

05:36.100 --> 05:38.080
There seems to be a lot more setup.

05:38.680 --> 05:41.240
Things are changing very rapidly with a lot of these tools.

05:41.240 --> 05:44.380
So what's true today, of course, may not be true later.

05:44.380 --> 05:48.660
But at the time of selection for a tool, Salt Stack really scaled well.

05:49.660 --> 05:52.640
And of course, it does everything all the other tools do.

05:52.640 --> 05:54.120
And it just does it all in one.

05:54.120 --> 05:56.720
You don't need an Ansible and a Puppet.

05:56.720 --> 05:59.980
You could just use Salt Stack and get all the same capabilities out.

05:59.980 --> 06:01.960
Doesn't make it better, doesn't make it worse.

06:02.040 --> 06:04.280
You just have those options available to you.

06:05.240 --> 06:09.220
And Salt Stack's primary purpose is for configuration management.

06:09.220 --> 06:10.360
That's kind of what it's built around.

06:10.360 --> 06:13.380
It's built around the concept of desired state.

06:13.680 --> 06:19.880
So desired state is this idea that your machine is going to match your configuration all the time, no matter what.

06:19.880 --> 06:26.180
And if at any point it's not matching that desired state, it's going to correct itself and make sure it maintains that integrity.

06:26.180 --> 06:28.060
And that's kind of what Salt Stack's built around.

06:28.520 --> 06:35.600
And because of kind of the agent-based nature, it integrates with kind of some older or more standardized systems a little bit easier.

06:35.700 --> 06:43.740
We're able to deploy this in anywhere from like cloud environments like AWS or Google Cloud or traditional data centers or co-locations.

06:43.740 --> 06:44.600
It's really easy.

06:44.600 --> 06:48.280
You just kind of set up a master and look at the architecture in a couple slides.

06:48.280 --> 06:55.760
You set up the salt master, you deploy minions, you set the egress out where you want, and you're good to go start configuring hundreds and hundreds of systems in Salt Stack.

06:56.120 --> 07:03.520
So that's kind of how we landed on this from the standpoint, and I kind of took it and ran with it for the majority of the talk.

07:03.520 --> 07:04.820
But just how we got there.

07:05.580 --> 07:07.180
This is Salt Stack architecture.

07:07.180 --> 07:08.180
I'm not going to dive into this.

07:08.180 --> 07:09.560
I don't expect anybody to actually read it.

07:09.560 --> 07:11.020
It's really complex though.

07:11.020 --> 07:13.960
That's kind of why I wanted to show this slide.

07:14.340 --> 07:22.780
So the kind of key points here that we're going to look at is this idea of the master and then these little beacons or minions as they're actually called.

07:22.780 --> 07:24.700
So there's a lot of functionality in Salt Stack.

07:24.760 --> 07:26.420
Please read more of the documentation.

07:26.420 --> 07:27.360
It's really cool.

07:27.420 --> 07:30.640
But this is the simplified version that's a lot easier to understand.

07:31.380 --> 07:33.940
So salt minions and salt masters.

07:33.940 --> 07:36.280
That's kind of what we're primarily focused on here.

07:36.280 --> 07:41.240
So the salt master is going to be listening on two ports, 45.05 and 45.06.

07:41.600 --> 07:43.480
45.05 is the publisher port.

07:43.480 --> 07:47.360
This is where the master is going to issue a command, say, hey go run who am I or whatever.

07:47.800 --> 07:52.160
And then 45.06 is where the minion is going to pull up and publish its results.

07:52.160 --> 07:59.900
So the minion is going to go up to port 45.05, grab that command, execute it, and then return up to 45.06 with whatever its output is.

08:00.040 --> 08:03.200
Now this request server also handles file management.

08:03.200 --> 08:07.640
So one of the cool things we'll do that we'll kind of look at a little bit later is manage files.

08:07.640 --> 08:15.540
So if you want to copy other configurations for other components or install applications from a custom repo, whatever have you, you can copy those.

08:15.540 --> 08:23.140
And that port is where the salt minion will go fetch or send commands, either one, to that request server.

08:23.160 --> 08:26.640
Now of course we have this execution of commands and the sending of response.

08:26.640 --> 08:28.320
Sounds kind of like a C2 server.

08:28.320 --> 08:30.520
So keep that in the back of your brain as we go forward.

08:31.900 --> 08:33.940
All right, kind of wrap up this section.

08:34.560 --> 08:35.540
Configuration management.

08:35.540 --> 08:36.520
Why is it cool?

08:36.520 --> 08:38.000
What are we using this for?

08:38.200 --> 08:40.860
Well, you can enforce hardening standards with it.

08:40.860 --> 08:43.900
You can enforce those nasty compliance standards with it.

08:43.940 --> 08:46.400
Create uniformity across all your environments.

08:46.480 --> 08:56.260
And then ultimately the coolest thing that works both on the offensive side and the defensive side is making sure stuff is installed that should be and making sure that stuff that isn't installed shouldn't be.

08:56.260 --> 09:04.040
So you're really able to enforce that and help lock that down with this concept of desired state where the system will go and see what it should look like.

09:04.040 --> 09:06.740
If it doesn't match, it'll go try to correct itself.

09:07.520 --> 09:14.740
All right, so hopefully everybody's got a good overview of the concepts of configuration management, desired state, what all these tools are for.

09:15.120 --> 09:16.400
Let's hack SaltStack.

09:16.840 --> 09:18.820
All right, so quick history lesson.

09:19.320 --> 09:21.980
SaltStack was released back in March 2011.

09:21.980 --> 09:25.280
This was a very stable or very not stable, very early version.

09:25.640 --> 09:29.520
The first stable release came out a couple months later in November 2011.

09:29.520 --> 09:33.920
And we're now on version 2019.2, which was like in February.

09:33.920 --> 09:36.260
And this is true as of the time of typing of the slide.

09:36.260 --> 09:37.900
There may have been a new release like this week.

09:37.900 --> 09:38.660
I don't know.

09:38.900 --> 09:42.720
But the point here that I'm trying to illustrate is this is back in 2011.

09:42.720 --> 09:44.140
We're in, what, 2019 now.

09:44.140 --> 09:45.240
About eight years.

09:45.540 --> 09:49.400
That doesn't sound like long ago because it's 2011, but it was eight years ago.

09:49.400 --> 09:50.500
Old things have bugs.

09:50.500 --> 09:52.600
SaltStack is now kind of an old thing.

09:52.600 --> 09:53.940
It's kind of weird to think about.

09:54.220 --> 10:00.180
But to illustrate that old things have bugs, here's a list of kind of recent CVEs for SaltStack.

10:00.380 --> 10:05.020
Just to kind of go over and glance real quick, this list is longer than here.

10:05.020 --> 10:08.640
This is just a snap of part of the MVD.

10:09.140 --> 10:10.640
But we got some code execution.

10:10.640 --> 10:12.720
We got some directory traversal.

10:12.720 --> 10:15.900
Some information type of issues.

10:16.680 --> 10:20.180
The goal of this research wasn't any kind of vulnerability research specifically.

10:20.180 --> 10:22.140
So I encourage you to go dive down these your own.

10:22.140 --> 10:24.640
Just to show that SaltStack has had some problems.

10:25.160 --> 10:28.240
And what I did from there is kind of see if there's any proof of concepts out there.

10:28.240 --> 10:37.200
See if based on what is known, what type of attack vector should I be challenging myself to go look for in a current version of SaltStack.

10:37.260 --> 10:40.840
And the first thing I kind of stumbled upon was this evil minions project.

10:40.840 --> 10:44.840
Now, this isn't really a proof of concept to exploit any kind of vulnerability.

10:45.000 --> 10:46.500
It's actually just a load generator.

10:46.500 --> 10:54.160
It was made for purposes of going and testing how many minions or processes a particular minion service could handle.

10:54.160 --> 10:57.160
So it just spawned a whole bunch of minions and test the load.

10:57.320 --> 11:04.120
So nothing really crazy in terms of exploiting vulnerabilities, but might be cool for some denial of service attack or whatever have you.

11:04.120 --> 11:08.720
That was just the first thing I stumbled on with some simple Googling and looking at search terms.

11:09.520 --> 11:12.000
I dug a little bit deeper, though, and I found Chicken Salt.

11:12.200 --> 11:24.900
So Chicken Salt is this neat little POC for abusing the communication between minions and masters when they do this handshake for key public key authentication.

11:24.900 --> 11:30.000
So this allows for man in the middle attack, which ultimately allows you to take over minions.

11:30.000 --> 11:37.120
Now, this is important because while you may think, oh, well, if I can get access to the master, well, then I can control everything on the network, right?

11:37.220 --> 11:39.040
Well, what if you could just stand up your own master?

11:39.040 --> 11:40.640
You don't need access to that master.

11:40.800 --> 11:45.840
And then you get everybody to talk to you, and now you can control all of the minions it controls.

11:45.840 --> 11:47.840
That's what this kind of attack allows you to do.

11:48.320 --> 11:54.860
And what happens here is you'll sniff the handshake upon initial communication between a minion and a master.

11:55.040 --> 12:00.740
You would be able to grab the public key and the verification token for that particular communication.

12:00.780 --> 12:06.160
Then you can man in the middle, serve up that public key and token you acquired, and bam, you can pwn all the minions.

12:06.480 --> 12:08.360
Couldn't really find a CVE for this one, though.

12:08.360 --> 12:12.140
It didn't match any of the things that I had already found when doing initial research.

12:12.520 --> 12:16.640
It looks like it was probably patched in version 0.17.1.

12:17.100 --> 12:20.180
It might be related to that CVE that's on the slide there.

12:20.180 --> 12:25.380
That has to do with Salt not validating SHHOS key request, which also resulted in a man in the middle attack vector.

12:25.640 --> 12:27.240
It's just really hard to tell.

12:27.300 --> 12:29.700
All I know is it doesn't work now because I tried.

12:29.920 --> 12:33.820
However, when I tried, I found a new attack vector.

12:34.500 --> 12:38.960
So I kind of want to talk about modern man-in-the-middle attacks against Salt Stack.

12:38.960 --> 12:41.140
Now, this isn't any kind of crazy OODA.

12:41.140 --> 12:43.260
We're not doing anything super sophisticated.

12:43.260 --> 12:45.920
This is a really easy attack, and it's really not a high risk.

12:45.920 --> 12:49.100
It's actually just by design, how Salt works.

12:49.300 --> 13:00.920
And what I'm trying to communicate here is just awareness for good configuration standards of your Salt environment, because it's really easy to mitigate this type of issue, but by default, it is not mitigated.

13:00.920 --> 13:01.920
And that's just by design.

13:01.920 --> 13:02.920
It's not a vulnerability.

13:02.920 --> 13:09.360
It's not any kind of issue, but it is a potential risk that you need to be aware of, especially if you have Salt in your environments.

13:09.380 --> 13:13.600
So the issue is caused by the need to distribute keys.

13:13.740 --> 13:19.380
Once you install an agent on a box, it's got to go talk to the master, and it's got to do this kind of exception thing.

13:19.380 --> 13:21.360
So we'll look at that on the next slide.

13:22.280 --> 13:24.900
So here's how the key exchange works.

13:24.900 --> 13:28.280
So you have a Salt minion and your Salt master, like we've seen.

13:28.360 --> 13:33.660
The Salt minion is going to communicate initially with the Salt master and say, hey, here's my public key.

13:33.660 --> 13:34.900
Do you want to accept it?

13:34.980 --> 13:43.640
If you choose to accept it on the Salt master side, it'll add that minion into your queue, and now you can execute commands and facilitate communications with the minion.

13:44.940 --> 13:50.180
So the problem here is that the Salt minions will trust a master on initial communication no matter what.

13:50.180 --> 13:52.280
This is any master at any point in time.

13:52.400 --> 13:59.840
The solution to this problem, which is built into Salt already, is to give Salt minions a fingerprint for the good known master.

14:00.240 --> 14:01.160
So everything's good, right?

14:01.160 --> 14:03.300
We give them the fingerprint, and we're good to go.

14:03.360 --> 14:06.260
Well, how do you give the minion the fingerprint?

14:07.320 --> 14:09.940
Fingerprints have to be issued on initial deployment.

14:09.940 --> 14:16.480
If you don't issue them on initial deployment, they won't be set, therefore making you potentially vulnerable to this type of attack factor.

14:16.840 --> 14:23.440
Now, it's really easy to fix this issue, as we'll see, but here's the kind of capabilities and control that you have.

14:23.440 --> 14:25.200
So let's hop into this demo real quick.

14:25.800 --> 14:32.620
So here we've set up BetterCap with a man in the middle listening on our two Salt ports for our fake master.

14:34.160 --> 14:36.400
And then here is our Salt minion.

14:36.780 --> 14:40.620
So the Salt minion is going to just show you what our configurations are.

14:40.760 --> 14:43.700
That's pointing to this 128.13 master.

14:44.100 --> 14:46.060
There's no master fingerprint set by default.

14:46.060 --> 14:47.380
This is fresh install.

14:48.120 --> 14:49.380
And it's started the service.

14:49.380 --> 14:50.460
So now it should call home.

14:51.080 --> 14:52.960
This is going to show this is the legitimate master.

14:52.960 --> 14:54.180
It's going to be dot 13.

14:55.460 --> 14:57.340
And we'll list our keys here.

14:58.260 --> 15:00.660
And there's no unaccepted keys, even though there should be.

15:00.660 --> 15:02.760
We should be getting a callback from that minion, right?

15:03.500 --> 15:09.460
Well, if you go back over to our evil master and see we've got some communications from our interception from man in the middle.

15:09.980 --> 15:10.920
And run this.

15:10.920 --> 15:12.720
We're going to show that we're not the same IP.

15:15.520 --> 15:18.560
And now we're going to see what unaccepted keys are in our bad master's queue.

15:18.960 --> 15:20.200
Oh, it looks like we've got one.

15:21.140 --> 15:22.580
So we're going to accept that key.

15:24.040 --> 15:29.920
And now we've successfully manned in the middle of that minion and we're ready to execute commands on this host.

15:29.920 --> 15:32.000
So that's kind of how the attack plays out.

15:32.000 --> 15:33.200
Real simple.

15:33.360 --> 15:35.800
Not anything complex to it.

15:35.800 --> 15:41.560
But it is very much an attack vector and it is caused by this default configuration.

15:42.220 --> 15:45.620
The good news here is this only works on initial communication.

15:45.620 --> 15:47.360
Like I said, it's fairly low risk.

15:48.240 --> 16:02.900
What happens is on that initial communication, once a master accepts the minion communication, it's going to cache that fingerprint that we there.

16:03.280 --> 16:05.280
But it is not in the configuration.

16:05.280 --> 16:15.080
Which means if at any point that cache gets cleared out for any reason by whether it's manual deletion or some debugging or reinstallation of a minion, whatever have you, it could potentially go away.

16:15.080 --> 16:24.520
However, if you have minions already in your environment, they've already communicated with your legitimate master, what will actually happen if I try to do that man in the middle attack is there's a conditional set.

16:24.520 --> 16:29.720
So the people who make salt stack are already aware of this particular issue.

16:29.740 --> 16:35.820
And this nice helpful log message that you might be getting man in the middle attack will dump into the salt minion logs.

16:36.020 --> 16:40.140
So it kind of fixes itself if you've already had that initial communication.

16:40.140 --> 16:43.200
But if you haven't, then you're open to this potential vulnerability.

16:44.060 --> 16:46.840
Now, detecting this type of attack is fairly simple.

16:47.220 --> 16:50.700
In the first image we have here, a successful attack basically looks like nothing.

16:50.700 --> 16:51.860
It's completely normal.

16:51.860 --> 16:53.320
You don't see anything going wrong.

16:53.500 --> 16:57.620
A failed attack, however, has that log message that we looked at on the previous slide.

16:58.360 --> 17:00.560
Now, there are two ways to prevent this type of attack.

17:00.560 --> 17:05.180
Of course, the best way is to deploy your salt minions with the fingerprint.

17:05.400 --> 17:06.680
And that's part of the configuration.

17:06.680 --> 17:07.220
Real simple.

17:07.220 --> 17:08.520
There's no reason not to do it.

17:08.520 --> 17:09.400
Doesn't break anything.

17:09.400 --> 17:10.920
Doesn't cost you anything extra.

17:10.940 --> 17:19.640
You literally just spit out on your legit master whatever the fingerprint is, go pop it in your minion configure whenever you're setting up minions, and you will never be vulnerable to this type of attack.

17:19.640 --> 17:20.520
Real easy.

17:20.620 --> 17:26.180
Option two is you could automatically set all of your minions to always be accepted on master.

17:26.180 --> 17:29.440
This will work and kind of mitigate after that initial communication.

17:29.940 --> 17:36.020
But, of course, if an attacker is already on your network man-in-the-middle and all the things, option two doesn't really work because we're just going to keep intercepting stuff.

17:37.120 --> 17:39.440
With that said, this is a pretty tight attack vector.

17:39.440 --> 17:40.700
It's lower risk.

17:41.160 --> 17:45.820
The conditions to kind of pull this off, you would first need access to the target environment.

17:45.820 --> 17:46.280
That's easy.

17:46.280 --> 17:47.740
We can get into any environment, right?

17:48.340 --> 17:52.680
Next up would be that we need to be able to pull off man-in-the-middle attacks in the environment.

17:52.680 --> 18:02.220
This could be a little bit harder if you have fancier network segmentation or other kind of rules to catch you going on, but still easier than most other types of attacks.

18:02.980 --> 18:08.500
The catch is that you would definitely need to catch your target in the middle of some kind of minion deployment.

18:08.500 --> 18:13.540
So hopefully you hacked a DevOps engineer's calendar and you know when they're doing the next salt deployment or something like that.

18:13.540 --> 18:14.960
That's really niche.

18:14.960 --> 18:15.500
Good luck.

18:15.500 --> 18:16.500
You could try to pull it off.

18:16.500 --> 18:20.980
I don't recommend doing this if you're on some kind of red team or pentest engagement.

18:20.980 --> 18:26.740
It's probably not going to be your best way in, but if all the cards align, you could potentially get in with this method.

18:26.900 --> 18:31.280
And there's no really notion of them patching this because, like I said, it's not really a vulnerability .

18:31.280 --> 18:33.820
It's about us managing our configurations properly.

18:33.820 --> 18:37.840
If you go out and you establish your fingerprint, you're never going to have a problem with this.

18:38.060 --> 18:41.280
So I just kind of wanted to raise awareness there because this is not the default.

18:41.280 --> 18:42.360
There's no fingerprint set.

18:42.360 --> 18:46.560
It can't be because it's not going to know what your custom master is once you've spun it up.

18:46.560 --> 18:49.640
Be sure you go set that fingerprint so you avoid this type of issue.

18:50.920 --> 18:56.240
All right, now that we've looked at attacking SALT a few different ways, let's get into the meat of what I want to bring to the table today.

18:56.240 --> 18:58.140
And that is hacking with SALTstack.

18:58.140 --> 19:01.680
So to start off, I want to talk about some C2s.

19:01.680 --> 19:10.760
So hopefully most of us are familiar with a couple of command and control frameworks, such as Merlin or PowerShell Empire or the Metasploit framework and SALTstack.

19:10.920 --> 19:17.720
Yeah, so if you remember that little architecture slide from the SALT master and minions, we had that little C2 type communication.

19:17.720 --> 19:21.640
We can execute commands from the master and the minions will post their responses.

19:22.680 --> 19:27.060
So I kind of wanted to just pick out two C2s that I felt related to SALTstack.

19:27.060 --> 19:32.360
And I felt Empire and Merlin were probably the best candidates, but I'm a fanboy of Merlin, so I picked Merlin instead.

19:32.460 --> 19:36.240
And the reason being is because the communications work very similar.

19:36.240 --> 19:54.040
Now while Merlin and Empire both operate on like a single port communication, the idea of the master service posting commands, your agent coming in and connecting, establishing that command, and then pulling back up to send the response is kind of the same type of thing.

19:54.060 --> 19:57.400
So it's just this pulling agent idea that makes them similar.

19:57.600 --> 19:59.140
So let's compare these two.

19:59.600 --> 20:01.420
First looking at Merlin, is it a C2?

20:01.420 --> 20:02.460
Yeah, that's what it's built for.

20:02.460 --> 20:04.740
It does command and control, does it pretty well.

20:05.680 --> 20:18.020
The traffic for Merlin is disguised to look like HTTPS traffic, so looks like normal web calls coming out of your environment, helpful for getting around some firewall rules or maybe just doing some light evasion so you're not instantly being detected on a network.

20:18.160 --> 20:23.540
It's got some really cool post exploitation modules built in now so you can run things like Mimikatz or whatever have you.

20:23.940 --> 20:25.640
And it's got some AV evasion.

20:25.640 --> 20:32.580
This isn't because it's built to evade AV, this is just because Golang's kind of new and it's really hard for most modern AV to detect Golang.

20:32.580 --> 20:37.200
That will definitely change as we progress forward in the future and Golang becomes even more popular than it is now.

20:37.260 --> 20:42.700
But for the time being I've found that on most of my engagements I can drop a Merlin agent, don't have any problems with any AV.

20:42.780 --> 20:45.540
So just throwing that out there if you haven't used it on engagement.

20:45.540 --> 20:46.600
Pretty neat tool.

20:47.500 --> 20:49.660
Alright, let's compare that to SaltStack.

20:49.660 --> 20:50.800
Is it a C2?

20:50.840 --> 20:51.560
Yeah.

20:51.840 --> 20:54.580
Execute commands, get control, do your thing.

20:54.580 --> 20:55.920
Kind of covered that a little bit.

20:55.920 --> 20:57.360
What about the communications?

20:57.380 --> 21:03.740
Well, everything is encrypted, you have a complete encrypted channel, but it's not quite HTTPS.

21:04.340 --> 21:11.040
It's pretty much clear, or not clear, but it's straightforward TCP communications to the master.

21:11.080 --> 21:18.480
You can do some things to kind of change up ports that you're listening on and change your configuration to your master to kind of be more stealthy, and we'll see that a little bit later.

21:18.720 --> 21:23.700
But overall it's going to be pretty clear that the communication is abnormal.

21:23.700 --> 21:26.740
It's not looking like any kind of standard thing in your environment.

21:26.740 --> 21:30.200
It's going to be pretty exposed in that regard.

21:30.200 --> 21:33.280
But it is encrypted and it is a secure channel.

21:33.600 --> 21:34.980
Post-exploitation modules?

21:34.980 --> 21:38.440
Well, I mean they're not baked in, but we call this desired state.

21:38.440 --> 21:42.300
And this is kind of where the cool stuff gets in that we'll look at in a couple slides.

21:42.600 --> 21:56.220
So post-exploitation modules for SaltStack is going to be this idea that we are going to take the concept of configuration management and build our own configurations that are bad.

21:56.220 --> 22:00.940
They do things that an attacker wants to do rather than what maybe an infrastructure engineer wants to do.

22:01.000 --> 22:02.040
AV evasion?

22:02.040 --> 22:04.820
Yeah, these are trusted agents from professional software.

22:04.820 --> 22:06.720
Yeah, they're not going to be picked up by anything.

22:06.720 --> 22:09.120
Real easy, guaranteed to go through.

22:09.600 --> 22:16.260
So we get some leverage there from being able to cash in on this trusted software.

22:17.360 --> 22:27.400
Alright, so in terms of using this platform as an adversary, like I mentioned, this desired state configuration concept is going to be kind of the key here.

22:27.400 --> 22:30.640
This is what makes it really cool because, I mean, we've got command and control for days.

22:30.640 --> 22:31.960
What makes this any different?

22:31.960 --> 22:34.200
Why is this a neat option to explore?

22:34.200 --> 22:37.900
Well, I call this like post-exploitation modules in advanced mode.

22:37.900 --> 22:42.560
It's kind of cheesy, but it's really easy to automate your persistence.

22:42.680 --> 22:52.000
And basically what this means is you can pre-build these states to say on all these types of systems, Windows, Linux, Mac, whatever have you, do this.

22:52.000 --> 23:04.920
So if you have compromised, you know, I don't know, 10, 20, 100 systems and they're all different operating systems types, you can have conditionals set in your state and say, okay, I want to do the same type of persistence across all of these different platforms,

23:04.920 --> 23:11.920
have them categorized out beforehand, hit state apply, it's just going to run through and do all your persistence for you and you're good to go.

23:12.760 --> 23:16.600
And so that's really, just really freaking powerful and I think it's really cool.

23:17.720 --> 23:23.200
You're able to enforce that persistence, so of course desired state, you don't want your system to deviate from how it looks.

23:23.300 --> 23:24.640
So this is your server now.

23:24.640 --> 23:30.200
Think of how you as an adversary want your server to look at all times now that you've compromised it.

23:30.200 --> 23:36.280
You want to make sure you're maintaining the access and being on the box and as long as your agent doesn't get removed, well you can keep enforcing that additional persistence.

23:36.280 --> 23:43.080
As long as that additional persistence is getting enforced, even if your agent does get removed, you can play your cat and mouse game, get back in with your other methods.

23:43.540 --> 23:50.820
So that's kind of the real power here, is that being able to correct the server from how it looks to how you want it to be.

23:50.820 --> 23:53.260
And you're able to do that from the attacker's perspective.

23:53.740 --> 23:56.200
So it's really just a super cool post-exploitation.

23:56.220 --> 24:02.100
It works a little different than things that are built for post-exploitation because it wasn't made for that, but we can make it for that.

24:02.100 --> 24:05.060
So I kind of want to introduce BadSalt.

24:05.060 --> 24:07.000
So that's kind of where this comes into play.

24:07.500 --> 24:09.040
SaltStack is really hard to learn.

24:09.220 --> 24:10.760
It can take some time to set up.

24:10.760 --> 24:13.660
You actually get pretty snappy at it once you've done it a couple times.

24:13.660 --> 24:21.220
But when I was doing all this research, I got tired of setting up new boxes and, you know, reinstalling agents and going through the whole rigmarole.

24:21.220 --> 24:22.680
So I automated everything.

24:23.100 --> 24:24.400
So that's the BadSalt project.

24:24.400 --> 24:26.280
It's not really anything fancy right now.

24:26.280 --> 24:27.460
Don't expect much.

24:27.460 --> 24:31.300
It's literally just a couple automation scripts to help you get started and get things set up.

24:31.300 --> 24:34.260
But if this is all brand new to you, this is a good way to get started.

24:34.260 --> 24:36.920
Especially if you're interested in this from an offensive perspective.

24:37.540 --> 24:43.800
So the goal here eventually would be to pre-build out some of these post-exploitation states.

24:43.800 --> 24:51.300
And also kind of make some sexier stagers to easily deploy onto potential targets because right now it's just a bunch of like batch and batch scripts.

24:51.300 --> 24:55.600
Really, truly nothing fancy, but it did help automate a lot of things.

24:56.280 --> 25:00.860
So let's look at using Salt as like a C2 from an adversarial's perspective.

25:00.860 --> 25:02.160
So let's see this in action.

25:02.320 --> 25:04.240
So I want to demonstrate a couple things.

25:04.240 --> 25:07.580
The first one is going to be, of course, AV evasion with the trusted minion.

25:07.580 --> 25:08.840
So we've got a fresh malware byte.

25:08.840 --> 25:11.880
It's all live protection installed, set up, ready to go.

25:12.820 --> 25:16.260
We're going to go... see it's not even detecting anything wrong with the recode.

25:16.260 --> 25:17.960
There's nothing malicious going on here.

25:18.720 --> 25:21.120
Obviously you'll see some pretty janky stuff going on.

25:21.120 --> 25:23.900
Pretty clear things that you could see as IOCs.

25:23.900 --> 25:27.020
And we'll cover that later once we talk about detecting this type of stuff.

25:27.020 --> 25:31.460
So purely just for automation and proof of concept purposes, this will take a minute to set up.

25:31.460 --> 25:40.280
But what's going on here is it's pulling down from the main repo.salt.com the installer binary for a Salt agent.

25:40.280 --> 25:41.920
And then it's running an install command.

25:41.920 --> 25:45.300
And then the last thing it'll do is pull down my custom bad configuration.

25:45.400 --> 25:55.400
And all I've done really at this point is change 4505 and 4506 to ADM443 to look a little bit more stealthy and get past some egress filters.

25:56.060 --> 25:58.120
So this is going to take a minute to set up.

25:58.200 --> 26:06.080
Once it does, though, we'll switch over to our Salt master and apply one of those bad states that we've set up as an attacker.

26:08.080 --> 26:09.480
Any day now.

26:15.240 --> 26:17.460
This is why Windows is my least favorite.

26:17.620 --> 26:18.720
Throw that jab out there.

26:22.480 --> 26:23.100
All right.

26:23.100 --> 26:23.540
Cool.

26:23.540 --> 26:25.120
So we've copied our config over.

26:25.320 --> 26:28.080
And now we're going to go over to our master.

26:28.080 --> 26:29.380
We're going to accept the key.

26:30.640 --> 26:34.860
And then we're going to see that there is no backdoored user installed.

26:34.860 --> 26:36.440
So we're going to run on that user command.

26:36.540 --> 26:38.220
This is like an IE test box.

26:38.220 --> 26:41.220
So these are some of the default users on that IE test box for Vagrant.

26:41.460 --> 26:43.820
And now we're going to run our persistent state.

26:43.900 --> 26:45.180
And this is going to be very simple.

26:45.180 --> 26:46.860
We'll look at the code for this on the next slide.

26:46.860 --> 26:48.720
But it's going to install this backdoored user.

26:48.720 --> 26:49.900
Did it pretty quickly.

26:50.700 --> 26:53.880
And now we have a backdoored user installed on the box called backdoor.

26:53.880 --> 26:56.340
Has administrative privileges and RDP purpose.

26:56.340 --> 26:57.880
Pretty quick, pretty effective.

26:58.120 --> 27:00.120
What does that actually look like?

27:00.260 --> 27:02.300
We'll start actually with a Linux state.

27:02.400 --> 27:03.680
So this is going to look similar.

27:03.680 --> 27:05.060
We're actually going to look at the Windows state as well.

27:05.060 --> 27:06.440
But these are what states look like.

27:06.440 --> 27:07.860
They're just YAML configurations.

27:07.860 --> 27:10.520
They're real simple, real easy to adapt.

27:11.000 --> 27:15.680
And basically just think of how systems are configured and what you want to do on those systems.

27:15.680 --> 27:16.720
And you do it in YAML.

27:16.720 --> 27:18.280
And it's pretty straightforward and easy to read.

27:18.280 --> 27:21.920
So here I've named this configuration add backdoor Nix user.

27:21.920 --> 27:26.360
So when I call it later, I'll say, hey, for Linux machines or Unix machines, go do this thing.

27:26.920 --> 27:31.220
And then what it's going to do is it's going to check if a user is present.

27:31.220 --> 27:33.560
So user.present, it's very declarative.

27:33.560 --> 27:36.600
You think, is the state of this machine's way?

27:36.600 --> 27:37.740
If it's not, go do it.

27:37.740 --> 27:40.160
Rather than saying, go do this to this machine.

27:40.160 --> 27:41.840
It's going to check first and validate.

27:42.240 --> 27:45.460
So if it's not present, it's going to add a user with name backdoor.

27:45.500 --> 27:46.600
Password's going to be doorback.

27:46.600 --> 27:47.600
It'll hash it.

27:47.600 --> 27:49.780
Give us a home directory of slash home slash thread.

27:49.780 --> 27:52.940
And then add us to like wheel, sudoers, root, et cetera.

27:53.260 --> 27:55.080
So now we have a root account ready to go.

27:56.080 --> 28:01.960
In a much more powerful vein, you can also do these file managed states.

28:01.960 --> 28:07.600
So here we got a sample one for how you might go deploy an interpreter payload on a particular target.

28:07.760 --> 28:15.240
So here we just have our salt repo set up as salt colon slash slash is actually a local directory on your master system.

28:15.240 --> 28:17.300
It'll be in like slash serve slash salt.

28:17.700 --> 28:20.100
And you'll kind of set a directory structure here.

28:20.100 --> 28:26.240
I've got one called payloads, nix, and then I put any of my Linux payloads that I might want to do managed file stuff with there.

28:26.240 --> 28:27.840
In this case, it's an interpreter payload.

28:28.140 --> 28:32.640
I'm going to tell it to go, hey, install this into slash temp.

28:32.900 --> 28:36.320
Give it executable, read, write permissions, et cetera.

28:36.680 --> 28:37.700
And then go run it.

28:37.700 --> 28:40.000
And then this BG is go run it in the background.

28:40.000 --> 28:45.480
So it'll go execute it, run it in the background, and then I should get an interpreter session that pops over once that happens.

28:45.480 --> 28:50.380
Now, with just these two ideas, you can go crazy.

28:50.380 --> 28:59.600
So from just the managed file, being able to run all your custom binaries from one place, you could get salt stack in there and say, all right, I want to do some crazy stuff with my custom tool sets that I already have.

28:59.600 --> 29:06.640
You can apply it like that and saw it across as many systems as you have into your salt stack instance and go from there.

29:06.640 --> 29:11.780
So whether it's an interpreter, Merlin, or some crazy custom toolkit you have, that's about how you do it.

29:12.540 --> 29:14.780
Now, for Windows, it's about the same.

29:15.140 --> 29:23.060
This is just to show kind of the difference between the language that you're going to be using in the YAML file, but this is the exact state we just ran in that demo.

29:23.280 --> 29:25.500
So we're checking for user present.

29:25.540 --> 29:32.080
If it's not, we add a user back door, pass through a door back, and add it to the administrators and RDP groups.

29:32.540 --> 29:33.940
Really simple, really effective.

29:33.940 --> 29:34.860
That's all it was.

29:34.860 --> 29:35.820
That's all we did.

29:36.560 --> 29:45.700
The managed file payload or configuration state is the exact same as Linux one, only we don't have to set any executable permissions because Windows is going to know it's an exe.

29:45.800 --> 29:50.380
And we just copy it to wherever we want, in this case Windows temp, and run it in the background as well.

29:50.380 --> 29:54.280
So these are really, really, really simple and really, really, really effective.

29:54.280 --> 30:01.460
And I hope it kind of gets your brain turning and new ideas of things you could build really easily with these types of desired state configurations.

30:01.820 --> 30:05.840
And what's really great about these is, like I said, that concept of desired state.

30:05.840 --> 30:08.700
You are missing this from the system you just installed.

30:08.700 --> 30:10.080
Your user is not there anymore.

30:10.080 --> 30:12.020
Any of the persistence you just set up is gone.

30:12.060 --> 30:16.280
As long as it's still calling home to your salt master, you can even set it up as Java.

30:16.280 --> 30:22.780
It'll go correct itself on its own, but if you're there monitoring it or babysitting it, it's as simple as a state.apply and it'll go fix itself.

30:23.020 --> 30:29.300
So you can do it with automation, you can do it manually, whatever have you, but you can always correct to fix things as they should be.

30:30.720 --> 30:34.980
Alright, so let's talk about detecting hackers that are abusing salt stack.

30:34.980 --> 30:39.240
No red team or security team is worth their salt without helping our blue teams.

30:39.240 --> 30:41.580
We're not doing any good, we're not helping anyone.

30:41.580 --> 30:43.500
This is probably the most important piece.

30:44.960 --> 30:47.160
First and foremost, simple log analysis.

30:47.160 --> 30:48.300
Go back to basics.

30:48.600 --> 30:52.940
Check the salt minion and master logs, especially in the context of like a man-in-the-middle attack.

30:53.240 --> 31:00.180
Kind of harkening back to that screenshot from last where we pull out, hey, this might be a man-in-the-middle attack of some sort.

31:00.240 --> 31:01.920
Those logs will just tell on themselves.

31:01.920 --> 31:05.180
It's kind of your golden ticket for seeing all the minion and master communications.

31:05.180 --> 31:08.060
It will tell you who, what, when, where, what time, etc.

31:08.220 --> 31:13.240
that minions are talking to a given master, even if it is the wrong master.

31:13.460 --> 31:16.520
And so you can kind of use that in your investigation to see what's going on.

31:16.920 --> 31:19.440
Alright, so that's kind of basics.

31:19.440 --> 31:22.540
Another thing we can do is observe the network traffic patterns.

31:22.540 --> 31:25.620
While everything is encrypted, it's actually kind of easy to spot.

31:25.620 --> 31:27.200
And of course, pcapture didn't happen.

31:27.600 --> 31:30.180
In that repo, there's all the actual pcaps from the researcher did.

31:30.180 --> 31:33.100
You can go look at them yourself if you don't feel like taking your own packet captures.

31:33.240 --> 31:34.300
I'm not going to dive into this.

31:34.300 --> 31:35.360
I don't expect anybody to read it.

31:35.360 --> 31:44.000
But one thing I want to point out here is that we've remapped port 4505 to 80 and port 4506 to 443, kind of like I mentioned a couple slides ago.

31:45.140 --> 31:47.360
This is actually what's going on, though, in that pcap.

31:47.640 --> 31:54.000
So the first thing we're doing is accepting a key from a potential minion that we've actually man-in-the-middle in this case.

31:54.000 --> 31:56.580
So we've successfully pulled off a middle attack.

31:56.580 --> 31:57.880
We've got our key accepted.

31:57.880 --> 32:02.220
We're going to run a test.ping, which just says that we can talk to that minion.

32:02.360 --> 32:06.400
Then we're going to run a couple commands like whoami, id, ls, et cetera.

32:06.800 --> 32:08.920
And that's just to kind of show what's going on here.

32:08.920 --> 32:15.600
But what's actually happening in terms of communication patterns is what's important from a Blue Teamers perspective to detect.

32:15.820 --> 32:21.160
So when a minion calls home, in this case on port 80, it's going to check in on port 81st.

32:21.320 --> 32:24.600
And the master's not going to publish anything because they're not associated yet.

32:24.880 --> 32:28.880
And then it's going to go up and say, hey, on port 443, do you want to trust me?

32:28.880 --> 32:30.780
If you accept, the master's in.

32:30.780 --> 32:35.180
Now it'll send you its public key and you're good to go to keep your communications running.

32:35.880 --> 32:37.660
Here, we can execute commands.

32:37.800 --> 32:41.640
So maybe on the salt master, we'll run whoami.

32:41.740 --> 32:47.580
And then the master will publish that on port 80 in this case to say, hey, go run whoami.

32:47.580 --> 32:53.960
When the minion checks in on port 80, it'll go fetch that, run it, and then come back up to 443 and say, hey, I was rude.

32:54.200 --> 33:04.900
And kind of the pattern here that I want everybody to notice is that you'll have a connection to port 80 or port 4505 followed by one or more connections to port 443 to the exact same host.

33:04.900 --> 33:07.520
That's a pretty clear pattern that we can see carved out there.

33:07.520 --> 33:14.440
And it's even easier if they are using the default ports for 4505 and 4506 because it might give away that it's salt stack right away.

33:14.440 --> 33:16.000
But that's a pattern that you could use.

33:16.000 --> 33:27.920
So tandem with those log analysis and kind of your packet captures, you can kind of correlate these two events and say, hey, maybe this is some kind of attacker abusing salt stack as a command and control service.

33:29.200 --> 33:36.500
Another way to kind of detect this type of activity is the fact that salt master and minion installations are very, very noisy.

33:36.500 --> 33:43.620
Now, obviously, an attacker could change all of the configurations and move things to different directories or whatever.

33:43.620 --> 33:44.660
It's an open source project.

33:44.660 --> 33:46.340
So there's a lot of power they have.

33:46.340 --> 33:48.880
But by default, it is extremely noisy.

33:49.100 --> 34:08.560
So if any of these directories exist on your system, whether it's bar log salt, at C salt, serve salt, if you have a master on your system for whatever reason possible, or C colon back slash salt for Windows, if any of those things exist, it's a pretty clear sign that somebody might have installed salt stack in some shape or form on that box.

34:08.720 --> 34:13.920
Another thing to do is check your repo files or your network communications to repo.saltstack.com.

34:13.920 --> 34:20.740
Because if they're pulling from the default not compiling their own binaries, it's going to be a clear communication just like with that batch file.

34:20.740 --> 34:29.080
So if somebody just wants to go be a script kitty and pull down that GitHub project and go use it on a potential target, it's going to be real easy to pinpoint that that's happening.

34:29.380 --> 34:31.420
Like I said, it is an open source project.

34:31.420 --> 34:33.540
There's always ways to modify and change this.

34:33.700 --> 34:35.760
Those are things that I'm going to be looking into more in the future.

34:35.760 --> 34:44.140
But for the most part, it's pretty clear when somebody installs a minion , these logs and these existence of these directories is a clear indication that that's happened.

34:45.720 --> 34:55.140
A crucial thing, though, to take a look at is if you are legitimately using SaltStack in your environment, an attacker could still install a duplicate minion on a particular target they've compromised.

34:55.240 --> 35:01.680
So you'll be able to identify multiple minions in that case, because you should only really ever have one minion running on a box.

35:02.060 --> 35:04.860
It's supported to have more than one, which is why this is possible.

35:04.860 --> 35:07.680
But in a legitimate configuration, that's not recommended.

35:07.680 --> 35:09.200
So hopefully you're not doing that.

35:09.200 --> 35:13.860
If you are, here's how you might be able to detect a bad one.

35:13.860 --> 35:27.680
So when an attacker goes to install a second minion on a box, they're going to either A, bring their own minion binary, or B, use the one that you already have installed and then just point it at their bad configurations.

35:28.260 --> 35:35.720
So what you're going to want to look for in these cases are the potential usage of the same log file.

35:35.720 --> 35:47.180
So if two minions are installed and they haven't reconfigured their minion to point to a different log file, you're going to see really weird activity going on in that log from two different minions going on in the box.

35:47.180 --> 35:48.380
So you can check that out.

35:48.580 --> 35:50.620
Another thing would be your system dlogs.

35:50.620 --> 35:58.640
You can look for activity that's going on on one minion that might be similar to activity going on on the other minion, but one's not named like a minion.

35:58.640 --> 36:00.000
It's just a behavior type thing.

36:00.000 --> 36:03.220
So you notice that two services are behaving the same.

36:03.220 --> 36:04.640
One is a legitimate minion.

36:04.640 --> 36:07.540
One's like weird XYZ daemon or something.

36:07.940 --> 36:09.900
So that's stuff you may want to look for.

36:09.900 --> 36:13.560
And then of course, kind of dead giveaway that I think is going to be your network traffic.

36:13.560 --> 36:15.320
It's got to communicate back home.

36:15.660 --> 36:18.940
So if it's not talking to your master, it's probably not your minion.

36:18.940 --> 36:21.580
And so you can go trace that back to whatever your process is.

36:21.580 --> 36:26.220
So that's pretty important if you are using SaltStack in your environment because all the other ways are a little bit easier to detect.

36:26.220 --> 36:29.240
These are the things you're going to want to look for if you already have minions installed.

36:31.000 --> 36:33.200
So that's kind of all the things I wanted to cover today.

36:33.320 --> 36:41.080
To wrap this up, I wanted to say, hey, go check out Salt if you're looking for a potential tool for your configuration management or any of the tools really.

36:41.080 --> 36:42.340
I'd just favor this.

36:42.520 --> 36:48.700
It's great for operations, great for blue teams, and seems pretty fun to use as a red team tool potentially as well.

36:49.120 --> 36:50.640
A couple of appreciation shout outs.

36:50.640 --> 36:52.080
First and foremost, Seth.

36:52.080 --> 36:57.400
The only reason I even chased down this research, he was one of our DevOps on the team at the time.

36:57.700 --> 37:01.980
Really educated me a lot on the platform and I kind of took this home and ran with it from there.

37:02.360 --> 37:04.900
Chris and Robert, always being real supportive.

37:05.240 --> 37:10.800
Daniel Robertson, Dan Borges, both of these two have been great influencers, mentors, whether they realize it or not.

37:10.860 --> 37:13.760
And then Camilla, also a great supporter of my life.

37:14.520 --> 37:15.620
A couple of references.

37:15.620 --> 37:18.420
Like I said, these slides will be available on that GitHub repo.

37:18.760 --> 37:20.420
I want to point out Seth's brain again.

37:20.560 --> 37:21.740
That guy's really smart.

37:22.480 --> 37:24.100
And with that, we have questions.

37:44.410 --> 37:46.510
Can you repeat that?

37:46.510 --> 37:47.250
I'm sorry, I didn't hear you.

37:48.610 --> 37:48.970
Yeah

37:54.660 --> 38:06.720
, so the question was, is it better to, or not is it better, was the second option for mitigating the issue to automatically accept minions to the master.

38:06.720 --> 38:08.620
And yes, that was the second recommendation.

38:14.050 --> 38:18.710
Yeah, and that's absolutely true, which is why is okay, but definitely not the best idea.

38:18.710 --> 38:21.930
The best solution is just to install the fingerprint where it should be in your configuration.

38:21.930 --> 38:23.010
That's absolutely true.

38:28.830 --> 38:29.790
What's up?

38:30.310 --> 38:32.610
You spoke briefly of desired state.

38:32.610 --> 38:36.650
I know that after like a pentesting engagement, we want to get everything back to normal.

38:36.650 --> 38:40.070
Can we use desired states to get back to that normal?

38:40.270 --> 38:48.530
Yeah, so you'd have to know and coordinate with your red teams or your pentest teams to know exactly what they installed and anything like that as well.

38:48.530 --> 38:57.410
But if you potentially wanted to use that as a way to clean up after known good engagements, rather than having to go back and maintain up, that is absolutely an option.

38:57.410 --> 39:03.050
So you can build your states around what you know that you've done and work with those offensive security people to execute on those states.

39:03.050 --> 39:05.230
So that's definitely an option to help make cleanup quicker.

39:23.300 --> 39:35.020
Yeah, so I don't know exactly where I'll dive down in terms of that, but I do definitely want to explore other new tools or existing tools to see if there's anything better than doing things with SaltStack as we've done it, because it's definitely possible.

39:35.020 --> 39:37.420
Like I said, any of these do all do about the same thing.

39:37.420 --> 39:42.640
So you can accomplish anything that we've shown in SaltStack today with another one of those tools like Puppet Chef or Ansible.

39:42.640 --> 39:46.820
It's the idea of just using these tools from the perspective of the adversary.

39:56.260 --> 39:57.040
All right, cool.

39:57.060 --> 40:00.560
Well, I'll be around if you want to ask me any other questions, but thank you all for coming.

