1 00:00:00,000 --> 00:00:01,500 Okay. 2 00:00:01,500 --> 00:00:10,400 I am with the Packet Hacking Village, and this particular speaker is being sponsored by us. 3 00:00:10,400 --> 00:00:17,760 And we are delighted to present Brandon Colley, who is going to obviously talk to you about Active Directory. 4 00:00:17,760 --> 00:00:25,560 He has been... he'll tell a little bit about himself, but he works for Trimark Security, and I'm also proud to call him friend. 5 00:00:25,560 --> 00:00:26,660 Take it away. 6 00:00:26,660 --> 00:00:27,220 Thank 7 00:00:31,370 --> 00:00:33,310 you, Kathy. 8 00:00:33,310 --> 00:00:34,270 Friend Kathy. 9 00:00:34,270 --> 00:00:36,030 Investigator chick, everybody. 10 00:00:37,630 --> 00:00:38,330 All right. 11 00:00:38,330 --> 00:00:39,890 Can you guys hear me okay in the back? 12 00:00:39,950 --> 00:00:40,930 Awesome. 13 00:00:40,930 --> 00:00:42,190 Let's do this. 14 00:00:42,230 --> 00:00:47,230 So title, as you all know, is Winning the Game of Active Directory. 15 00:00:47,470 --> 00:01:00,270 So a little bit about myself is I served in an operations role, managed Active Directory for about 15 years for multiple different organizations before I joined Trimark about two and a half years ago. 16 00:01:00,270 --> 00:01:08,750 I was a senior security consultant for them and just got promoted to the service lead role for our Microsoft Cloud assessment. 17 00:01:09,050 --> 00:01:14,350 So I'm kind of joking and saying that this might be my last on-prem Active Directory presentation. 18 00:01:14,650 --> 00:01:19,390 So maybe next year you'll come to see, like, Winning the Game of Entra ID or something like that. 19 00:01:20,750 --> 00:01:25,990 Recently founded my own company and got a logo created, so I threw it up there. 20 00:01:25,990 --> 00:01:28,810 So B&R Consulting is a company that I just started. 21 00:01:28,810 --> 00:01:30,370 I'm a father. 22 00:01:30,890 --> 00:01:33,250 Here's one of my kids with me at a Chiefs game. 23 00:01:33,250 --> 00:01:34,050 I saw a Chiefs hat. 24 00:01:34,050 --> 00:01:35,050 Go Chiefs! 25 00:01:35,710 --> 00:01:42,170 And my wife Bridget came with me today, so I am a very loving husband, as I hope she'd also agree. 26 00:01:42,610 --> 00:01:46,010 First time at DEF CON as well, so... 27 00:01:51,320 --> 00:01:57,260 And so before we really start digging in, I want, I mean, the title of the game is How to Win the Game of Active Directory. 28 00:01:57,420 --> 00:02:01,860 So let's talk about what I'm talking about when I talk about the Game of Active Directory. 29 00:02:01,860 --> 00:02:06,640 So GoAD, as I like to call it, or somebody said GoAD. 30 00:02:06,640 --> 00:02:12,320 So Prebuilt Active Directory Lab is a multi-domain environment. 31 00:02:12,320 --> 00:02:21,140 They have multiple different builds that you can create and touts over 30 different vulnerable configurations just out of the box. 32 00:02:21,160 --> 00:02:25,200 It's created and maintained by Mayfly of Orange Cyber Defense. 33 00:02:25,200 --> 00:02:30,220 And Mayfly gave me permission to go ahead and use this in the presentation. 34 00:02:30,220 --> 00:02:34,300 He just wanted to know when it gets posted online, and he wants my slides. 35 00:02:34,300 --> 00:02:40,260 So it was originally created for penetration testers to practice attacking Active Directory. 36 00:02:40,260 --> 00:02:46,520 So real quick, where are my penetration testers in the audience, or any red team side people? 37 00:02:46,520 --> 00:02:48,520 How about anybody on the blue side? 38 00:02:48,860 --> 00:02:50,320 Okay, so we're heavily blue. 39 00:02:50,320 --> 00:02:50,760 Awesome. 40 00:02:50,760 --> 00:02:53,940 And then everyone else is just unaffiliated, I'm assuming. 41 00:02:54,440 --> 00:02:56,000 You don't get a vote. 42 00:02:57,060 --> 00:03:01,840 So when you start playing a game, first thing you have to do is character selection screen, right? 43 00:03:01,840 --> 00:03:08,220 So we can choose to be a penetration tester, which your job is to exploit vulnerabilities, misconfigurations. 44 00:03:08,720 --> 00:03:18,660 Moving to a little bit of a red teamer, you're going to start looking a little bit more at testing detections and doing a little bit more stealthy activities when performing Active Directory tests. 45 00:03:18,700 --> 00:03:32,040 And then our defenders, like most of you, are looking forward to learning how to harden your environments, performing consistent monitoring of those environments, and just consistently improving the overall security posture of your Active Directory. 46 00:03:32,860 --> 00:03:39,720 The other character you could choose is to be an adversary, so I'm going to assume that the rest of you who didn't raise your hands are my adversaries, right? 47 00:03:39,740 --> 00:03:41,620 But they don't play by the rules anyway. 48 00:03:42,740 --> 00:03:45,840 So the most important rule when you play a game is how do you win, right? 49 00:03:45,840 --> 00:03:48,900 And that's what I'm here to talk about, is how do you win the game of Active Directory. 50 00:03:48,960 --> 00:03:54,080 And a lot of people think that you can win the game of Active Directory by gaining domain admins, right? 51 00:03:54,080 --> 00:03:55,760 That's the keys to the kingdom. 52 00:03:55,760 --> 00:03:58,240 Once you get domain admin, it's game over. 53 00:03:58,380 --> 00:04:00,320 It may be a spill of data. 54 00:04:00,320 --> 00:04:04,760 Maybe you want some of that juicy information that's in Active Directory. 55 00:04:05,220 --> 00:04:11,180 Or maybe you just want to create persistence and you want to be slow and methodic about your efforts. 56 00:04:11,200 --> 00:04:28,320 However, I'm here to kind of challenge that a little bit and say that the way that you truly win the game of Active Directory, regardless of which character you choose, is to maintain a secure environment, continuously improve that environment, and implement the safeguards that are needed to keep your Active Directory safe. 57 00:04:28,320 --> 00:04:30,100 And also continuous progress. 58 00:04:30,180 --> 00:04:33,320 So what I'm here to do today is kind of show you both sides of that. 59 00:04:33,320 --> 00:04:37,760 I'm going to take a little bit of an attack methodology and also defense methodology. 60 00:04:37,760 --> 00:04:43,780 So we have a... Ted Mosby likes to say, we have a tightly scheduled evening of awesomeness ahead of us, so let's go. 61 00:04:43,780 --> 00:04:46,220 And I guess technically now it is evening. 62 00:04:46,220 --> 00:04:47,840 Or afternoon, anyway. 63 00:04:47,840 --> 00:04:51,640 So our agenda, we're going to stick with the gameplay idea. 64 00:04:52,160 --> 00:04:54,220 We've got three different levels. 65 00:04:54,320 --> 00:04:58,200 So level one, we're going to call Reconnaissance, Enumeration, PrivEsc. 66 00:04:58,200 --> 00:05:03,180 And then level four is when we pwn Active Directory, and that's really our end boss. 67 00:05:07,780 --> 00:05:19,540 So starting off with Reconnaissance, our first question when we are either protecting or attacking Active Directory is kind of what's visible with simply network access. 68 00:05:19,540 --> 00:05:27,420 No usernames, no passwords, we just are on the network, and maybe in this case we just know the IP address of a domain controller. 69 00:05:27,420 --> 00:05:33,680 So here's an example of using CrackMap Exec, and this is our first misconfiguration, which is called anonymous access. 70 00:05:33,680 --> 00:05:46,780 If this is configured in your domain, anybody with network access, direct line of sight to your domain controller, can query for a list of users, as well as some of the public information, such as description. 71 00:05:46,780 --> 00:05:59,040 And so here if we drill in, we identify that we've already got our first credential in Samuel, who must have had an administrator put his password in the description field for some odd reason. 72 00:06:00,440 --> 00:06:05,100 So how do we mitigate this, other than just don't put passwords in description fields, right? 73 00:06:05,100 --> 00:06:12,580 That's kind of the obvious one here, is removing these groups from your domain. 74 00:06:12,580 --> 00:06:14,620 Domain root, sorry. 75 00:06:15,040 --> 00:06:31,780 The pre-Windows 2000 group, I'm not saying to delete this from the domain root, but if the members of this include the everyone group, or the authenticated, I'm sorry, not authenticated, the anonymous logons group, then this is possible. 76 00:06:32,000 --> 00:06:45,800 In the Go lab, the screenshot on the right is actually how it was configured, is you're just giving root access to anonymous logon, and that's what enables the ability to see everything without having any sort of initial user. 77 00:06:46,560 --> 00:06:50,280 So once we've removed that, we rerun the attack, we get nothing. 78 00:06:50,440 --> 00:06:58,280 So we get an error message, nothing comes back, anonymous access no longer relevant, so now we have to dig in a separate way. 79 00:06:58,980 --> 00:07:02,880 So if we can't do it anonymously, we're going to have to build a user list. 80 00:07:02,880 --> 00:07:12,700 And so the game of Active Directory, if you've used it before, you may know it's based on the game of Thrones, which is kind of where the game of thing comes from, right? 81 00:07:12,700 --> 00:07:16,000 So this is a good place for us to start scraping credentials. 82 00:07:16,480 --> 00:07:19,300 I'm sorry, not credentials, usernames. 83 00:07:19,300 --> 00:07:25,340 So we're going to pull out the first names, last names, combine those, and form a user list. 84 00:07:25,520 --> 00:07:31,780 So the screenshot on the left is the user list that I'm using, which is a first name dot last name. 85 00:07:31,780 --> 00:07:35,660 That's the methodology that's used in the lab. 86 00:07:36,160 --> 00:07:44,940 But in your environments, it might be first initial dot last name, you might not have a dot, it might be your last name and then your first name, something like that. 87 00:07:44,940 --> 00:07:48,200 So we can go ahead and we can throw all of those into a user list. 88 00:07:49,060 --> 00:07:54,220 And then we can attack Active Directory, still anonymously, using a script like this. 89 00:07:54,220 --> 00:08:00,640 So this is just an in-map script that all you need to have is your user list in a text file. 90 00:08:00,640 --> 00:08:07,440 And again, the domain IP, and what it's going to do is it's going to attempt to authenticate to Kerberos, or it's going to query Kerberos. 91 00:08:08,660 --> 00:08:11,080 Kerberos is going to come back and tell you one of two things. 92 00:08:11,080 --> 00:08:14,560 It's either going to say, yeah, that's valid or no, that's invalid. 93 00:08:14,560 --> 00:08:19,640 So now we've got a list of nine valid accounts that were in that file. 94 00:08:19,640 --> 00:08:22,340 And so now we know who we can attack. 95 00:08:22,340 --> 00:08:23,980 And you guys might say, hey, it's not fair. 96 00:08:23,980 --> 00:08:25,780 You knew it was the Game of Thrones. 97 00:08:25,780 --> 00:08:26,940 So you knew who you were attacking. 98 00:08:26,940 --> 00:08:36,740 Well, there are plenty of lists out there on GitHub that you can just do a very top 100 common names, and you can do the same style of attack. 99 00:08:36,740 --> 00:08:40,380 And once you get one or two hits, then you kind of know the naming convention. 100 00:08:40,660 --> 00:08:48,120 And then you just go out to LinkedIn and you search up Microsoft or whoever you're attacking, and you scrape from there. 101 00:08:48,120 --> 00:08:52,080 So this is real-world stuff that you can obviously do. 102 00:08:53,860 --> 00:08:59,160 And so the reason that this works is it's ingrained in the Kerberos protocol. 103 00:08:59,160 --> 00:09:05,120 So if an account doesn't exist, then you're going to get this first error message, which is that the principle is unknown. 104 00:09:05,160 --> 00:09:09,900 If the user does exist, you're going to get one of those other two responses. 105 00:09:09,900 --> 00:09:13,400 And that's basically what happens under the covers of this nmap script. 106 00:09:13,400 --> 00:09:15,220 Sorry, I'm going to drink, and this is weird. 107 00:09:26,770 --> 00:09:35,690 Okay, so the fix for this is not easy and sometimes not even possible. 108 00:09:35,950 --> 00:09:40,910 And this is a no-fix bug, I guess you can say. 109 00:09:40,910 --> 00:09:44,770 Microsoft doesn't consider user enumeration to be a bug. 110 00:09:44,770 --> 00:09:56,030 So the best thing that we can really offer is just, if you're looking at being able to change things, is don't use the same email address that you use for your same account name or vice versa. 111 00:09:56,550 --> 00:10:03,590 Instead, maybe create some sort of non-standard naming convention by throwing something about the department or the type of person. 112 00:10:04,010 --> 00:10:09,930 Like I used to work at a university, so maybe like a F for faculty, S for staff, A for administration. 113 00:10:10,150 --> 00:10:14,110 Maybe you do F for finance, I for IT, something like that. 114 00:10:14,110 --> 00:10:17,730 Or probably the best thing to do is use multiple trailing digits. 115 00:10:18,470 --> 00:10:29,030 And this is going to exponentially create a whole lot more trouble where you're going to have to have a much larger user list and a whole lot more time to be able to really enumerate a full contents of Active Directory. 116 00:10:29,130 --> 00:10:31,010 And I understand that this is hard. 117 00:10:31,990 --> 00:10:37,310 Mitigations are more around password policies, which we're going to attack here in a little while. 118 00:10:37,890 --> 00:10:48,750 But because I talked about the Kerberos protocol, I want to go back through another anonymous thing that you can do, is attack Kerberos pre-authentication. 119 00:10:48,750 --> 00:10:50,710 And so this is known as an AS rep-roast. 120 00:10:50,710 --> 00:10:56,590 And so this is what it looks like when you perform an AS rep-roast attack using the ImpactKit toolkit. 121 00:10:57,250 --> 00:11:03,510 And accounts that do not require pre-authentication are going to come back and give us a password hash. 122 00:11:03,510 --> 00:11:09,370 So in this case, Brandon Stark, no relation by the way, gives us password hash for free. 123 00:11:11,390 --> 00:11:24,470 And with that, we can use Hashcat or John the Ripper or some other offline attack tool where we can throw this through, and I just threw it through a ROKU, which is just a typical user list, password list, sorry. 124 00:11:24,790 --> 00:11:30,070 And we get the cleartext credentials in just a matter of a few minutes. 125 00:11:34,670 --> 00:11:37,730 So fixing this is pretty easy. 126 00:11:37,890 --> 00:11:39,550 It's just a checkbox. 127 00:11:39,550 --> 00:11:44,150 So there is a Kerberos pre-authentication checkbox on user accounts. 128 00:11:44,150 --> 00:11:46,890 It says do not require Kerberos pre-authentication. 129 00:11:46,890 --> 00:11:52,450 This is a super, super legacy thing, pretty free of a win in an environment. 130 00:11:52,450 --> 00:12:03,510 So if you've got any of this in your environment, removing that checkbox is going to mitigate it, which means after we remove that checkbox, Brandon no longer gives out his password freely. 131 00:12:03,870 --> 00:12:10,230 So we're going to have to attack the passwords using some of the more well-known styles of password attacks. 132 00:12:18,400 --> 00:12:23,460 Okay, so password attacks kind of fall into a few different categories. 133 00:12:23,460 --> 00:12:27,660 And so we're going to attack password reuse by doing a password spray. 134 00:12:27,660 --> 00:12:38,640 And so password spray is trying a small handful of passwords against all usernames in an environment. 135 00:12:38,640 --> 00:12:43,580 So in this case, I used some of the passwords that I already found in the environment. 136 00:12:43,580 --> 00:12:48,660 And I'm just seeing if there's possible password reuse across user accounts. 137 00:12:48,660 --> 00:12:50,440 In this one, it didn't hit anything. 138 00:12:50,440 --> 00:12:58,240 But some common uses for this is things like using Summer 2024 or Defcon 32 or whatever, right? 139 00:12:58,260 --> 00:13:00,820 And just seeing kind of what hits. 140 00:13:03,140 --> 00:13:06,180 A similar attack is a credential stuff attack. 141 00:13:06,180 --> 00:13:09,960 And this is more commonly used with breach credentials. 142 00:13:09,960 --> 00:13:18,360 So this is also a password reuse attack, but it's more specific to the user account themselves or the user themselves. 143 00:13:18,360 --> 00:13:36,460 So if they use the same password, say, for LinkedIn, and we're able to identify that the email address that they signed in with LinkedIn was the same as the Active Directory that we're attacking, it's possible that we may be able to hit something using a credential stuffing attack. 144 00:13:36,660 --> 00:13:57,200 In this specific screenshot, I kind of lazily just used the same user list as the password list, which simulates the situation where a user has the same password as their username, which is not terribly common anymore, but used to be common around, like, 145 00:13:57,200 --> 00:13:58,580 service accounts and things like that. 146 00:13:58,580 --> 00:14:04,220 So if you've got passwords that haven't changed in your environment for a very long time, this may be possible. 147 00:14:04,760 --> 00:14:06,940 And so we did get a hit on that one. 148 00:14:07,160 --> 00:14:13,560 We got the account Hodor, which we'll use later in another authenticated attack. 149 00:14:13,560 --> 00:14:23,240 But so some of the things that we can do is, and I showcase here just checking out the password policy, to prove that you can view it as any user in the domain. 150 00:14:23,240 --> 00:14:30,100 So once you have that initial user, you can query the password policy and maybe tailor your password attacks a little bit more specific. 151 00:14:30,520 --> 00:14:39,620 And so if you're wondering why on earth someone could have the same username and password, it's due to the complexity requirement that's disabled in this lab. 152 00:14:39,620 --> 00:14:44,760 Also, the character limit is only five, which I have seen worse than that. 153 00:14:44,760 --> 00:14:47,640 So five, not the worst. 154 00:14:48,480 --> 00:14:59,600 Some other things that you want to do with your password policy, other than kind of the obvious two there, is looking at some of the account lockout threshold, and also some of the other password requirements in there. 155 00:14:59,600 --> 00:15:03,620 I do have a link to an article I wrote called Password Policy a la carte. 156 00:15:03,620 --> 00:15:05,360 That's going to be in my resources. 157 00:15:05,600 --> 00:15:08,600 So check that out after the talk. 158 00:15:09,900 --> 00:15:17,180 I do want to talk a little bit about account lockout, because it is an effective strategy to blocking some password style attacks. 159 00:15:17,200 --> 00:15:20,820 I'm not going to talk about monitoring, because that's another thing. 160 00:15:21,440 --> 00:15:25,180 But you can query things using password crack map exec. 161 00:15:25,180 --> 00:15:28,380 And so here I've just simulated something. 162 00:15:28,380 --> 00:15:30,140 This is an oopsie. 163 00:15:30,140 --> 00:15:39,880 So for the red teamers, you're probably somewhat familiar, hopefully not, with seeing something like this, where you see log on failure, log on failure, log on failure, and then you see account locked out. 164 00:15:39,880 --> 00:15:44,080 And hopefully this is just the one account and not like all the accounts, right? 165 00:15:44,580 --> 00:15:45,840 Mistakes happen. 166 00:15:46,000 --> 00:15:50,540 But log on failures are going to kind of reset that account lockout counter. 167 00:15:51,360 --> 00:15:53,880 So to help combat that, whether you're looking... 168 00:15:53,880 --> 00:15:59,580 I am showing the attack tools, but defense tools is kind of another way that you can look at stuff like this. 169 00:16:00,160 --> 00:16:09,280 When we rerun the crack map exec script using the user's flag authenticated, we can get the bad password count. 170 00:16:09,380 --> 00:16:13,120 So here we identify the very bottom account was the one that we accidentally locked out. 171 00:16:13,120 --> 00:16:22,620 The other ones are sitting at four, and so we can wait for those password resets to retime before you attempt to attack them again. 172 00:16:24,660 --> 00:16:26,340 So that concludes level one. 173 00:16:26,340 --> 00:16:33,900 Yes, so we gained three account credentials, but that's not necessarily the goal that we talked about. 174 00:16:33,940 --> 00:16:40,960 So the goal, rather than getting those credentials, is more so the vulnerabilities that we've identified as being able to patch. 175 00:16:40,960 --> 00:16:58,400 And so in level one, we talked about anonymous access, removing that from an environment, using a little bit more robust usernames, and how attacks like that might occur, Kerberos pre-authentication and how that's a pretty quick, easy win, and then improvements to password hygiene and account lockout. 176 00:16:59,740 --> 00:17:01,560 All right, so on to level two. 177 00:17:08,760 --> 00:17:10,760 I like that cute little bunny over there. 178 00:17:12,400 --> 00:17:26,100 So I called this one enumeration, and then I told myself, nah, I should change it, because this is a little bit more like privilege escalation and lateral movement stuff, and I realized that whatever, it's just hard, so we're just going to call it more hacks. 179 00:17:28,300 --> 00:17:33,880 So the main difference between this level and the first level is that we're doing a little bit more while authenticated. 180 00:17:34,000 --> 00:17:39,340 So what type of Active Directory presentation would be complete without talking about Kerberosting? 181 00:17:39,340 --> 00:17:45,320 So Kerberosting is an attack on accounts that have service principal names or SPNs. 182 00:17:45,320 --> 00:17:46,680 So here's what that looks like. 183 00:17:46,680 --> 00:17:48,520 It's an authenticated attack. 184 00:17:48,520 --> 00:17:55,640 You're able to identify both John Snow and the SQL service account are vulnerable to a Kerberosting attack. 185 00:17:56,100 --> 00:17:58,200 So we're going to take those hashes. 186 00:17:58,200 --> 00:18:00,660 We're going to throw those through Hashcat again. 187 00:18:02,060 --> 00:18:07,800 And here we cracked the John Snow account because it was a weak password. 188 00:18:09,240 --> 00:18:11,500 So you can run something like this. 189 00:18:11,500 --> 00:18:13,980 So this is a quick PowerShell search that you can run. 190 00:18:14,180 --> 00:18:19,780 Get AD user where you just are looking for accounts that have service principles. 191 00:18:20,100 --> 00:18:24,760 And these usually are not cleaned up because service accounts are scary. 192 00:18:24,760 --> 00:18:35,180 So if you're an administrator, you don't want to touch a service account because you don't know if it's being used or where it's used, and you dare not change the password because you have no idea where to change it, what's going to break, and change it back. 193 00:18:35,180 --> 00:18:36,140 Like what's going to happen, right? 194 00:18:36,140 --> 00:18:36,860 I've been there. 195 00:18:36,860 --> 00:18:38,040 I did that for 15 years. 196 00:18:38,040 --> 00:18:39,140 And no, I didn't do this. 197 00:18:39,140 --> 00:18:40,920 And no, I didn't change those passwords. 198 00:18:41,840 --> 00:18:48,740 But what I'm telling you we can do is we can look at things like LastLogon, which may not be 100% accurate, but it may be helpful. 199 00:18:49,760 --> 00:18:51,200 Is the account privileged? 200 00:18:51,360 --> 00:18:57,040 If it's privileged and it's Kerberostable, then that's pretty much a free win for an adversary. 201 00:18:57,040 --> 00:19:01,280 So specifically look at those first. 202 00:19:01,480 --> 00:19:06,160 For the remaining ones, go ahead and look at what the service principle says. 203 00:19:06,160 --> 00:19:12,360 So in our case, the John Snow account, and I realize that's a little bit small, but there's a HTTP setting in there. 204 00:19:12,360 --> 00:19:17,420 So there's a website that it's attempting to coordinate with called the wall.north, seven kingdoms, etc. 205 00:19:17,860 --> 00:19:20,940 If I check DNS for that, it doesn't even exist. 206 00:19:20,940 --> 00:19:27,220 So if I can't access that web server at all, then this service account's not doing anything. 207 00:19:27,260 --> 00:19:29,280 So we're going to go ahead and remove that. 208 00:19:29,280 --> 00:19:34,360 The one that's going to remain is the SQL service account because it actually is running SQL. 209 00:19:34,360 --> 00:19:36,060 It's required to do that. 210 00:19:36,100 --> 00:19:41,540 That one didn't crack because it's using a long, strong, complicated, random password. 211 00:19:41,820 --> 00:19:48,840 And so that's how you protect other accounts that are Kerberostable is with that. 212 00:19:48,840 --> 00:19:52,480 And so this is what the attack looks like now that we removed the service principle. 213 00:19:52,740 --> 00:19:56,440 John Snow no longer shows up as even being attackable. 214 00:20:02,480 --> 00:20:04,140 On path attacks. 215 00:20:07,460 --> 00:20:12,260 So this I like to claim to be God's gift to AD pentesters. 216 00:20:12,260 --> 00:20:13,740 Is that right, you pentesters? 217 00:20:13,740 --> 00:20:14,360 Right. 218 00:20:14,640 --> 00:20:20,720 This responder, you set this up and it'll just listen and respond to clients on the network. 219 00:20:23,360 --> 00:20:25,900 Client's going to come out and say, hey, I'm looking for so-and-so. 220 00:20:25,900 --> 00:20:27,060 And it's like, yeah, that's me. 221 00:20:27,160 --> 00:20:28,120 Yeah, that's me, too. 222 00:20:28,120 --> 00:20:28,900 That's me, too. 223 00:20:29,120 --> 00:20:35,600 And if we have it set up in this way, you can poison those requests and we can actually get NTLM hashes. 224 00:20:35,600 --> 00:20:39,080 In this case, it's NTLM v1 hashes for these accounts. 225 00:20:39,300 --> 00:20:43,880 And so we can do what we've done twice already is we can crack them hashes again with Hashcat. 226 00:20:44,400 --> 00:20:48,060 And so here we've got our third account that we've been able to crack. 227 00:20:48,060 --> 00:20:50,920 And this one was just from listening to the network. 228 00:20:52,940 --> 00:20:58,920 And while that's scary, the scarier thing that you can do is you can configure Responder to run in a similar way. 229 00:20:58,920 --> 00:21:06,540 But instead of giving you the hashed credentials, you can tell it to go ahead and pass those or relay those using NTLM RelayX. 230 00:21:06,540 --> 00:21:10,220 And you can relay that authentication attempt to a target or targets. 231 00:21:10,220 --> 00:21:13,880 So in this case, I'm targeting a web server, the one that ends in 22 there. 232 00:21:14,360 --> 00:21:18,440 And I'm just going to wait for Responder to get some authentication to happen. 233 00:21:18,440 --> 00:21:20,380 It's going to send that here. 234 00:21:20,380 --> 00:21:23,160 And then I told it to set up a Socks proxy. 235 00:21:23,160 --> 00:21:29,700 So I've got an active connection using Eddard Stark, which just happens to be an administrator on that web server. 236 00:21:29,920 --> 00:21:32,680 So now we've got a shell on our target. 237 00:21:32,680 --> 00:21:38,940 So we can do things like this, where we can interact with that session. 238 00:21:39,160 --> 00:21:41,440 And we can run Secret Stump on it. 239 00:21:43,200 --> 00:21:44,300 Pardon me. 240 00:21:44,660 --> 00:21:47,220 So you can see I specified no password. 241 00:21:47,220 --> 00:21:48,120 I don't need a password. 242 00:21:48,120 --> 00:21:49,300 I've already authenticated to it. 243 00:21:49,300 --> 00:21:50,540 I have an active session. 244 00:21:50,540 --> 00:21:52,500 And I can run Secret Stump against it. 245 00:21:52,540 --> 00:21:55,300 And I can dump the local SAM hashes. 246 00:21:55,300 --> 00:21:59,760 So this includes the local administrator account, any other local accounts that exist. 247 00:21:59,760 --> 00:22:03,720 Like a help desk account or something like that, that you've placed on systems. 248 00:22:03,720 --> 00:22:08,180 This will dump all local credentials on that server or workstation. 249 00:22:09,540 --> 00:22:12,760 Also more fun, it's going to extract saved credentials. 250 00:22:12,920 --> 00:22:15,960 So here we're attacking service account. 251 00:22:15,960 --> 00:22:20,220 So if you may recognize the SQL service account that was not Kerberoastable. 252 00:22:20,220 --> 00:22:22,220 You will not be Kerberoasting me. 253 00:22:23,240 --> 00:22:26,380 Was in plain text because it's configured as a service. 254 00:22:26,380 --> 00:22:30,080 It's running a service which is required for SQL Express. 255 00:22:30,080 --> 00:22:33,480 So that account was free on that machine. 256 00:22:34,220 --> 00:22:37,660 And so what can we do for on path attacks? 257 00:22:37,780 --> 00:22:46,880 So the quickest and probably the easiest of all of these is preventing the LLMNR, which is link local multicast name resolution. 258 00:22:46,880 --> 00:22:48,120 Yes, I had to write that down. 259 00:22:48,120 --> 00:22:49,940 And no, I'll not memorize that. 260 00:22:49,940 --> 00:22:54,180 I do have a great article linked for that one as well. 261 00:22:54,180 --> 00:22:56,140 Actually, I have articles for all these. 262 00:22:58,200 --> 00:23:06,640 You may have remembered or noticed that those hashes were NTLMV1 hashes, which are infinitely easier to attack than NTLMV2. 263 00:23:06,640 --> 00:23:15,860 So enforcing this on your domain controller and setting it to the highest security level of enforcing NTLMV2 to exist on your network. 264 00:23:15,860 --> 00:23:23,040 Ideally, not allowing NTLM at all and allowing Kerberos to do what it's supposed to do for the last 20 years. 265 00:23:24,140 --> 00:23:25,460 This is hard. 266 00:23:25,520 --> 00:23:27,940 And I don't know that I've ever fully seen this. 267 00:23:27,940 --> 00:23:31,380 I've seen people auditing it and really starting to get ready for it. 268 00:23:31,700 --> 00:23:37,220 Another thing that we've seen, I think twice at Trimark, is LDAP signing and channel binding. 269 00:23:37,640 --> 00:23:39,660 This is another thing that's incredibly difficult. 270 00:23:39,660 --> 00:23:42,560 It can break a lot of those non-Windows devices. 271 00:23:42,560 --> 00:23:47,740 I've also got a couple links to some articles that have been written about this as well. 272 00:23:49,780 --> 00:23:57,840 A thing that I don't think is all that hard, some administrators do think that this is hard, this is protecting the accounts themselves. 273 00:23:57,840 --> 00:24:04,320 So this might be a little bit easier to get through some of that change management for you, is using the protected users group. 274 00:24:04,320 --> 00:24:10,000 Because you're only impacting whatever users you put in it and not the enterprise when you're making domain controller changes. 275 00:24:10,000 --> 00:24:16,580 A coworker of mine, Jake Hildreth, which owns our Active Directory Security Assessments, he has a blog and a presentation. 276 00:24:16,580 --> 00:24:23,300 He's writing a tool to help assist with end users adding accounts to the protected users group. 277 00:24:23,700 --> 00:24:25,920 So again, I've got that in the resources. 278 00:24:27,500 --> 00:24:28,960 Alright, so level two is down. 279 00:24:28,960 --> 00:24:30,420 We Kerberos to John Snow. 280 00:24:30,420 --> 00:24:33,640 We crack the hash from Responder for Rob Stark. 281 00:24:33,640 --> 00:24:37,280 And we found the SQL service account running. 282 00:24:37,280 --> 00:24:38,900 So now we've got six accounts. 283 00:24:38,900 --> 00:24:43,520 And we've got five more vulnerabilities that we have patched. 284 00:24:43,520 --> 00:24:45,380 So we cleaned up SPNs. 285 00:24:45,380 --> 00:24:51,100 We disabled LLMNR and NTLM v1 by enforcing v2. 286 00:24:51,100 --> 00:24:54,820 We talked a little bit about at least thinking about LDAP signing and channel binding. 287 00:24:54,820 --> 00:25:01,160 And then also the protected users group, protecting those highly privileged users in your domain. 288 00:25:03,960 --> 00:25:06,440 So level three, I called Privesk. 289 00:25:06,440 --> 00:25:08,920 Again, this is maybe a little bit more lateral movement-y. 290 00:25:08,920 --> 00:25:12,940 Also some pretty domain crushing attacks in this one too. 291 00:25:13,820 --> 00:25:19,500 And I'm going to kind of start by going backwards just a smidge because I wanted to show Bloodhound just a little bit. 292 00:25:20,320 --> 00:25:25,080 Bloodhound is an amazing tool that you can use to scan your Active Directory environment. 293 00:25:25,080 --> 00:25:29,600 And here I'm just showcasing what paths are available to domain admin. 294 00:25:29,600 --> 00:25:32,660 And here I'm going to zoom in on the one that we just owned. 295 00:25:32,660 --> 00:25:34,740 So we just got that Rob Stark account. 296 00:25:35,200 --> 00:25:41,660 And Rob Stark is a member of the administrators group, which is just this very simple step away from domain admins. 297 00:25:41,740 --> 00:25:45,500 And so that one's just a little bit too boring because you can just add yourself to that group, right? 298 00:25:45,500 --> 00:25:47,200 So we're going to do something cool. 299 00:25:47,700 --> 00:25:51,340 And we're going to identify what ACL modification may look like. 300 00:25:51,420 --> 00:25:57,740 So here you might remember our old friend Samwell, who was our first attack with that description field misconfiguration. 301 00:25:57,740 --> 00:26:05,000 Well, Samwell, for whatever reason, has the ability, has a write DAQL on a GPO that's linked to the domain root. 302 00:26:05,380 --> 00:26:07,060 So what does that look like? 303 00:26:08,660 --> 00:26:11,620 So here's what it looks like when we look at the policy itself. 304 00:26:12,040 --> 00:26:18,040 We see that the delegation tab shows us that we have some privileges with Samwell. 305 00:26:18,040 --> 00:26:23,640 If we dig into him a little bit, we identify he doesn't look too terribly dangerous because he doesn't have write permission. 306 00:26:24,140 --> 00:26:28,260 He has read and he has delete. 307 00:26:28,380 --> 00:26:37,580 But we have to actually look at advanced to identify what the real threat to this is, which is that write DAQL permission, which translates to modify permissions and modify ownership. 308 00:26:38,140 --> 00:26:43,300 So Sam can give himself or anyone else access to modify this GPO. 309 00:26:43,440 --> 00:26:48,700 And there's a number of different things you can do once you can modify a GPO specifically at the domain root. 310 00:26:48,700 --> 00:26:55,480 One such example is just creating a file that's going to run at login for all users on all computers in your environment. 311 00:26:56,180 --> 00:26:58,440 So we can do some pretty messy stuff with that. 312 00:26:59,720 --> 00:27:02,180 So mitigating this is fairly simple. 313 00:27:02,180 --> 00:27:05,020 You just have to check out the GPOs. 314 00:27:05,120 --> 00:27:07,320 I don't have a script for this. 315 00:27:07,320 --> 00:27:08,360 I should probably write one. 316 00:27:08,360 --> 00:27:13,300 So I may write one and put it up on GitHub where you can actually scan some of the ACLs that might be dangerous. 317 00:27:13,300 --> 00:27:23,580 But specifically start with your domain root and then move on to domain controllers, move to other protected OUs to identify group policies that maybe have delegation. 318 00:27:23,880 --> 00:27:25,380 Also ownership. 319 00:27:25,380 --> 00:27:29,540 So identify who has owner on your GPOs. 320 00:27:30,120 --> 00:27:35,860 And so if we clean that up, then we're in a lot better shape for any of that ACL modification. 321 00:27:37,220 --> 00:27:39,500 So I'm going to take us a little bit back. 322 00:27:39,500 --> 00:27:45,560 So you remember when we attacked the web server that we were targeting with stuff? 323 00:27:45,560 --> 00:27:47,220 I don't really remember either. 324 00:27:47,220 --> 00:27:55,060 But basically what we did was we were able to gain the local credentials for that web server. 325 00:27:55,140 --> 00:27:59,800 And what we can do with local credentials is we can do a pass the hash attack. 326 00:28:00,540 --> 00:28:03,360 So in this example, we're using the administrator. 327 00:28:03,360 --> 00:28:06,680 This could be, like I said, a help desk account or any other local account. 328 00:28:06,680 --> 00:28:10,560 And we can target all other known IPs in that domain. 329 00:28:10,880 --> 00:28:14,200 And this could be servers, this could be workstations. 330 00:28:14,580 --> 00:28:18,980 And in this case, we identify that very first one, the Castle Black. 331 00:28:18,980 --> 00:28:20,120 That's the one that we attacked. 332 00:28:20,120 --> 00:28:22,120 We expected that one to show up as pwned. 333 00:28:22,120 --> 00:28:26,340 But that bottom one, Winterfell, is actually a domain controller. 334 00:28:26,920 --> 00:28:29,900 I mean, this is a lab, so this is fairly unrealistic. 335 00:28:29,900 --> 00:28:38,680 But the reason this works is because when you promote your first domain controller, it's going to use that credential as the domain administrator credential. 336 00:28:39,700 --> 00:28:42,620 So just a little bit of digression on that. 337 00:28:42,940 --> 00:28:46,960 But with that, we don't even need to know what the password is for that administrative account. 338 00:28:46,960 --> 00:28:49,580 We can just pass that hash and authenticate. 339 00:28:49,580 --> 00:28:55,660 And here I'm using EvilWinRM, and you can see at the bottom that I've got a shell on our domain controller. 340 00:28:56,600 --> 00:29:00,340 And solution for this is to use something like LAPS. 341 00:29:00,340 --> 00:29:12,160 So old admins like myself maybe remember the days before LAPS was a thing where you would use a GPO, and you'd set the local administrator account on all machines. 342 00:29:12,220 --> 00:29:19,120 And thanks to the cpassword, where everybody could read that, we've now got cleartext credentials. 343 00:29:19,120 --> 00:29:24,780 So other than even just reuse and passing the hash, cpassword has cleartext creds. 344 00:29:24,780 --> 00:29:28,240 That's not even an attack that I showcased in this. 345 00:29:28,240 --> 00:29:29,140 It's fairly old. 346 00:29:29,140 --> 00:29:31,520 We do still see it on old GPOs. 347 00:29:31,520 --> 00:29:34,660 Even if they're unlinked, they still have some cpasswords in them. 348 00:29:34,660 --> 00:29:36,620 So you may check that. 349 00:29:36,620 --> 00:29:38,280 But this is what LAPS looks like. 350 00:29:38,400 --> 00:29:43,060 I've got articles on that as well, because I'm not going to go super into LAP. 351 00:29:43,900 --> 00:29:47,800 I am going to go a little bit into Kerberos delegation, though. 352 00:29:53,420 --> 00:29:57,700 So Kerberos delegation is a required feature of Windows. 353 00:29:59,380 --> 00:30:13,920 An example would be when a user authenticates to a web server, and then that web server needs to authenticate on behalf of that user to a database server, for example, to be able to provide the correct results for the user that's asking. 354 00:30:14,120 --> 00:30:15,340 So it's kind of a security thing. 355 00:30:15,340 --> 00:30:16,800 It's pretty much built in. 356 00:30:16,940 --> 00:30:24,780 But in this case, when we talk about delegation, we're talking about impersonation, which means that web server has the ability to impersonate any user in the domain. 357 00:30:26,140 --> 00:30:36,540 And so what that looks like, specifically when we're attacking unconstrained delegation, is we have a shell on that web server that we had shown that we attacked earlier. 358 00:30:37,180 --> 00:30:47,520 And since it's set up for unconstrained delegation, we either wait, or we can coerce an administrator to log into that system that we're in control of. 359 00:30:47,760 --> 00:30:52,660 And so here, using Mimikatz, I was able to export the tickets for Brandon. 360 00:30:53,480 --> 00:30:57,940 Brandon was very impressionable admin at the time. 361 00:31:01,020 --> 00:31:06,660 So Brandon logged into our server that we had control of. 362 00:31:07,300 --> 00:31:11,880 Using Mimikatz, we were able to set up what's called a pass-the-ticket attack. 363 00:31:11,880 --> 00:31:14,400 And then we load that ticket into our session. 364 00:31:14,400 --> 00:31:20,620 And we can view that using that klist tickets to identify that we have that cached ticket for Brandon. 365 00:31:20,620 --> 00:31:26,420 And then that last command in the bottom is just opening a PowerShell session to a domain controller. 366 00:31:26,500 --> 00:31:30,120 So we're authenticating as a domain admin to a domain controller. 367 00:31:31,640 --> 00:31:34,500 And now we've got a shell on the domain. 368 00:31:34,500 --> 00:31:35,440 We run whoami. 369 00:31:35,440 --> 00:31:37,780 We just look at sysvol. 370 00:31:37,780 --> 00:31:41,020 And so now we've basically owned that domain controller. 371 00:31:41,320 --> 00:31:44,960 I've got a lot more attacks to go, so I'm not going to stop there though. 372 00:31:44,960 --> 00:31:47,420 So how do we stop this specifically? 373 00:31:47,740 --> 00:31:53,600 So moving unconstrained delegation to constrained delegation is a good way to mitigate this. 374 00:31:53,600 --> 00:32:02,780 You can specify the specific service or server that's required instead of just allowing delegation to occur wherever it needs. 375 00:32:04,900 --> 00:32:08,220 That, again, can be somewhat difficult to identify. 376 00:32:08,740 --> 00:32:17,160 So what I like to do, even in the... I'm not saying don't do that, but what I am saying do is mark accounts as sensitive and cannot be delegated. 377 00:32:17,160 --> 00:32:29,800 So all of your administrators, this is kind of a baby step to the protected users group, set them up like this because, like I said, Brandon was very impressionable and he could be tricked to logging into wherever because he's an admin. 378 00:32:29,800 --> 00:32:34,560 You know, somebody in user calls, he logs in wherever they tell him to log in as his domain admin credentials, right? 379 00:32:34,560 --> 00:32:35,540 What could go wrong? 380 00:32:36,560 --> 00:32:45,260 So now that I've set Brandon as sensitive, he can't be delegated, on the right here is what we just did, so that's what the attack looked like in Mimikatz. 381 00:32:45,340 --> 00:33:00,960 If that attack were to attempt... be attempted when the account was set up, he was still... he still logged in and we can still look at some stuff in Mimikatz, but we don't have that ticket granting ticket, which means we can't load it into the session and we can't attack that account anymore. 382 00:33:05,910 --> 00:33:07,630 All right, so level three is over. 383 00:33:07,750 --> 00:33:10,810 We don't have any new accounts, but we're kind of beyond that now. 384 00:33:10,810 --> 00:33:16,610 You know, we've kind of gotten to the point where we're already on the precipice of domain admin. 385 00:33:16,610 --> 00:33:20,330 We've already kind of gained that full domain compromise. 386 00:33:21,090 --> 00:33:29,810 So what we've learned in level three is how to fix ACL and ownership issues, specifically on GPOs, but other objects are also important. 387 00:33:30,530 --> 00:33:45,150 Configuring LAPS to prevent things like local administrative credentials being on multiple machines, being able to perform lateral movement, implementing constrained delegation instead of unconstrained, and then protecting your admin accounts using the account is sensitive and cannot be delegated flag. 388 00:33:46,530 --> 00:33:48,270 All right, now the fun one. 389 00:33:54,880 --> 00:33:56,400 Okay, we're going to Pwn AD. 390 00:33:56,560 --> 00:33:58,500 So the print nightmare. 391 00:33:59,020 --> 00:34:00,840 I don't know if you all remember this. 392 00:34:01,740 --> 00:34:07,240 It was three years ago, I think now, and this I like to call the attack that got me into InfoSec. 393 00:34:07,300 --> 00:34:10,640 So I told you I worked for TriMark for two and a half years now. 394 00:34:11,160 --> 00:34:13,740 Print nightmare came out when I was still a sysadmin. 395 00:34:13,920 --> 00:34:19,900 It let me poke at it and prove to my administrators that it was exploitable, so we had something to do. 396 00:34:20,620 --> 00:34:22,140 So this is what that looks like. 397 00:34:22,140 --> 00:34:34,520 So running a CrackMap exec tool as well as the impact tool, we identified that the spooler is running on our target system, and the protocols necessary to perform the attack are also available. 398 00:34:37,900 --> 00:34:43,640 So what this attack looks like is we can just host a malicious DLL on a Samba share from this Kali box. 399 00:34:43,640 --> 00:34:45,580 This is where the screenshots are coming from. 400 00:34:46,160 --> 00:35:04,900 Using the cube 0x0 exploit, we can target the domain controller, and we're using just a regular user account, so that Hodor account that we grabbed, no administrative credentials in the domain whatsoever, can authenticate to that domain controller, and because the print spooler is available on that server, 401 00:35:04,900 --> 00:35:10,680 we can throw this nightmare DLL at it, and it says exploit completed. 402 00:35:10,900 --> 00:35:16,480 And what that exploit does is it's created a new account for us in the domain. 403 00:35:16,480 --> 00:35:21,500 It's called PrintNightmare2, and it is in the administrators group. 404 00:35:24,510 --> 00:35:28,370 And this is my favorite mitigation, because it's the easiest mitigation. 405 00:35:28,370 --> 00:35:30,370 So we just disable the print spooler. 406 00:35:30,370 --> 00:35:33,630 And yes, I know PrintNightmare has been patched. 407 00:35:33,630 --> 00:35:34,550 Thank goodness. 408 00:35:34,550 --> 00:35:52,070 So not this specific attack is available everywhere anymore, but the print spooler is used in so many coercion attacks that can occur now that I like to say, if you're not printing or performing printing as a print server, then you have no need to run the print spooler whatsoever. 409 00:35:52,150 --> 00:36:01,330 So disable it either manually here or use a GPO to disable it, and here you see on the right-hand side that that server is no longer vulnerable to attack. 410 00:36:04,750 --> 00:36:16,590 So our last attack is going to be one of the Active Directory certificate services, so ADCS, vulnerable configuration that we're going to attack using the Certify tool. 411 00:36:16,590 --> 00:36:19,490 So this has been very popular over the last couple years. 412 00:36:19,490 --> 00:36:26,530 About two years ago or so, we saw this as a critical vulnerability on almost every single assessment that we did. 413 00:36:26,650 --> 00:36:31,590 Thankfully, things have gotten a little bit better in the industry now, but this is what that looks like. 414 00:36:31,590 --> 00:36:35,190 So we're going to run our Certify tool with a find command. 415 00:36:35,190 --> 00:36:39,610 This is just using a regular user account to a domain controller. 416 00:36:42,180 --> 00:36:49,220 So our output is going to include all the vulnerabilities that exist in that domain if it's running certificate services. 417 00:36:49,220 --> 00:36:51,460 And I'm going to drill into that because it's hard to see. 418 00:36:52,340 --> 00:36:57,940 So the specific one that we're going to pick out is called ESC1 or Escalation 1. 419 00:36:57,940 --> 00:37:01,780 This is from the Certify pre-owned stuff that Spectrops put out. 420 00:37:01,780 --> 00:37:03,440 It's also in the resources. 421 00:37:04,520 --> 00:37:13,940 So what makes this vulnerable is that enrollee supply subject, which equals the subject alternative name, can be applied when you enroll a certificate. 422 00:37:15,260 --> 00:37:20,600 The second half of that puzzle is who can enroll dangerous certificates. 423 00:37:20,660 --> 00:37:30,940 So in this case, we have domain users, have enrollment rights, and that means that anybody can enroll a certificate and they can specify that they are whoever they want to be. 424 00:37:32,640 --> 00:37:39,300 And so we can go take the next step and we can run Certify and request our certificate. 425 00:37:39,300 --> 00:37:42,520 So here we can see we're targeting that ESC1 template. 426 00:37:42,520 --> 00:37:45,480 We're telling it that we want to be administrator. 427 00:37:46,040 --> 00:37:51,080 We can tell it whatever we want, but of course we want to be the administrator account. 428 00:37:51,080 --> 00:37:59,290 So we've saved that private key locally, and now we're going to authenticate with it. 429 00:37:59,290 --> 00:38:01,630 So now we run the Certify Auth command. 430 00:38:01,630 --> 00:38:16,470 We specify the PFX, the domain controller, and we've now got the credential cache, so the Kerberos credential, as well as the hash for the administrator account, which means we can do bad things. 431 00:38:17,930 --> 00:38:20,630 So we can run secrets dump using that hash. 432 00:38:20,630 --> 00:38:27,250 We could also authenticate with that C cache file doing that, and we can dump the entirety of the domain controller. 433 00:38:27,250 --> 00:38:31,290 So here we've got the SAM, but that's not even really what we want. 434 00:38:31,290 --> 00:38:39,590 We want the NTDS.DIT file, so this contains the entire contents of Active Directory and all the NT hashes for every single user. 435 00:38:39,590 --> 00:38:43,590 And we did this with very little privilege whatsoever. 436 00:38:43,670 --> 00:38:48,750 So in that context, that attack was game over, right? 437 00:38:48,750 --> 00:38:50,110 But we're not quite done. 438 00:38:50,110 --> 00:38:55,850 We still have some work to do because we're learning that domain admin doesn't mean that we're finished as administrators. 439 00:38:56,530 --> 00:39:01,270 So we need to investigate why the vulnerable template existed in the first place. 440 00:39:01,270 --> 00:39:02,870 So this is what I said earlier. 441 00:39:02,870 --> 00:39:05,250 It's that two-piece, the domain users. 442 00:39:05,250 --> 00:39:06,650 It doesn't have to be domain users. 443 00:39:06,650 --> 00:39:11,830 It could just be a subset of regular user accounts that could enroll certificates. 444 00:39:11,830 --> 00:39:15,130 So the bigger issue is that supply and the request. 445 00:39:15,390 --> 00:39:20,110 So a little bit better of a mitigation is to require manager approval for specific certificates. 446 00:39:20,110 --> 00:39:22,370 There's a number of different things that you can do. 447 00:39:24,370 --> 00:39:27,530 And this is what the certificate that was issued looks like. 448 00:39:28,010 --> 00:39:35,890 So here you'll see the subject was Brandon because he was the one that requested the certificate, but he requested it using the subject alternative name as administrator. 449 00:39:35,890 --> 00:39:38,790 So that's what it looks like when a certificate's enrolled. 450 00:39:41,630 --> 00:39:45,870 And so we already talked about how you can detect it, but how can you do it automatically? 451 00:39:45,910 --> 00:39:51,870 So this is another tool that a friend of mine, Jake, has put out called Locksmith. 452 00:39:51,970 --> 00:39:55,130 You can run this whether you're on the blue side or the red side. 453 00:39:55,130 --> 00:40:01,930 This is a fantastic tool that discovers several different misconfigurations in environments. 454 00:40:01,930 --> 00:40:05,070 So this is what it looks like when it detects ESC1. 455 00:40:05,070 --> 00:40:08,990 I think the coolest thing that it does is it provides fixes for you. 456 00:40:09,230 --> 00:40:23,390 So it can output some PowerShell that will actually mitigate this, and it looks at not only ESC1 but all the way through 8 with the exception of 7 and also looks at some auditing being enabled, which does not happen by default in ADCS. 457 00:40:23,550 --> 00:40:26,790 So it provides fixes for every single one of these as well. 458 00:40:31,680 --> 00:40:37,500 And so technically we created the Brandon Rocks account, but I wanted to put it up here because I hope you agree. 459 00:40:38,000 --> 00:40:38,480 So... 460 00:40:40,800 --> 00:40:43,620 We got our last two vulnerabilities patched. 461 00:40:43,620 --> 00:40:49,500 So two more mitigations is to disable that print spooler and run Locksmith in your environment. 462 00:40:49,720 --> 00:40:51,640 Our game is still not over, though. 463 00:40:51,640 --> 00:40:55,920 So even though we've reached the end boss and we've fought it, there's always that next level. 464 00:40:55,920 --> 00:40:57,860 Our princess is always in another castle. 465 00:40:57,860 --> 00:40:59,300 There's always something else you can do. 466 00:40:59,300 --> 00:41:00,980 There's always that next step. 467 00:41:01,440 --> 00:41:07,060 Active Directory is not done with new vulnerabilities that come out on a regular basis. 468 00:41:07,060 --> 00:41:11,420 It's old, but there's new research that occurs every day. 469 00:41:11,420 --> 00:41:17,420 So I urge you all to get an assessment done, get a pen test done, try out some of these tools. 470 00:41:17,420 --> 00:41:20,400 So this is a list of all of the resources that I used. 471 00:41:20,600 --> 00:41:25,060 So use if you have permission to run these tools, everybody, please. 472 00:41:25,220 --> 00:41:28,740 I'm not telling you to go hack yourself without permission. 473 00:41:29,900 --> 00:41:32,040 I'll hold that up there just for a second. 474 00:41:32,040 --> 00:41:35,440 I will share these on my GitHub. 475 00:41:37,600 --> 00:41:40,680 Because here's a list of all of those resources I talked about. 476 00:41:40,920 --> 00:41:43,260 As well as the character selection screen. 477 00:41:43,260 --> 00:41:48,920 So I put this back up because I love AI art and how bad it is at spelling things, specifically. 478 00:41:49,620 --> 00:41:55,400 I also told it to give me a character selection screen for the game of Active Directory. 479 00:41:55,400 --> 00:41:58,520 And it came back with this, and everybody is sad. 480 00:42:01,800 --> 00:42:04,780 Every single person has a frown on their face. 481 00:42:04,780 --> 00:42:09,700 Like this guy bottom, like three from the right, he's got circles under his eyes. 482 00:42:09,700 --> 00:42:10,640 I don't know, he's beat up. 483 00:42:10,640 --> 00:42:12,480 And then there's the names of them. 484 00:42:12,480 --> 00:42:15,140 There's dad and oh lordy and doy. 485 00:42:15,320 --> 00:42:16,800 It's fantastic. 486 00:42:17,100 --> 00:42:20,160 So with that, thank you all for coming. 487 00:42:20,160 --> 00:42:22,040 Packed house, fantastic, guys. 488 00:42:33,790 --> 00:42:37,450 So you can follow me or find me on pretty much everything. 489 00:42:37,450 --> 00:42:39,710 Tech Brandon, GitHub's Tech Brandon. 490 00:42:40,250 --> 00:42:41,670 Twitter, LinkedIn. 491 00:42:42,130 --> 00:42:44,430 Thank you, Packet Hacking Village, thank you, DEF CON. 492 00:42:44,570 --> 00:42:48,150 I do think I've got a decent amount of time for questions. 493 00:42:48,150 --> 00:42:52,790 So if anyone wants to stick around and has any questions, I will do my best. 494 00:42:57,110 --> 00:42:57,530 Cool. 495 00:42:57,530 --> 00:43:01,730 Or you can go early and you can go get a snack, because it's lunchtime.