Latest / Blue Security / Kerberoasted
Transcript
- 0:06Welcome to the blue security podcast, a weekly podcast for
- 0:10information security Defenders, where we bring you two sessions
- 0:13on best practices, tools and implementation for Enterprise
- 0:17security. Now here are your hosts for
- 0:19today's show, Andy jaw and Adam Brewer.
- 0:21Welcome to another episode of the blue security podcast.
- 0:24I'm Andy your host. Ian the Adam your co-host Adam.
- 0:27We totally forgot to mention we are now in our third.
- 0:30Third year of the podcast episode 106 tonight.
- 0:34So thank you to everyone who has been listening since the start
- 0:39or if you coming on late, we really appreciate all the
- 0:42feedback that we've gotten and certainly we enjoy doing this
- 0:45because of contributing back to the community.
- 0:48So thank you to all our listeners for a successful two
- 0:51years and hopefully, too many more.
- 0:53So starting our third year this year, it's incredible.
- 0:56I remember starting this in the height of the covid-19.
- 1:00Pandemic and a lot of people started podcast then because it
- 1:03was a great thing to do when you're kind of stuck in your
- 1:05house and can only talk to people online.
- 1:08And the one thing I didn't want us to do was record like six
- 1:12episodes and give up on it. One of us, if we're going to do
- 1:14this, we're going to stick with it.
- 1:15And one of the things I'm most proud of and you mentioned, this
- 1:18is episode 106. So, two full years plus another
- 1:22two weeks, we've released a new episode every week.
- 1:25Now, it's not always been easy because one of us has been out,
- 1:28you know, vacation or I can't record for whatever reason, and
- 1:31we've always found a way to make it work, so that there was new
- 1:34content every single week and that's real dedication.
- 1:36I mean I'm not asking for a metal or anything, but we do
- 1:40record multiple episodes in a night or we record on weeknights
- 1:43or other abnormal times just to make sure we always have
- 1:47something ready to go every single Sunday and it's been a
- 1:50real pleasure. Like Andy said to hear from the
- 1:53community and maybe give back in our own small way.
- 1:55It's a business that never stops changing and thankfully we've
- 1:59never had to worry about. Running out of things to talk
- 2:01about because that was another concern early on and I think
- 2:04Andy's got a list a mile wide of topics we could talk about and
- 2:07then before we even get to some of those Evergreen topics.
- 2:10You know there's always some breaking news to cover as well
- 2:13so I don't worry about us running out of things to talk
- 2:15about anytime soon. It's been a wild ride.
- 2:17Thanks for listening and looking forward to tonight's
- 2:20conversation. What do we have Andy?
- 2:21So we're going to start off with someone that I follow on
- 2:25Twitter. And Linkedin is name is Heath
- 2:27Adams. He's a great person, he's a
- 2:28veteran, he He is a Founder 40cm security.
- 2:32And they're in education company, they're a good
- 2:35alternative to the certified ethical hacker through
- 2:38ec-council. If you don't like that
- 2:40particular certification, TCM security has their own practical
- 2:44Network, penetration, tester, certification p.m.
- 2:47PT, and it's a very good certification.
- 2:50It's very cost-effective. So I follow him and he is a pen
- 2:54tester. And so he posted that he was
- 2:56doing an internal pain test and he was able to get domain I'd
- 3:00been in a very unique way and I wanted to walk through his post
- 3:02because I think it's always valuable for Defenders to
- 3:06understand how attackers are successful.
- 3:08That way we can get better at defending and vice versa to.
- 3:12So the organization that he was up against had a bunch of mixed
- 3:16security. So he said that they could
- 3:18perform something called LM and R which is link-local multicast
- 3:23name resolution poisoning won't talk about that specifically
- 3:26this episode but will dive deeper into that particular
- 3:29method. Dove attack at a later episode
- 3:31but having done that, they already captured 50 or so hashes
- 3:36and cracked about 50% of those. So some metrics that we looked
- 3:40up actually. Because one of the things we'll
- 3:42talk about tonight is Kerberos thing and that does require
- 3:45cracking passwords and hashes Adam and I looked up how long it
- 3:48takes to crack a password using like a modern GPU like the r-tx
- 3:533090 and if you're using a very old password policy or if you
- 3:58have surface accounts or accounts, Set.
- 4:00Haven't had their password changed in many, many years and
- 4:02are still following the old eight character standard today's
- 4:06gpus can crack that in about 39 minutes.
- 4:09Even if it's complex, if it's upper lower numbers, symbols, an
- 4:14eight character password is 39 minutes using a modern GPU and
- 4:16that's not even like multiple gpus, we're just talking one
- 4:19GPU, so not very secure. So in this case, they've already
- 4:23cracked about 50% of those, none of those users that they cracked
- 4:26had local admin rights. So it made lateral movement.
- 4:29Very Difficult. So it eliminated a lot of the
- 4:31relay attacks like SMB relays IPv6, unless they were able to
- 4:35catch a domain admin account in action, which they didn't the
- 4:38organization also used. Laps had decent Enterprise AV,
- 4:42and was using a really expensive EDR.
- 4:44They're patching was super strong.
- 4:45There were no default credentials, being used
- 4:47anywhere. There are no fancy attacks in
- 4:49play like Petit, podem know, packed print, nightmare Sandy
- 4:52admin. Everything was patched.
- 4:54And there were no service accounts to Kerberos, we're
- 4:57going to dive into Kerberos sitting in a little bit, but
- 4:59This is important here that they did scan for this and that there
- 5:02were no service Council Kerberos overall, it was a timely
- 5:05engagement so they had a limited time to figure out if they could
- 5:08get domain admin. So came down to finding a needle
- 5:11in a haystack or getting an admin, counter relay via IPv6
- 5:14and he said, he found the needle.
- 5:16And here's the walkthrough one of the cracked accounts had an
- 5:19overly permissive access to the file shares and then they were
- 5:22able to see the users personal shared folders within the share
- 5:27folder of a domain admin. There was a computer set up.
- 5:29Up instruction document and within that it contained a local
- 5:34admin password they were using laps but he was like, well one
- 5:37could hope. And so he used crack map XE to
- 5:40spray the password across the network and it was successful on
- 5:43one machine, just one and he used secret stumps on that
- 5:47machine and there was a domain admin account, in, clear text,
- 5:50it was being used as a service, the password was stored in the
- 5:53registry and he was able to log into the domain controller using
- 5:56that. So, overall, again, kind of
- 5:58similar to what we Well, last week with Uber, I mean, it was
- 6:01just like one thing and they were in.
- 6:04So this came down to a computer setup instruction with a
- 6:08password in clear text. And he only had to get it to
- 6:10work on one computer, and he was very lucky.
- 6:12That within that computer, there was a domain admin account
- 6:15that's being used as a service. So, I just thought it was really
- 6:18interesting how he did it, and then part of it was that he
- 6:21scanned accounts to Kerberos and then I wanted to talk about what
- 6:24Kerberos thing was because I didn't really know.
- 6:26So I looked it up and I'm going to educate everybody on it.
- 6:29That walkthrough, for those of you who love a good analogy
- 6:34reminds me of Texas Hold'em. And there's this concept where
- 6:38if you have a hand where you, you have three of the five
- 6:41cards, you need to make a hand. And so, the fourth Community
- 6:44card or the turn, and the fifth Community card or the river,
- 6:48both are the cards you need. It's called going Runner Runner
- 6:51and it's not something you should try to do because the
- 6:54odds are so poor against it. Usually what happens is it?
- 6:57It happens like a newbie. It happens against Where
- 7:00somebody should have laid down their hand, but they kept it and
- 7:03they go Runner Runner and then beat you in a way.
- 7:05So, for example, maybe somebody was holding part of a straight
- 7:09flush, you know? Maybe they had the four, five,
- 7:11six of hearts, and then the turn is the seven of hearts.
- 7:14And then the rivers, the eight of Hearts.
- 7:15So they went run a runner to get a straight flush and beat you.
- 7:18That'd be super frustrating, right?
- 7:20That's like almost about this is here like this isn't like oh
- 7:23look at you know how bad your security is or anything, they
- 7:25went like Runner Runner to get a like three times.
- 7:28It was Runner Runner. Runner.
- 7:30Get one document that had a local admin password in its prey
- 7:34and find it on one computer where it's still being used.
- 7:37And then that computer has domain admin in clear text?
- 7:40Like you didn't, I mean, they did the work and like they found
- 7:43a way to get there, which is what attackers will do.
- 7:46I'm not being dismissive of this but like this is not endemic bad
- 7:50security at all. In fact, this is really good
- 7:52security and I guess Andy to your point it just shows you
- 7:55like you only need one thing to go wrong and then they can
- 7:58almost get to the Keys of the Kingdom.
- 7:59X. This is honestly like almost a
- 8:02Hollywood Story for Security Professionals, that's crazy.
- 8:05So I mentioned that they did scan to see if any service
- 8:08counts were Kerberos the bowl and what is Kerberos Ting.
- 8:12So I didn't know what this is and I thought let's learn about
- 8:16it because it is definitely an attack that can happen today and
- 8:19there are things that you can do to mitigate against it.
- 8:22So it is a technique that an attacker.
- 8:24Once they're inside your environment, they can try to
- 8:27crack the password of a service account.
- 8:29With in active directory, very important that they already need
- 8:32to have access to your environment in order to do this.
- 8:35This is a post exploitation technique, right?
- 8:38This is not a vulnerability, although it does kind of exploit
- 8:42how the architecture of a D&E is but that's not something that we
- 8:46can fix today. I mean, that's just an
- 8:47architectural design, that is probably flawed at this point,
- 8:50but it was designed many, many years ago, with not this in
- 8:53mind. And so either through a
- 8:55vulnerability or phishing attack, the attacker gets a
- 8:58compromise to Main You have to have a domain user in an order.
- 9:01For this to work, they scan ad for user accounts with SP n
- 9:05values set and admin account equals 1.
- 9:09This can be done either, via power shell, or ldap, queries,
- 9:12using scripts in Kerberos Ting tools.
- 9:14Like powersploit. Once Target accounts are found.
- 9:18If they do find any counts with those SPN value, set, the
- 9:21attacker can then request a service ticket from ad, using
- 9:24the ESPN values with tools like ghosts packs Rubeus.
- 9:28And then the ticket, Pains an encrypted password or Kerberos,
- 9:32the attacker will extract the service tickets and hashes to a
- 9:35the memory using tools. Like MiMi cats and save that
- 9:38information to a file. And then the attacker Brute
- 9:40Force has that password offline using like hash CAD or John, the
- 9:44Ripper. And so it's really hard to
- 9:46detect because there's no domain traffic.
- 9:48There's no user lockouts because their brute forcing that hash
- 9:51offline. And as we mentioned, Adam, as
- 9:54soon as he saw this, when we were talking through this, in
- 9:56the pre notes, he was like, well, wait a minute, you got a
- 9:58Brute Force, this offline. How long is that going to take?
- 10:00That could take a long time. Yeah, it can.
- 10:03If you're using, like, a 32 character, completely random
- 10:06passwords for sure, that's not brute forcible.
- 10:08But if you're using and I mentioned, you know, ad this is
- 10:12you have service accounts at probably number one, password,
- 10:14never expires. Number two, could be years or
- 10:17even decades in use that the passwords never changed because
- 10:20their service accounts and if you change the password that can
- 10:22break the surface and so very much like if it ain't broke,
- 10:25don't fix it. Many people are very, very
- 10:28conscious of not Changing service account passwords and so
- 10:32this is very doable if you're not doing very good account,
- 10:36hygiene. And so once they brute-force the
- 10:38password, then they have the password and then they can use
- 10:40that account and move laterally, find an account with privilege
- 10:43and escalate from there and so on and so forth.
- 10:45So, it's really dangerous because number one, most
- 10:47traditional cyber security tools are not designed to monitor or
- 10:50analyze behavior of approved users, right?
- 10:53Once they have that password and it's a credential that is valid
- 10:56your security tools generally don't pick up on that.
- 10:59Right there logging in as a valid User.
- 11:01It's almost never designed to look for those sorts of things
- 11:04and because there's no malware deployed, there's no other fishy
- 11:09activity going on. There's nothing to pick up,
- 11:11right through using a valid SPN, value to get a Kerberos ticket
- 11:15and they brute force, it offline.
- 11:16There's no trace of it and then they're logging in with a valid
- 11:19user after that. The other thing is, it doesn't
- 11:21require domain admin account or even one that has elevated
- 11:24privileges, it just needs a domain user.
- 11:26So any account that can request a service ticket, It can be used
- 11:30in this attack. So lot of really bad things.
- 11:33It's really dangerous really hard to detect, which is why
- 11:35it's still being used today. So, how do you protect against
- 11:39this? So number one, you got to find
- 11:41your Kerberos double possible targets and how do you do that?
- 11:45You do it the same way that the attackers actually do it, you
- 11:47scan your accounts to see if there's anything using that SP n
- 11:50value. So you can do this with no third
- 11:53party tools, just using DNS query which is built into
- 11:55Windows Server. Since 2008 or from installing
- 11:59our Tools, once you have the accounts, right, once you're
- 12:02scanning those Kerberos double targets.
- 12:04So not going to like list. The particular command will post
- 12:08some documentation in the show notes, but you can look for
- 12:10this, figure out what the DS query is to find your targets.
- 12:13Once you have those targets, let's say you do have Kerberos
- 12:16the bowl. So it was kind of like best case
- 12:18scenario. You don't have any like in this
- 12:19pen test. He didn't find any right?
- 12:21If you didn't have any rate awesome but if you do you have
- 12:25really two options, you can either clear out the service
- 12:27principal name attribute that P n value or you can give that
- 12:32user and uncrackable. Password, if you have a longer
- 12:35password, it will be too long to Brute Force.
- 12:38Right? Both are valid but couple things
- 12:39because you might break things in order to avoid breaking
- 12:42things. You have to verify that the host
- 12:46and the service listed for the attribute for that user account.
- 12:49Either do not exist or are no longer in use, right?
- 12:52So if you have that SP n value, but that account is being used.
- 12:56Great, just clear out the value in your good.
- 12:57If they are still in use. You can transition the service
- 13:01to use the host account or computer account, not a user
- 13:05account, this attack only works for user accounts that can
- 13:07request a Kerberos ticket. So if you're transitioning, the
- 13:10service to run as system and handle the authentications that
- 13:13way, there's nothing to curb roast, right?
- 13:15There's no user to authenticate anymore.
- 13:17It's just the host so transition it to the host.
- 13:19If you can host base, spns are not vulnerable to curb roasting
- 13:22attacks. It's usually a complex key.
- 13:24That is refreshed every 30 days there is no password, so
- 13:28transition it to a host. Base SPN versus a user base
- 13:31ESPN, most user. SPN accounts are selected by
- 13:34humans and soul usually, you know, they pick some easy
- 13:37password that they can remember, and that's why we have this
- 13:40attack. The other option is to give that
- 13:42user account and uncrackable password.
- 13:44And if you do that, then you need to make sure that you re
- 13:47configure everything that's using that.
- 13:49So the biggest issue is if you have a ton of Kerberos double
- 13:53users, you'll need to prioritize your efforts based on the risk
- 13:57of each one which services. Vulnerable.
- 14:00And which one is most important to your company?
- 14:03So that is something that can be an issue.
- 14:05If you're in a large organization and you run this
- 14:07query and all of a sudden, you have a couple hundred user
- 14:10accounts that are Kerberos, will that would be a bad thing.
- 14:13You can use tools, that can automate it.
- 14:15For example, like Bloodhound Enterprise, which is an add
- 14:19query tool that attackers often use.
- 14:21Actually, there's a lot of EDR, tools that will detect against
- 14:24Bloodhound, but they have an Enterprise internal blue team
- 14:27tool that you can use to basically automate changing the
- 14:31passwords for multiple Kerberos table accounts.
- 14:34So look into that. But yeah, that's how a few
- 14:36things that you can do to remediate that.
- 14:38Once you have that scan, this is really interesting.
- 14:41Just like you said, not a vulnerability, but post
- 14:44exploitation tactic, or whatever you want to call it.
- 14:47I had always heard about this but didn't know how it actually
- 14:49worked. And yes, we did have that
- 14:51conversation kind of in the pre-show about cracking
- 14:53passwords and you know a couple of the points you made to me as
- 14:56well. Andy were that given how long
- 14:58active directory has been? Round it debuted, 23 years ago.
- 15:02It is possible that some of these passwords are extremely
- 15:05old and aligned to security principles that we no longer
- 15:09subscribe to today. So the passwords might be far
- 15:12less complex than we would expect a modern password to be
- 15:15and so with that that would make them pretty easily crackable.
- 15:18If you can dump some of these hashes offline and go to town,
- 15:21you could find some hits and the more Kerberos double accounts,
- 15:24you have the more likely, the bad guys will find something.
- 15:27And so at least there's good mitigations in Lace.
- 15:29It is possible to mitigate it. You heard that pen test where
- 15:32they found? No Kerberos double accounts so
- 15:35it is possible and other organs have eliminated their attack
- 15:38surface in this space. So that's a North star for
- 15:41anybody listening who hasn't done the work.
- 15:43Yet it is possible. So cool stuff here, do we have
- 15:46anything else Andy? Yeah, I mean there's other
- 15:48protections obviously. Like yeah, if you have a user
- 15:50account, right? If they're have MFA enabled,
- 15:53that makes it less likely that the attacker can get access to
- 15:57the environment. Hopefully, you have some sort of
- 15:59Faith for your VPN or anything like that.
- 16:02But you know, that's one of the medications you should identify
- 16:04any privilege, service counts. I always was very cautious when
- 16:09we got a new product, you know, companies that I worked at and
- 16:13they're like, yes, we need a service account with global
- 16:16admin rights. We need a service account with
- 16:18domain admin rights. It's like, do you really need
- 16:21that? Like exactly what permissions do
- 16:23you need, you know? So it's very rare that Services
- 16:27actually need to run as domain admin.
- 16:29It's usually the easy button, but I'm almost 99% sure that the
- 16:35majority of products that you buy can be scoped to specific
- 16:40permissions rather than just giving them the domain admin
- 16:43button, right? And then you can also use
- 16:45groups, managed service accounts GM essays which have random
- 16:49complex passwords that are automatically rotated and
- 16:52centrally managed within a d. So a lot of companies use user
- 16:55accounts as service accounts but you can use GM SAS which is The
- 17:00equivalent to like service principles.
- 17:02If you're familiar with Azure and the cloud side, service
- 17:06principles are accounts that cannot be logged into they run a
- 17:10service. So there's no authentication for
- 17:13like a user. There's no MFA.
- 17:14It just runs as a service. So yeah, transition to GM
- 17:18essays, I mean they've been around for a long time.
- 17:20They're not too difficult to work.
- 17:22They do require some configuration on the ad side in
- 17:25order to get it to work, but you can easily use those to run your
- 17:28services rather than than a user account.
- 17:31Those are some other medications that you can have.
- 17:34Well, hopefully, you guys learned something about Kerberos
- 17:36Ting. I thought that was really
- 17:38interesting to dive into, I didn't know much about it.
- 17:41Like Adam said, you know, this is something we've heard about,
- 17:43but didn't really know because we're not pentesters, we don't
- 17:46really do this type of attack, but I always think that it's
- 17:49good to learn about the stuff so that, you know how to defend
- 17:51against it. That's our show for this week.
- 17:53Thanks as always for listening and watching, our contact
- 17:55information will be in the show notes.
- 17:56If you have any questions or content that you want us to go
- 17:58over top, Talk about on future shows, thanks.
- 18:00We'll talk to you guys next week.