1 00:00:00,000 --> 00:00:06,000 All right. Say hello to KRBTGT. This is DEF CON. Come on, people. He's been there since 2 00:00:11,208 --> 00:00:17,208 the beginning since your domain was formed. KRBTGT has been there. It's been there through 3 00:00:19,708 --> 00:00:25,708 the early years in 2000, 2004 when everyone thought they were special and deserved admin 4 00:00:31,375 --> 00:00:37,958 rights. You remember the time? KRBTGT was there protesting with everyone else that everyone 5 00:00:37,958 --> 00:00:43,875 should be an admin and then there was these things called domains an active directory and 6 00:00:43,875 --> 00:00:49,875 everyone wanted to be a domain admin. Windows 2000 was revolutionary but so was D con. 7 00:00:53,000 --> 00:00:59,958 So in 2003, all those domains that were sitting on the internet very likely could have 8 00:00:59,958 --> 00:01:05,958 been owned by D con or any of the worms that were going around at that time. Things got better, 9 00:01:09,792 --> 00:01:16,042 right? Everyone remembers that. KRBTGT was there when you finally installed a fire wall. 10 00:01:16,042 --> 00:01:22,458 So all those remote attacks and those worms that were destroying your domain for years finally 11 00:01:22,458 --> 00:01:28,583 stopped. It was the answer to all of our security problems, right? Yes. Then there was 12 00:01:28,583 --> 00:01:34,583 Windows XP probably Microsoft's greatest product. Except there was MSO8067 and once again pen 13 00:01:36,917 --> 00:01:43,292 testers and hackers rejoiced because they were easily able to knock over every enterprise. 14 00:01:43,292 --> 00:01:47,833 Then there was the great administrative layoff of 2007 as much when you realized your 15 00:01:47,833 --> 00:01:53,667 domain admin's group ballooned to over 400 people and over a hundred of them no longer worked 16 00:01:53,667 --> 00:01:59,667 at your company anymore. Why would you say you have admin rights? So then it really got 17 00:02:02,958 --> 00:02:08,958 better. 2009 the security industry blossomed and everyone was selling windows server 2008 18 00:02:10,958 --> 00:02:15,917 and KERBEROS was the answer to your pass the hash problems. You didn't have to worry about pass 19 00:02:15,917 --> 00:02:23,333 to hash anymore. KERBEROS it's awesome. To manage your local admin accounts you decide to 20 00:02:23,333 --> 00:02:29,333 deploy this policy group policy preferences, right? Yeah. Everybody did that. Including 21 00:02:31,708 --> 00:02:37,708 Microsoft. So in case you didn't know group policy preferences are terrible, you should never 22 00:02:45,625 --> 00:02:51,208 use them. Microsoft even came out with a patch to keep you from being able to use a feature 23 00:02:51,208 --> 00:02:55,708 that they swear was never security vulnerability. If you're using group policy 24 00:02:55,708 --> 00:03:01,167 preferences that's terrible. That means anyone on your network can get local admin 25 00:03:01,167 --> 00:03:09,042 rights or any of the passwords that are in those group policy preference files. So, let's talk 26 00:03:09,042 --> 00:03:15,375 about the last two years. So, you decided to move on, the domain moves on, the server 2012 27 00:03:15,375 --> 00:03:21,375 and KRBTGT is loving life because you finally gotten rid of MTLM you've gone to Kerberos. 28 00:03:27,167 --> 00:03:34,500 You got rid of MTLM and then there was heart bleed. And it knocked over all your VPN 29 00:03:34,500 --> 00:03:40,500 servers and you got owned again. And there was this thing the golden ticket which no one seems 30 00:03:42,583 --> 00:03:50,167 to know anything about that you find all over your network as well. Account number two. Thanks 31 00:03:50,167 --> 00:03:56,167 to Mr. Benjamin Delpe in the front row. So, do you know how old your KRBTGT hash is? 32 00:04:02,833 --> 00:04:08,833 Anybody. When you created a domain or when you upgraded from 2003 functional to 2008, anybody 33 00:04:16,042 --> 00:04:22,042 created their current domain in 2001? Nobody? 2002? 2003? 2004? Five? Six? Seven? So anything 34 00:04:30,500 --> 00:04:36,500 that happens to this domain was 2004 so I guess the question is do you know where your KRBTGT 35 00:04:40,875 --> 00:04:46,875 hash is because this domain's hashes are on P span. (Laughter). 36 00:04:51,333 --> 00:04:57,333 >>> That's not good. But the bottom line, the whole point of this talk is this. If you've 37 00:05:01,125 --> 00:05:07,333 ever been owned, if your domain has ever been compromised your hashes dumped you may still be 38 00:05:07,333 --> 00:05:14,667 compromised because that KRBTGT hash is what's used to sign all of the tickets so with that and 39 00:05:14,667 --> 00:05:20,667 only that tickets can be created to take any user and add them to any group or a lot more. Did 40 00:05:23,708 --> 00:05:29,333 anybody go up to the Kerberos black hat talk besides the two speakers in the front row who 41 00:05:29,333 --> 00:05:36,333 gave the talk? Awesome. They're only here to heckle me and they have been heckling me the last 42 00:05:36,333 --> 00:05:43,625 half hour while I had to sit next to them the previous talk but now I'm on stage and you're 43 00:05:43,625 --> 00:05:49,625 not. So maybe you could be like this guy. Does anyone know who this guy is? Nobody? Cool. So he 44 00:05:53,667 --> 00:05:59,667 testified before senate that as long as you scan you're secure. He testified against Dave 45 00:06:01,708 --> 00:06:09,000 Kennedy or countered Dave Kennedy earlier this year and he said that with a straight face. 46 00:06:09,000 --> 00:06:14,958 As long as you're scanning you're secure. You have not been compromised. So ‑‑ (Laughter). 47 00:06:14,958 --> 00:06:20,958 >> Now that I have an audience other than twitter, I would like to say good luck with that. 48 00:06:25,333 --> 00:06:31,333 Let's talk about Kerberos. Does nobody get the name? No one gets meme. I swear. All right. I'm 49 00:06:40,167 --> 00:06:47,875 not going to bore you with how Kerberos works. That was Skip and Ben's talk at BlackHat, but 50 00:06:47,875 --> 00:06:54,625 this is the basics of it in a really crude diagram I drew several years ago. If you would 51 00:06:54,625 --> 00:07:01,042 like to go over that. But what I want to focus on is the Spoofed PAC attack which is the 52 00:07:01,042 --> 00:07:07,458 privileged account certificate (PAC) which is a portion of the Kerberos ticket. The previous 53 00:07:07,458 --> 00:07:14,375 diagram and this diagram are taken from skip and my white paper for black hat 2012 and if 54 00:07:14,375 --> 00:07:21,458 you see what we're doing here, we're basically just adding groups to the pack and then 55 00:07:21,458 --> 00:07:28,625 we're using the KRBTGT hash to sign it and make it valid so you can take any user and add them 56 00:07:28,625 --> 00:07:34,542 to any group temporarily and they're not actually going to show up on the domain network in 57 00:07:34,542 --> 00:07:40,542 that group so there's almost no log of this unless you actually use the privileges Who has heard 58 00:07:42,583 --> 00:07:48,583 of the golden ticket attack? Awesome. So, golden ticket which is a great branding by one 59 00:07:52,417 --> 00:07:58,708 Benjamin Delpe sitting in the front row heckling me right now. He added to the wonderful tool 60 00:07:58,708 --> 00:08:04,708 Mimikatz Who has used Mimikatz before? Awesome. So, the golden ticket attack is not just the 61 00:08:10,625 --> 00:08:16,792 spoof pack that skip and I theorized several years ago. It goes beyond that. It's not only 62 00:08:16,792 --> 00:08:22,667 that but in addition Ben was like man, you guys are idiots, you could make this ticket last 63 00:08:22,667 --> 00:08:29,583 forever. We were like wow, why didn't we think of that? True story. So there's a great 64 00:08:29,583 --> 00:08:34,292 tutorial by Rafael Mudge who is awesome and not talking this year, which I'm disappointed 65 00:08:34,292 --> 00:08:39,500 about but did he a great tutorial, that's the link to it if you want to check that out. 66 00:08:42,542 --> 00:08:48,542 So now it's demo time. So, I prerecorded because this is DEF CON and I knew everything was 67 00:08:52,875 --> 00:08:58,875 going to go wrong. I'm just going to pause it, cause it's going to go real fast I'm doing 68 00:09:03,500 --> 00:09:09,500 who am I. I'm limited user, I'm nobody. In this scenario the attackers already compromised in 69 00:09:12,250 --> 00:09:16,958 one of those hundred ways that we kind of talked about earlier, compromise the enterprise way 70 00:09:16,958 --> 00:09:23,250 back when in 2004 with D con or MSO8O67 or MSO90S in server 2008. So, the question a lot of 71 00:09:23,250 --> 00:09:29,250 people ask is if you knocked over the domain then you've already got everything. The 72 00:09:34,375 --> 00:09:39,417 point to all of this is that you can leave and come back whenever you want. You're not going to 73 00:09:39,417 --> 00:09:44,625 leave anything beaconing, you're not going to leave anything to find. So, this is one way of 74 00:09:44,625 --> 00:09:50,625 coming back in this limited user is going to check the group membership or domain admin and 75 00:09:52,875 --> 00:09:58,875 it's just administrator like it should be. No one else. All right. Phishing E‑mail really 76 00:10:05,792 --> 00:10:13,542 important. Got to open that up. From the boss. It's too legit so we got to ‑‑ that was not enough 77 00:10:13,542 --> 00:10:19,542 hammer time. Hold on. You got to get that. All right. All we need to do is enable macros so we got 78 00:10:26,833 --> 00:10:32,042 to do that. I'm going to put this on youtube and that's mostly for when I put this on 79 00:10:32,042 --> 00:10:38,208 youtube but what this macro is doing is it's using PowerShell and then PowerShell is going to 80 00:10:38,208 --> 00:10:40,208 pull down invoke-Mimikatz. Has anyone used invoke-Mimikatz and power-- It was released last 81 00:10:40,208 --> 00:10:44,542 year at DEF CON. A couple people. It's awesome. Basically we get a fully staged Mimikatz 82 00:10:44,542 --> 00:10:50,708 without having to worry about A/V or touching disk at all. So what we're doing is we're using 83 00:10:50,708 --> 00:10:56,708 a macro to call PowerShell to pull Mimikatz down reflectively in memory and then in addition I 84 00:11:03,667 --> 00:11:09,667 added a few things so now I'm going to use the Krbtgt hash I've already stolen to create a 85 00:11:12,292 --> 00:11:18,417 ticket and add myself to the domain admin group. It's not just a Kerberos ticket for 86 00:11:18,417 --> 00:11:23,750 domain admins we'll take this limited user and add them to domain admins without them 87 00:11:23,750 --> 00:11:29,208 realizing what's going on. >> It's kind of a silly example not really what you would want to 88 00:11:29,208 --> 00:11:35,208 do. How you would want to do that. All right so now the user has enabled macros and they 89 00:11:37,625 --> 00:11:43,625 shouldn't feel remorseful but in this case shouldn't have done that. All right we see 90 00:11:49,375 --> 00:11:55,375 PowerShell firing up. And then you'll see limited user is in the domain admin's group. So, 91 00:12:05,417 --> 00:12:10,083 thanks to Kerberos if you've ever been compromised, it's trivial to come back in. A 92 00:12:10,083 --> 00:12:16,083 simple phishing E‑mail all privilege escalation is done. Damn it. All right. So let's 93 00:12:39,208 --> 00:12:45,208 talk mitigation. As I gave this talk to a couple people beforehand ‑‑ what's that? >> 94 00:12:49,167 --> 00:12:55,167 (Inaudible). >> Oh. Monitor switched on me. Always at ‑‑ wow. There we go. >> 95 00:12:59,250 --> 00:13:05,917 (Inaudible). >> Yay. Windows 8 sucks. All right let's talk about mitigation. So, this side 96 00:13:05,917 --> 00:13:10,708 had to be reworked multiple times because everything I had on it was wrong originally. So, 97 00:13:10,708 --> 00:13:18,542 the easiest thing and if you read this a couple places on the internet, MSDN maybe one place, 98 00:13:18,542 --> 00:13:23,500 if you really want to reset the password hash to the Krbtgt account you got to do it twice 99 00:13:23,500 --> 00:13:29,500 but be warned it might literally break everything. Shear point, exchange, you name it, it will 100 00:13:31,750 --> 00:13:37,250 not automatically fix itself. It may be multiple reboots. Someone who has actually gone through 101 00:13:37,250 --> 00:13:43,250 it, caution that it is not worth doing and even Microsoft hasn't done it. So, the only reliable 102 00:13:45,458 --> 00:13:53,292 way is if you happen to have ‑‑ if your domain functional level is 2003 and you've raised it to 103 00:13:53,292 --> 00:13:59,042 2008, this really shouldn't be a reason to do it because if you're doing this because you 104 00:13:59,042 --> 00:14:04,292 know you've been compromised, you probably should start completely over so I guess the 105 00:14:04,292 --> 00:14:08,667 biggest take away from this is if you've gone through and changed all of your passwords 106 00:14:08,667 --> 00:14:14,208 and thought that you were good, you're not. Or if you're an incident handler and you cannot 107 00:14:14,208 --> 00:14:19,042 figure out why a threat group keeps coming right back in and you can't figure out how the 108 00:14:19,042 --> 00:14:25,042 privilege is escalating this very well could be the way. So, it's all in Mimikatz. I put 109 00:14:27,375 --> 00:14:33,375 business practice DC with all available futures don't get owned again. Detection is worse 110 00:14:36,250 --> 00:14:42,583 than mitigation. It is completely a needle in the haystack. Harder to detect than 111 00:14:42,583 --> 00:14:47,917 pass the hash. >> Pass the hash you're actually doing something. In this case you're generating a 112 00:14:47,917 --> 00:14:53,917 ticket on a single box. Until you actually use it it would be very difficult to detect. As 113 00:14:56,042 --> 00:15:01,750 well as whether or not your Krbtgt hash has been stolen. Unless you know you have been 114 00:15:01,750 --> 00:15:08,375 compromised like you find PW dump sitting on your PC I don't know a way for you to know that 115 00:15:08,375 --> 00:15:12,542 that has already been taken. You can look for strange account activity. I thought it was 116 00:15:12,542 --> 00:15:18,583 really sneaky, and I was like Im going to look for ten year old tickets and Benjamin is going to 117 00:15:18,583 --> 00:15:24,083 go ahead and change that is feature to allow the tickets to be an arbitrary length. Even 118 00:15:24,083 --> 00:15:30,375 that detection mechanism is not going to work for Mimikatz. One thing you could do is look for 119 00:15:30,375 --> 00:15:36,833 low privileged accounts performing privileged actions. That might be the only way to 120 00:15:36,833 --> 00:15:42,833 detect this particular attack. I do want to give some thanks to Skip. Stand up, Skip and 121 00:15:46,708 --> 00:15:52,708 Benjamin, can you come up here. Is Joe here? Joe. He wrote Invoke-Mimikatz which is the 122 00:15:56,167 --> 00:16:02,167 awesome PowerShell script and added. Will and a bunch of other people. This is Vince. Vince has 123 00:16:06,333 --> 00:16:12,917 never been to America. He came all the way here for DEF CON and black hat. He seldomly ventures 124 00:16:12,917 --> 00:16:18,917 out of France and it took a lot of negotiating I think and I just really want him to feel 125 00:16:21,542 --> 00:16:28,000 appreciated for his tool Mimikatz and the number of people that use it so let's give 126 00:16:28,000 --> 00:16:30,500 them a hand. (Applause). 127 00:16:30,500 --> 00:16:36,500 >>> And I think for his long trip, he deserves this speaker badge more than I do. So I'm 128 00:16:39,500 --> 00:16:44,000 going go ahead and give him that. (Applause). 129 00:16:44,000 --> 00:16:50,000 >>> One more time for Ben and everybody else on the golden ticket stub. Other than that, 130 00:16:52,000 --> 00:16:58,000 that's all I got. I will see you guys around and partying tonight. (Applause).