00:00:00.000 --> 00:00:04.671 >>This is Red vs Blue- modern active directory attacks and 00:00:04.671 --> 00:00:10.744 defense. I’m Sean Metcalf. What's up, DEF CON? [ Cheers and 00:00:10.744 --> 00:00:14.114 applause ] Guys having fun? [Applause] Who here wants to see 00:00:14.114 --> 00:00:20.587 some cool attacks? Let's get into it. I'm a CTO of DAn 00:00:20.587 --> 00:00:23.490 Solutions, a company that provides Microsoft engineering 00:00:23.490 --> 00:00:28.295 solutions lot of cool security stuff. One of about 100 00:00:28.295 --> 00:00:32.366 Microsoft certificate fights masters in the world in active 00:00:32.366 --> 00:00:35.969 directory. I do security research specifically in active 00:00:35.969 --> 00:00:38.438 directory and Microsoft enterprise. I post this 00:00:38.438 --> 00:00:43.944 information, who here check the out that blog? Awesome. Thank 00:00:43.944 --> 00:00:47.814 you. And I speak occasionally. So, we're going to get right 00:00:47.814 --> 00:00:52.486 into the agenda I'm not going to add a lot of fluff. You've been 00:00:52.486 --> 00:00:56.023 at other presentation that I did, I'm not going to belabor 00:00:56.023 --> 00:00:59.059 the point basically we'll jump in we're going to look at what 00:00:59.059 --> 00:01:03.163 attackers are doing once they get on the network. We know that 00:01:03.163 --> 00:01:07.200 malware is getting on systems on the network, right? Easy sphere 00:01:07.200 --> 00:01:11.705 fish usee. Click on everything. We're going to start not with 00:01:11.705 --> 00:01:15.575 that but once the attackers on the network and what they do at 00:01:15.575 --> 00:01:18.545 that point. Then I'm going to talk about some defensive 00:01:18.545 --> 00:01:21.048 techniques that are practical and that could be used to defend 00:01:21.048 --> 00:01:24.785 against these sort of attacks. So we got to start with red 00:01:24.785 --> 00:01:29.289 team, right? What is the red team after? What are the 00:01:29.289 --> 00:01:33.527 attackers after? What motivates them other than maybe sharks 00:01:33.527 --> 00:01:37.331 with laser beams on their heads, I don't know. I'd go for the 00:01:37.331 --> 00:01:43.203 raptor. Powershell is being used as an attack method we know 00:01:43.203 --> 00:01:47.574 this. Has been around for awhile. Actually saw it one 00:01:47.574 --> 00:01:51.845 hotel after a Con there was a mimikatz screen up on the kiosk. 00:01:51.845 --> 00:01:57.851 So, yeah, we know power Sploit is being used. Just this Tuesday 00:02:00.087 --> 00:02:06.193 in Las Vegas harm joy released Powershell empire. This thing is 00:02:06.193 --> 00:02:10.063 a beast. You haven't heard of it check it out. Effectively this 00:02:10.063 --> 00:02:15.268 is one of the new post exploitation tools that if 00:02:15.268 --> 00:02:20.540 you're red team or going to be using. So, when an attacker gets 00:02:20.540 --> 00:02:25.912 on the network, are they going to porch scan? Not any more. 00:02:25.912 --> 00:02:30.851 Porch scanning is too obvious. We look for a bunch of different 00:02:30.851 --> 00:02:35.789 IPs connect to random ports, get a banner back, maybe not. This 00:02:35.789 --> 00:02:40.694 is in active directory we don't need to do porch scanning. We 00:02:40.694 --> 00:02:45.632 just ask the domain controller, hey, tell me all of your sql 00:02:45.632 --> 00:02:50.570 servers and where are they and what are they running on? Sure, 00:02:50.570 --> 00:02:56.743 here you go, that's my job. So, all I need to do as an attacker 00:02:56.743 --> 00:03:01.615 is request this information and I'm going to get it. Because the 00:03:01.615 --> 00:03:06.153 service principle name or Spn needed for a server to support 00:03:06.153 --> 00:03:08.989 authentication. I'm pretty sure that just about every 00:03:08.989 --> 00:03:11.591 application on the network now at least if it's a service 00:03:11.591 --> 00:03:16.229 running on a server supports kerberos. We can find this 00:03:16.229 --> 00:03:22.702 through SPNS. What can we find using Spns I've listed a few 00:03:22.702 --> 00:03:26.206 here. But if you've heard of Powershell remoting it leverages 00:03:26.206 --> 00:03:33.513 Win RM. We can look for the SPN what about FIM? Lot of 00:03:33.513 --> 00:03:38.518 environments are deploying this in order to manage groups. Fim 00:03:38.518 --> 00:03:42.522 has a SPN guess what we can search for it. We can use 00:03:42.522 --> 00:03:45.125 Powershell toe find these things. We can Powershell for 00:03:45.125 --> 00:03:49.229 it. We can also look for the service accounts. If I knew 00:03:49.229 --> 00:03:53.600 there's a SQL Server running a as a service account on the 00:03:53.600 --> 00:03:57.037 network, I can find it. I go, hey, Mr. Domain controller 00:03:57.037 --> 00:04:02.175 please tell me all of the user accounts in this environment in 00:04:02.175 --> 00:04:05.812 this active directory forest that have service principle 00:04:05.812 --> 00:04:10.050 names. The service principle names include the server name. 00:04:10.050 --> 00:04:12.519 Includes the port if we're talking about SQL maybe some of 00:04:12.519 --> 00:04:16.523 the others or the instance name. And what do you think I'm going 00:04:16.523 --> 00:04:21.361 to do with this information? I'm going to attack it. So, I'm 00:04:21.361 --> 00:04:25.265 going to use a tool called concern bears which was release 00:04:25.265 --> 00:04:31.271 -- kerberos. A python-based cracking tool. As an attacker, I 00:04:33.573 --> 00:04:37.711 get code on a system that has domain user logged on. I am that 00:04:37.711 --> 00:04:41.214 domain user now. I am going to request from the domain 00:04:41.214 --> 00:04:45.352 controller a service ticket. Ticket granting service, TGS, 00:04:45.352 --> 00:04:50.290 whatever you want to call it, a service ticket. I'm going to get 00:04:50.290 --> 00:04:54.060 that service ticket, that service ticket I was only able 00:04:54.060 --> 00:04:57.998 to get because I asked for specific service principle name. 00:04:57.998 --> 00:05:02.769 That SPN is associated with an account. Why is that? Well, that 00:05:02.769 --> 00:05:05.839 service ticket is encrypted using that service accounts 00:05:05.839 --> 00:05:11.912 password data. Following? Now, I can attempt to guess that 00:05:11.912 --> 00:05:15.749 password and if I can guess that password I can open up that 00:05:15.749 --> 00:05:19.719 ticket. No elevated rights are required, I don't need to be an 00:05:19.719 --> 00:05:24.057 admin, I don't need to touch a DC other than just doing normal 00:05:24.057 --> 00:05:27.260 user stuff. There's no traffic sent to the target. This is all 00:05:27.260 --> 00:05:31.998 normal active directory stuff. So, at the top I'm going to send 00:05:31.998 --> 00:05:35.001 -- going to send a Powershell command say, the domain 00:05:35.001 --> 00:05:38.271 controller I need a service ticket for this service 00:05:38.271 --> 00:05:40.807 principle name. And at the bottom you can see that I get 00:05:40.807 --> 00:05:46.213 this ticket. I export this ticket from memory. I'm a user. 00:05:46.213 --> 00:05:50.317 I have access to my own memory space. Because that's where my 00:05:50.317 --> 00:05:56.189 tickets are. To a file. Then send this file up to a server 00:05:56.189 --> 00:05:59.059 that I have running on, I don't know, AWS or Azure or something 00:05:59.059 --> 00:06:02.395 like that. As long as I got some power behind it I can go ahead 00:06:02.395 --> 00:06:06.600 and crack this ticket. When I crack the password for this 00:06:06.600 --> 00:06:10.103 ticket I know the password for the service account. Which means 00:06:10.103 --> 00:06:15.508 I own that service account. Why is that possible? How long are 00:06:15.508 --> 00:06:20.513 service account passwords? Exactly the same as the domain 00:06:20.513 --> 00:06:24.117 minimum. So, if the domain minimum is eight characters my 00:06:24.117 --> 00:06:28.655 service account password, it might be ten, probably eight. If 00:06:28.655 --> 00:06:34.194 I'm lucky the domain password minimum is 14. That's pretty 00:06:34.194 --> 00:06:37.564 easy to crack especially if I'm using like a Bitcoin rig. What's 00:06:37.564 --> 00:06:42.502 the mitigation of this? Longer character passwords. You have to 00:06:42.502 --> 00:06:47.641 make the passwords longer. I'm sorry blue teamers. I'm sorry 00:06:47.641 --> 00:06:50.710 admins of services. But you have to do that. Because you don't 00:06:50.710 --> 00:06:53.213 want your service account to be the reason why your entire 00:06:53.213 --> 00:06:56.783 domain has gotten compromised. There's a new feature called 00:06:56.783 --> 00:07:00.320 managed service accounts that Microsoft put out there with -- 00:07:00.320 --> 00:07:04.157 earlier version of Windows I believe it was 2008 R2, 2012. 00:07:04.157 --> 00:07:07.861 Which is where the active -- domain controller itself 00:07:07.861 --> 00:07:11.164 actually changes those passwords. If you wanted to 00:07:11.164 --> 00:07:15.702 detect this it's difficult if I'm a sneaky attacker I'm going 00:07:15.702 --> 00:07:20.640 to ask for a couple of service principle names every so often. 00:07:20.640 --> 00:07:25.979 How are you going to notice that with this flood of 4796 events 00:07:25.979 --> 00:07:29.683 coming out. Then there's group policy preferences. Red teamers 00:07:29.683 --> 00:07:32.852 love group policy preferences. Microsoft released this with 00:07:32.852 --> 00:07:39.326 Windows server 2008. Awhile ago. Few years ago someone realized 00:07:39.326 --> 00:07:46.599 that while the password data, credentials for group policy 00:07:46.599 --> 00:07:52.639 preferences was ARES 267 encrypted. Microsoft published 00:07:52.639 --> 00:08:00.213 the private key on MSDN. My guess is this was for third 00:08:00.213 --> 00:08:02.916 party interoperability because Microsoft gets trashed when it 00:08:02.916 --> 00:08:05.685 comes to that. So as ab a attacker what do I do, I scan 00:08:05.685 --> 00:08:10.990 Sys Fal I look for XML files. I'm going to check those files 00:08:10.990 --> 00:08:15.462 look for a C-password attribute. When I find that attribute that 00:08:15.462 --> 00:08:20.367 blob of data in quotes after that is the AES encrypted blob 00:08:20.367 --> 00:08:26.506 ever data. That is the password. All I've got to do is run an EA 00:08:26.506 --> 00:08:30.643 1 function against it and I have a password. That's a pretty good 00:08:30.643 --> 00:08:37.817 password. Note to self, I have to change my password now. Once 00:08:37.817 --> 00:08:40.887 in a an attack has that information, how are they going 00:08:40.887 --> 00:08:43.857 to leverage it? How is group policy preference typically 00:08:43.857 --> 00:08:47.794 used? Well, most of the time from what I've seen it's been 00:08:47.794 --> 00:08:50.230 used to change local admin password for a large number of 00:08:50.230 --> 00:08:56.002 computers. But we've just given the attacker that data which 00:08:56.002 --> 00:09:00.040 means that they are effectively local admin on hundreds if not 00:09:00.040 --> 00:09:05.044 thousands of computers. What can they do now? Well, Microsoft 00:09:05.044 --> 00:09:08.281 Windows is very friendly, very helpful. If I have a computer 00:09:08.281 --> 00:09:10.817 over here and the local admin account, password is the same as 00:09:10.817 --> 00:09:15.288 computer on here, local accounts, they can go ahead 00:09:15.288 --> 00:09:17.557 communicate I can log in over here then connect to the 00:09:17.557 --> 00:09:21.461 resources over here as an admin. So, the whole local thing is a 00:09:21.461 --> 00:09:26.733 bit of a misnomer. So, as far as group policy preferences we need 00:09:26.733 --> 00:09:31.438 to make sure that we're not using it to store credentials 00:09:31.438 --> 00:09:34.707 because they can be reversed very easily. Installing this 00:09:34.707 --> 00:09:39.045 patch will prevent someone from typing in the credentials. Which 00:09:39.045 --> 00:09:43.850 means it won't be stored in SCYFAL. They have to Stan then 00:09:43.850 --> 00:09:48.888 pull that data out. Detecting this, the best way that I've 00:09:48.888 --> 00:09:55.094 seen setting up an XML file dropping it in Sysfal. Then 00:09:55.094 --> 00:09:58.998 audit it to see who is trying to access it. Then you get good 00:09:58.998 --> 00:10:04.804 event on your domain controler. As far as preventing the 00:10:04.804 --> 00:10:08.174 pivoting of an attacker once they get a local admin account, 00:10:08.174 --> 00:10:12.212 there's two different approaches to this. Two parts to the 00:10:12.212 --> 00:10:17.050 ultimate solution. Make sure password is randomized and 00:10:17.050 --> 00:10:21.120 unique. It's been a big challenge. We thought that at 00:10:21.120 --> 00:10:23.623 least a group policy preferences would help us along with that. 00:10:23.623 --> 00:10:29.629 It doesn't. Microsoft released a tool in May called laps, it's 00:10:29.629 --> 00:10:34.167 decent, it works, better than nothing. There is a couple 00:10:34.167 --> 00:10:40.440 others that are pay or free. But other thing you can do deploy 00:10:40.440 --> 00:10:46.546 KB2871997 which is effectively a back port of the security 00:10:46.546 --> 00:10:51.818 features and functionality from 2012R2 and Windows 8.1. Couple 00:10:51.818 --> 00:10:55.355 of new local Sids on the computers. You can use those 00:10:55.355 --> 00:11:02.095 local Sids in group policy where you say, local users cannot log 00:11:02.095 --> 00:11:06.499 in over the network. That just makes sense. The other thing is 00:11:06.499 --> 00:11:09.569 we need to stop allowing work station to work station 00:11:09.569 --> 00:11:14.073 communication. Our networks are very flat. Hackers love this. I 00:11:14.073 --> 00:11:17.010 can spear fish user over here then I can connect over here to 00:11:17.010 --> 00:11:20.113 the president's work station. I can access the server over here, 00:11:20.113 --> 00:11:24.317 I can access the server there. We need to stop with the flat 00:11:24.317 --> 00:11:28.121 networks. Ultimately what we need to do is identify where our 00:11:28.121 --> 00:11:32.392 sincetive data is, does it make sense for any random user on our 00:11:32.392 --> 00:11:35.929 network to be able to access the back end HR server, finance 00:11:35.929 --> 00:11:41.935 server, badge system. Mimikatz, everyone knows mimikatz. You can 00:11:44.304 --> 00:11:49.742 read. Dumb credentials, dumb tickets, inject those tickets, 00:11:49.742 --> 00:11:54.047 use them, forge golden and silver tickets, right? This is 00:11:54.047 --> 00:12:00.019 what it looks like. You never actually seen it. The Windows 00:12:00.019 --> 00:12:03.122 developers thought it was a great idea in order to make sure 00:12:03.122 --> 00:12:06.159 that if user ever got prompted for preR credentials just go 00:12:06.159 --> 00:12:10.129 ahead handle that request from memory. So the clear text 00:12:10.129 --> 00:12:13.399 password or reversible version much it was placed in LSAL that 00:12:13.399 --> 00:12:18.037 protected. You can see there is passwords there. On the left 00:12:18.037 --> 00:12:23.376 side is user account, actually Hans Solo, nice guy. But his 00:12:23.376 --> 00:12:25.845 credentials are now stolen because he's logged on recently 00:12:25.845 --> 00:12:30.717 to the server. But worse than that, any service that's running 00:12:30.717 --> 00:12:34.721 on this system with explicit credentials they were typed in 00:12:34.721 --> 00:12:39.726 or configured within some sort of tool, are exposed here also. 00:12:39.726 --> 00:12:44.597 If you have services running as domain admin on work stations, 00:12:44.597 --> 00:12:48.134 in this sort of scenario, your whole domain will be compromised 00:12:48.134 --> 00:12:52.005 after one work station or maybe single server is compromised. 00:12:52.005 --> 00:12:56.542 What do attackers do to get the credentials for ad? Well, one, 00:12:56.542 --> 00:13:00.880 they can look for that file that active directory database. Or 00:13:00.880 --> 00:13:07.420 they can grab a domain admin's credential. How do they find 00:13:07.420 --> 00:13:11.224 this. Backups. We have to back up our domain controllers, 00:13:11.224 --> 00:13:14.761 right? Don't want them to fail and then not be able to recover. 00:13:14.761 --> 00:13:17.864 We have corruption that could happen, some time users delete 00:13:17.864 --> 00:13:22.435 or admins delete users make sure we can recover them. So, where 00:13:22.435 --> 00:13:26.939 is the domain controller on Az or San some other device that 00:13:26.939 --> 00:13:30.410 has a bunch of hard drives in it. Let's talk about virtual 00:13:30.410 --> 00:13:33.312 environment. Not going to ask people to raise hands I'm sure 00:13:33.312 --> 00:13:36.816 that most environments now have at least one virtual, saves 00:13:36.816 --> 00:13:41.688 money, efficient. But are you considering that your virtual 00:13:41.688 --> 00:13:45.925 admins are effectively domain. Treating them as such. Because 00:13:45.925 --> 00:13:51.831 in VMware all I need to do as VMware administrator is clone a 00:13:51.831 --> 00:13:57.036 virtual DC, take that clone DCVM I don't have to start it, I can 00:13:57.036 --> 00:13:59.939 copy down the storage associated with it to my computer. So, 00:13:59.939 --> 00:14:06.112 guess what I have. I have a dip. So, the other thing that's 00:14:06.112 --> 00:14:10.016 interesting is, if I'm an attacker and I drop myself on a 00:14:10.016 --> 00:14:13.086 server, very sensitive. I don't want to run some hacking tools 00:14:13.086 --> 00:14:19.158 on it. I can just use task manager to then dump the LSAS. 00:14:19.158 --> 00:14:23.996 The process. To a file. Once I have that I can copy it off 00:14:23.996 --> 00:14:26.866 somewhere else and I can use mimikatz for another tool to 00:14:26.866 --> 00:14:30.069 then crack that open get the credentials from it. For whoever 00:14:30.069 --> 00:14:34.507 was logged on to memory at that time or recently. If it's a 00:14:34.507 --> 00:14:38.644 domain admin then I own the domain now. This is what it 00:14:38.644 --> 00:14:40.747 looks like once I get the credentials and I dump the 00:14:40.747 --> 00:14:44.984 domain. In red is the default administrator account for the 00:14:44.984 --> 00:14:48.955 domain. The next one that's in yellow is the account. Now I can 00:14:48.955 --> 00:14:53.793 create golden tickets. But there's a tool called NTS2 that 00:14:53.793 --> 00:14:58.131 administrators use. If I have a whole bunch of BCs I need to if 00:14:58.131 --> 00:15:03.703 I have DC in branch office and it's failed I need a new one, 00:15:03.703 --> 00:15:10.109 what am I going to do? I run DC promo it has to copy the data 00:15:10.109 --> 00:15:15.581 from the DC in the headquarters. Or I can run create an IFM 00:15:15.581 --> 00:15:19.252 install from media set copy that over to that server then when I 00:15:19.252 --> 00:15:25.491 run DC pro. It sees that promo process with a copy of the 00:15:25.491 --> 00:15:28.528 database. Now just needs to copy down the deltas over the wire. 00:15:28.528 --> 00:15:34.734 What's interesting about this, that's the file, system hive, 00:15:34.734 --> 00:15:39.105 has a security hive. SYS keys in there. If I'm an attacker I 00:15:39.105 --> 00:15:42.708 really want to own this domain and I can't get access to a 00:15:42.708 --> 00:15:45.745 domain controller or something else, maybe I can get on that 00:15:45.745 --> 00:15:48.481 server because it's not yet a domain controller. Probably not 00:15:48.481 --> 00:15:51.818 protected at the same level as domain controller or maybe some 00:15:51.818 --> 00:15:56.455 enterprising domain admin do an IFM set let's put it up on a 00:15:56.455 --> 00:16:00.126 share that we can use it for when we're promoting our DCs. 00:16:00.126 --> 00:16:05.298 Well, I'm the attacker I get that I now own that active 00:16:05.298 --> 00:16:09.869 directory environment because I can do one command and use 00:16:09.869 --> 00:16:17.076 impact of the python tool and dump it. Now I have the account, 00:16:17.076 --> 00:16:24.383 I can create golden tickets. Just some day Benjamin Delpy 00:16:24.383 --> 00:16:29.288 tweeted this post. DCSync, I'm sure lot of people were very 00:16:29.288 --> 00:16:34.227 interested as far as what this does. Basically this says, when 00:16:34.227 --> 00:16:37.063 you run it as a domain admin in the environment you go, hey, I'm 00:16:37.063 --> 00:16:40.199 a domain controller, can I have the password hashes for this 00:16:40.199 --> 00:16:46.806 please? Guess what happens, the DC provides that information. 00:16:46.806 --> 00:16:49.876 What else does it provide? It provides the history of the 00:16:49.876 --> 00:16:55.715 passwords for that user. Right now it's one user at a time but 00:16:55.715 --> 00:16:59.652 I think it's pretty easy to Powershell it and get some very 00:16:59.652 --> 00:17:03.923 interesting accounts. Yeah, domain controller get password 00:17:03.923 --> 00:17:11.430 hashes, I agree with Brad Pitt, that's pretty bad. So, the 00:17:11.430 --> 00:17:16.035 detection is kind of difficult, but the mitigation is pretty 00:17:16.035 --> 00:17:18.738 straight forward at least it seems fairly obvious. Not easy 00:17:18.738 --> 00:17:21.741 to do in an environment but what we need to ensure we do is 00:17:21.741 --> 00:17:25.478 protect our admin credentials. Need to ensure that our admins 00:17:25.478 --> 00:17:30.349 are locking on only specific systems. Need to limit where 00:17:30.349 --> 00:17:33.252 these credentials are stored or placed so that way don't end up 00:17:33.252 --> 00:17:37.723 with them all over our network. Seriously consider if you're not 00:17:37.723 --> 00:17:42.161 already doing it special admin work stations specifically for 00:17:42.161 --> 00:17:46.532 your admins, be they domain admins or server admins. Even 00:17:46.532 --> 00:17:50.536 work station admins we cannot continue where domain admins 00:17:50.536 --> 00:17:56.008 were logging on to the same sort of systems as everyone else. 00:17:56.008 --> 00:17:59.946 November of last year Microsoft released an out of band patch 00:17:59.946 --> 00:18:03.049 for a serious kerberos vulnerability. Now, the pack is 00:18:03.049 --> 00:18:10.456 privileged attribute certificate, the way that the 00:18:10.456 --> 00:18:13.592 group membership information is stored within that kerberos 00:18:13.592 --> 00:18:17.296 ticket. So, the domain controller wasn't actually 00:18:17.296 --> 00:18:20.800 properly validating this meaning that an attacker could modify a 00:18:20.800 --> 00:18:24.337 ticket and say I'm a domain admin, I'm an enterprise admin, 00:18:24.337 --> 00:18:28.574 that's kind of a problem. So try plaining that to an executive. I 00:18:28.574 --> 00:18:33.279 love Gavin Miller's analogy where you have a boarding pass 00:18:33.279 --> 00:18:36.949 when you're getting on a plane, you take a sharpie and write 00:18:36.949 --> 00:18:40.720 "pilot" and hand it over, oh, welcome, captain, come on over, 00:18:40.720 --> 00:18:43.823 here is the cockpit, have seat. Would you like coffee before we 00:18:43.823 --> 00:18:48.294 take off? Exactly what this is. Basically going from a domain 00:18:48.294 --> 00:18:52.264 user to a domain admin in about five minutes. What's the 00:18:52.264 --> 00:18:54.800 exploit? Well, there were exploits in the wild when 00:18:54.800 --> 00:18:59.639 Microsoft released this patch. Two weeks after the patch there 00:18:59.639 --> 00:19:04.343 was a python tool for this. Py cat. I believe the first, I know 00:19:04.343 --> 00:19:09.615 golden pack and been a couple of others since then. But what it 00:19:09.615 --> 00:19:13.252 does it requests ATGT that authentication ticket that says, 00:19:13.252 --> 00:19:18.924 I don't need a pack, don't put one in there. Sure, here you go. 00:19:18.924 --> 00:19:23.062 Then it creates a forged pack saying, domain admin enterprise 00:19:23.062 --> 00:19:27.433 admin, pretty much all the good stuff. Then sends back the TGT 00:19:27.433 --> 00:19:32.004 from the DC and that forge pack has authenticator goes, here you 00:19:32.004 --> 00:19:35.608 go, the DC gets all confused with the service request goes, 00:19:35.608 --> 00:19:39.678 wait a second, you have a TGT, no pack, you have authenticator 00:19:39.678 --> 00:19:43.249 I'm going to dump that TGT create a new one put that forged 00:19:43.249 --> 00:19:49.255 pack into it and give it back to you. Golden ticket. Done. 00:19:51.257 --> 00:19:56.062 Benjamin Delpy earlier this year updated his suite with a tool 00:19:56.062 --> 00:19:59.865 that exploits this he improved on it a little bit. It actually 00:19:59.865 --> 00:20:04.870 scans and identifies vulnerable DCs on the environment. So, if 00:20:04.870 --> 00:20:07.940 you thought you were safe with kind of a hard protect mentality 00:20:07.940 --> 00:20:15.147 that doesn't work. Vulnerable DCs, don't have the patch. It 00:20:15.147 --> 00:20:18.417 finds it. Checks with one, gets an error. Checks with another 00:20:18.417 --> 00:20:23.355 one, gets an error. Success, golden ticket. The other thing 00:20:23.355 --> 00:20:28.127 that Pecio does that's very interesting is, he added a step 00:20:28.127 --> 00:20:31.363 at the end where it takes that TGT with the forged pack, which 00:20:31.363 --> 00:20:34.633 is only viable, only usable against that DC that's 00:20:34.633 --> 00:20:39.505 vulnerable. And now it uses that requests a delegation ticket. 00:20:39.505 --> 00:20:45.144 Now work on any DC. So you have one DC that's unpatched, doesn't 00:20:45.144 --> 00:20:51.150 matter we can pass that ticket to another one. So, yeah, 00:20:53.486 --> 00:20:57.323 response to this is simple. Next year server build, server 00:20:57.323 --> 00:21:01.894 imagine includes this patch. Because if you stand up at DC 00:21:01.894 --> 00:21:05.998 that's not patched against this you will get owned very quickly. 00:21:05.998 --> 00:21:08.934 Highly recommend you add a step just before you run DC promo as 00:21:08.934 --> 00:21:12.204 part of your QA where you check for this hot fix. You don't get 00:21:12.204 --> 00:21:18.410 that result back, don't run DC promo. So now the cool DEF CON 00:21:18.410 --> 00:21:22.648 part. Anyone here that was in my Black Hat talk a couple of days 00:21:22.648 --> 00:21:27.520 ago this wasn't in it, this is new. I'm going to talk about 00:21:27.520 --> 00:21:32.224 some sneaky persistence tricks. What happens when an attacker 00:21:32.224 --> 00:21:36.028 gets admin access to domain controller for five minutes. 00:21:36.028 --> 00:21:42.301 Now, do any number of things, we all know that. We have no idea 00:21:42.301 --> 00:21:45.671 what's being done, there are a finite number. I'll talk about a 00:21:45.671 --> 00:21:51.277 couple of them, the ones on the left. >> inventory services 00:21:51.277 --> 00:21:56.515 restore mode, see hands, anyone know what this is? Excellent. 00:21:56.515 --> 00:22:01.420 Ever change the password for it? Ever used it? Couple. This is 00:22:01.420 --> 00:22:04.690 the break glass account for active directory it's actually a 00:22:04.690 --> 00:22:10.129 local admin account for domain controller. That sounds odd. The 00:22:10.129 --> 00:22:14.900 password set at DC promo doesn't change after that. And the 00:22:14.900 --> 00:22:19.605 process to change it is mostly manual probably the best way to 00:22:19.605 --> 00:22:24.210 change it is with server 2008 now supports syncing with an 00:22:24.210 --> 00:22:27.213 account in active directory, you can see in that white box I have 00:22:27.213 --> 00:22:31.817 a account called DSRM test, I can see what the account 00:22:31.817 --> 00:22:36.789 password is at the bottom I've done a Sam dump that way I can 00:22:36.789 --> 00:22:39.325 see what the administrator account on the domain controller 00:22:39.325 --> 00:22:43.095 password is, they're the same. That's interesting. How can I 00:22:43.095 --> 00:22:49.101 use that? Well, in order to log in and use these DSRM CREDS I 00:22:51.370 --> 00:22:57.142 have to reboot in DSRM, directory services -- that was 00:22:57.142 --> 00:23:01.947 2008 I can now set Reg key to one. I have to stop the 00:23:01.947 --> 00:23:08.087 directory service, I don't want to do that. I said it to to I 00:23:08.087 --> 00:23:14.026 need console log in. Remember the DSRM was developed in 2000. 00:23:14.026 --> 00:23:19.598 What's changed? We can now log in over the network, console no 00:23:19.598 --> 00:23:23.969 longer just on the console in that server room any more. We 00:23:23.969 --> 00:23:28.908 have virtual machines, virtual clients. We have lights out 00:23:28.908 --> 00:23:33.879 capability, out of band capability, network KBMs so if 00:23:33.879 --> 00:23:38.384 an attacker, I still have access to that I change DSRM password I 00:23:38.384 --> 00:23:41.353 can get into that domain controller on to that file 00:23:41.353 --> 00:23:46.191 system do whatever I want. So, make sure you change your DSRM 00:23:46.191 --> 00:23:49.061 passwords. There's another interesting way that was updated 00:23:49.061 --> 00:23:53.699 in mimikatz last year called the security service provide, SSPf, 00:23:53.699 --> 00:23:59.538 if we modify this or if we add our own to the list of SSPs that 00:23:59.538 --> 00:24:06.512 are there, then we can actually interact with LSAS. The SSP is 00:24:06.512 --> 00:24:08.547 way to plug in a new authentication method into 00:24:08.547 --> 00:24:14.753 Windows. If we inject either memory or we update registry key 00:24:14.753 --> 00:24:19.391 drop a DLL on there, whenever someone logs on to this box they 00:24:19.391 --> 00:24:22.928 get saved to a file. Including the domain controller computer 00:24:22.928 --> 00:24:26.498 account password any service account data that runs on it. 00:24:26.498 --> 00:24:31.370 Service account credentials. Well, that's interesting, but if 00:24:31.370 --> 00:24:38.577 we save that file to where LSAS is I'm not going to be able to 00:24:38.577 --> 00:24:42.481 access if I get dumped out at domain admin. How can I get 00:24:42.481 --> 00:24:45.784 access? So let's talk SYSfal you have this share accessible to 00:24:45.784 --> 00:24:48.253 every domain user, every authenticated. This is what a 00:24:48.253 --> 00:24:51.423 group policy template file is like in one of these random 00:24:51.423 --> 00:24:56.228 group policies. What if I redirect my SSP to point to that 00:24:56.228 --> 00:25:01.400 location. Now as a domain user I can get access to all the 00:25:01.400 --> 00:25:05.104 password data and credentials of those who log on to a DC. 00:25:07.473 --> 00:25:11.610 Skeleton key, earlier this year, Dell secure works identified in 00:25:11.610 --> 00:25:14.580 memory mall way on domain controller at a customer site 00:25:14.580 --> 00:25:18.851 where LSAS was patched in realtime. What this meant was, 00:25:18.851 --> 00:25:21.587 the attackers had their own master password they could use 00:25:21.587 --> 00:25:26.525 for any user account. So if this room is the active directory 00:25:26.525 --> 00:25:30.362 domain everyone in here is a user, you have your own 00:25:30.362 --> 00:25:32.631 individual password, you're logging in, you're doing your 00:25:32.631 --> 00:25:36.201 work, doing everything you need to. Me as the attacker I drop 00:25:36.201 --> 00:25:42.775 skeleton key on this DC as mimikatz I can log on as you. 00:25:42.775 --> 00:25:46.512 This example I show at the top I've logged on as admin with one 00:25:46.512 --> 00:25:53.252 password. Then I've logged on as admin with another password. Now 00:25:53.252 --> 00:25:59.258 let's talk sid history. It's a legacy capability that Microsoft 00:26:02.327 --> 00:26:06.365 added so that in a migration scenario where you have an old 00:26:06.365 --> 00:26:09.468 domain and new domain, you have a user that's moved from the old 00:26:09.468 --> 00:26:12.771 domain to the new domain, they can still access the resources 00:26:12.771 --> 00:26:16.942 in the old domain. How do they do this? Well, the old domain 00:26:16.942 --> 00:26:21.980 user has a sid, the new has a sid create attribute called a 00:26:21.980 --> 00:26:27.052 sid history. When that user logs on all the Syds are evaluated as 00:26:27.052 --> 00:26:29.488 to whether or not they should have access to a resource then 00:26:29.488 --> 00:26:33.459 based on that data they get access or not. What's 00:26:33.459 --> 00:26:36.929 interesting about this while it was originally intended to work 00:26:36.929 --> 00:26:40.032 across domains or across forests it actually works in the same 00:26:40.032 --> 00:26:46.839 domain. So, I can inject the default administrator account -- 00:26:46.839 --> 00:26:53.912 through the sid history of any user I want. I use -- he's a 00:26:53.912 --> 00:26:59.751 spy. So here you can see a quick Powershell example of what 00:26:59.751 --> 00:27:06.158 Bobafet's group membership is, member of is blank. Is 103 just 00:27:06.158 --> 00:27:11.797 below that is the account. That's interesting. That 00:27:11.797 --> 00:27:15.334 probably shouldn't happen. Well, it shouldn't because now Bobafet 00:27:15.334 --> 00:27:19.571 can log on to a work station, Powershell remote to domain 00:27:19.571 --> 00:27:23.942 controller running who am I on that, it shows it's Bobafet 00:27:23.942 --> 00:27:29.248 logged on now through Powershell remoting we can run mimikatz to 00:27:29.248 --> 00:27:34.987 dump the account. This just came out a couple of weeks ago, Jared 00:27:34.987 --> 00:27:41.693 Atkinson developed a custom W-my class normal usage looks like 00:27:41.693 --> 00:27:47.232 net stat. But it actually enables arbitrary command 00:27:47.232 --> 00:27:51.003 execution such as Powershell code. So again I can run 00:27:51.003 --> 00:27:55.507 mimikatz as a user on this box, but it runs a system and there's 00:27:55.507 --> 00:28:00.579 no mimikatz shows up in the task manager. The process list. It 00:28:00.579 --> 00:28:04.716 runs under the context of W-my. I worked with casey Smith soon 00:28:04.716 --> 00:28:07.886 after that, he was a big help he wrote a custom provider for me 00:28:07.886 --> 00:28:10.856 because I said, hey, would be great if this custom W-my 00:28:10.856 --> 00:28:15.761 provider would enable remote access for domain user. Then run 00:28:15.761 --> 00:28:21.433 system on the domain controller and so he did that. You drop a 00:28:21.433 --> 00:28:25.304 DLL in the box, you run Powershell script. I'm system, 00:28:25.304 --> 00:28:31.243 even though I'm logging in as a user. Here you can see again I 00:28:31.243 --> 00:28:35.113 can execute mimikatz.EXE on that box or another Powershell 00:28:35.113 --> 00:28:37.583 command that I want. It's difficult to see. At the bottom 00:28:37.583 --> 00:28:42.955 it says I'm Joe user. But this command runs system on the 00:28:42.955 --> 00:28:50.395 domain control. The task list this is part of Wmy, WMY 00:28:50.395 --> 00:28:54.866 supports remote execution. This pops up for about 30 seconds and 00:28:54.866 --> 00:29:00.172 it disappears. You probably have known some of this but let's 00:29:00.172 --> 00:29:04.576 talk about Powershell empire for a minute. I'm really impressed 00:29:04.576 --> 00:29:09.047 with this. Because it's a Powershell-based rat with 00:29:09.047 --> 00:29:13.852 modules. Including mimikatz. We can do it all through Powershell 00:29:13.852 --> 00:29:16.421 if I get access to a domain controller or admin server, 00:29:16.421 --> 00:29:20.525 admin jump box whatever you want to call it, I can use Powershell 00:29:20.525 --> 00:29:23.895 empire and inject into a process of my choosing the Powershell 00:29:23.895 --> 00:29:29.901 listener for empire. What's highlighted here is LSAS. I can 00:29:32.804 --> 00:29:38.877 also dump credentials pull that back. Very sneaky. So, how do 00:29:38.877 --> 00:29:44.783 you protect against these things? DSRM you have to change 00:29:44.783 --> 00:29:49.521 the passwords. SSP look for registry configuration. Skeleton 00:29:49.521 --> 00:29:51.990 key there's some interesting ticket encryption data that 00:29:51.990 --> 00:29:55.694 shows up. You want to start scanning your user accounts for 00:29:55.694 --> 00:30:01.600 any interesting sid history. Then looking at WMY to see what 00:30:01.600 --> 00:30:07.539 is out there, what's available. These custom Wmy providers have 00:30:07.539 --> 00:30:12.210 WMY methods that are quite unusual. Matt Graber and 00:30:12.210 --> 00:30:16.815 colleagues are talking about WMY how to protect this further 00:30:16.815 --> 00:30:19.851 tomorrow at 1:00. Highly recommend you see that. 00:30:19.851 --> 00:30:24.356 Ultimately comes down to protecting ad admin. Golden 00:30:24.356 --> 00:30:29.227 tickets. Are forged TGT that authentication ticket I 00:30:29.227 --> 00:30:33.865 mentioned earlier. And so what's interesting about this is 00:30:33.865 --> 00:30:37.069 because I've created that TGT locally I don't have to ask the 00:30:37.069 --> 00:30:40.138 DC for it, it's going to create it. Any log in restrictions or 00:30:40.138 --> 00:30:43.942 anything else like smart card is required. Isn't going to be in 00:30:43.942 --> 00:30:48.847 that TG because I'm not going to put that in there. I can be 00:30:48.847 --> 00:30:52.384 anyone I want, spoof anyone's access, impersonate, I could say 00:30:52.384 --> 00:30:56.588 I'm the janitor but I have access to all the groups that 00:30:56.588 --> 00:31:01.359 the CEO and director of R&D have. But there was bit of 00:31:01.359 --> 00:31:04.663 limitation with this so to speak. Everything access to 00:31:04.663 --> 00:31:11.103 wherever you want domain can be called a limitation. Multiple 00:31:11.103 --> 00:31:17.442 domain directory forest if we dump the TGT account password 00:31:17.442 --> 00:31:20.779 hash in that domain the enterprise admin group is not 00:31:20.779 --> 00:31:24.649 hosted by that domain this golden ticket is pounded by that 00:31:24.649 --> 00:31:30.055 domain it won't provide admin rights to another one. But, I 00:31:30.055 --> 00:31:33.058 did some research figured out that if we looked at sid in 00:31:33.058 --> 00:31:35.761 history, I reached out to Benjamin Delpy, he added to 00:31:35.761 --> 00:31:41.533 mimikatz. It now can cross that domain boundary because what I 00:31:41.533 --> 00:31:46.004 talked about earlier. This is inside of active directory. I 00:31:46.004 --> 00:31:51.443 can say I'm an EA from a domain, when I communicate or connect to 00:31:51.443 --> 00:31:57.048 resources and other domains. And it works. Silver tickets are 00:31:57.048 --> 00:31:59.851 probably the misunderstood younger brother of golden 00:31:59.851 --> 00:32:03.955 tickets. What's interesting about silver tickets is while 00:32:03.955 --> 00:32:06.992 they're forged service tickets and limit to that scope that 00:32:06.992 --> 00:32:11.863 have service on that box, I can still be an admin but what's 00:32:11.863 --> 00:32:13.965 really interesting about it is there's no communication with 00:32:13.965 --> 00:32:20.705 the domain controller at all. Because I've created that 00:32:20.705 --> 00:32:23.175 service ticket that's encrypted by that password data for that 00:32:23.175 --> 00:32:26.111 service on that serve. If you're not looking at service -- your 00:32:26.111 --> 00:32:28.613 security event logs on your servers, only looking at DCs 00:32:28.613 --> 00:32:33.919 you're going to miss this. Certain scenario, silver tickets 00:32:33.919 --> 00:32:37.689 can be more dangerous than golden tickets. What might that 00:32:37.689 --> 00:32:42.227 be. Every computer account and active directory has a password, 00:32:42.227 --> 00:32:48.700 join a computer to the domain, associated account is created, 00:32:48.700 --> 00:32:53.505 it has a password change about every 30 days. If the attacker 00:32:53.505 --> 00:32:57.776 dumps the main credentials for the entire domain, they know -- 00:32:57.776 --> 00:33:01.246 now know all those credentials including the domain controller 00:33:01.246 --> 00:33:05.884 computer account credentials, password hash. So even if change 00:33:05.884 --> 00:33:10.689 all the user and admin and service account passwords and 00:33:10.689 --> 00:33:13.658 TGT twice, they still have the domain controller computer 00:33:13.658 --> 00:33:18.563 passwords. If they -- they haven't changed I can do this. I 00:33:18.563 --> 00:33:23.068 can take a silver ticket, create a silver ticket for the HTTP 00:33:23.068 --> 00:33:26.137 service for that domain controller it's encrypted with 00:33:26.137 --> 00:33:29.574 that domain controller account which means valid for that 00:33:29.574 --> 00:33:33.345 service. It's going to open it up. I'm saying I'm domain admin. 00:33:33.345 --> 00:33:37.148 Then I'm going to create another silver ticket for WS man, what 00:33:37.148 --> 00:33:43.021 are these two cover? Win RM and Powershell remoting. Now I can 00:33:43.021 --> 00:33:47.626 take my silver tickets, Powershell remote to the DC and 00:33:47.626 --> 00:33:51.563 dump the curb TGT account thus taking silver tickets turning 00:33:51.563 --> 00:33:57.569 them into golden tickets. Let's talk about problems with trust. 00:34:04.142 --> 00:34:10.515 I presented last month on kerberos trust and how kerberos 00:34:10.515 --> 00:34:15.053 tickets work across them. When you have blue domain controller, 00:34:15.053 --> 00:34:18.256 blue domain and green domain and you want users in the blue 00:34:18.256 --> 00:34:21.760 domain to access green domain resources, blue domain admin 00:34:21.760 --> 00:34:25.797 creates a passwords, types it in. Sends that over to the green 00:34:25.797 --> 00:34:28.833 domain, domain admin they type it in. The trust is created. 00:34:28.833 --> 00:34:32.170 Well that password is typically shared over e-mail or something 00:34:32.170 --> 00:34:36.508 like that. It doesn't change for 30 days. So if an attacker can 00:34:36.508 --> 00:34:42.681 get access to that I can forge cross force TGT saying that I am 00:34:42.681 --> 00:34:45.717 whoever I want to be in the blue domain and provide that 00:34:45.717 --> 00:34:51.089 information to the green domain. Once I do that, I can access 00:34:51.089 --> 00:34:54.926 whatever I want on the green domain provided it's been Ackled 00:34:54.926 --> 00:34:59.130 for users or groups in the blue domain. This gets really 00:34:59.130 --> 00:35:01.900 interested when you talk about active directory forest where 00:35:01.900 --> 00:35:05.670 you have multiple domainsf I compromise the blue domain in 00:35:05.670 --> 00:35:08.974 this active directory forest I can create a trust ticket 00:35:08.974 --> 00:35:11.910 jumping over to the green domain say I'm domain admin, I'm an 00:35:11.910 --> 00:35:19.284 enterprise admin. So detection of this. Earlier this year I 00:35:19.284 --> 00:35:22.120 came up with some anomalies, discovered domain fields within 00:35:22.120 --> 00:35:28.293 these events on the bottom. Mimikatz was updated in late 00:35:28.293 --> 00:35:33.598 April, now you have this field on the bottom. These indicators 00:35:33.598 --> 00:35:37.736 don't work as well as they used to. But they may still work. But 00:35:37.736 --> 00:35:39.938 I'll talk about a different way that you can potentially detect 00:35:39.938 --> 00:35:45.977 this and do a pretty good job. Let's talk blue team. I know the 00:35:45.977 --> 00:35:50.782 computer defense often feels like 300 versus 300 --> 000. I'm not 00:35:50.782 --> 00:35:52.884 going to ask the blue teamers in the room to raise your hand 00:35:52.884 --> 00:36:00.258 because that would just be wrong. When we have 16 --> 000 00:36:00.258 --> 00:36:03.762 people at DEF CON, how many are blue teamers? Smaller 00:36:03.762 --> 00:36:07.365 percentage, probably. Let's talk about how we can defend against 00:36:07.365 --> 00:36:10.435 these attacks. Start with Powershell attack. It starts 00:36:10.435 --> 00:36:15.273 with logging your Powershell activity. How do you do this? 00:36:15.273 --> 00:36:19.511 You've got to get Powershell version 3 on all your computers, 00:36:19.511 --> 00:36:23.715 Powershell module logging, be a group policy. Once you do this, 00:36:23.715 --> 00:36:26.151 you'll start getting events that show up in the Powershell log in 00:36:26.151 --> 00:36:29.788 the Powershell operation log of what commands are actually being 00:36:29.788 --> 00:36:33.358 run in your environment. And from this information which you 00:36:33.358 --> 00:36:38.063 can feed into your sim tool you can look for interesting 00:36:38.063 --> 00:36:44.102 activity. Attacker -- usually starts with web client download, 00:36:44.102 --> 00:36:50.108 invoke expression. Encoded command. Which is bay 64 encoded 00:36:52.577 --> 00:36:59.417 command of Powershell. And some others. I highly recommend that 00:36:59.417 --> 00:37:03.154 you start looking at who is remoting to your servers. 00:37:03.154 --> 00:37:07.959 Tracking and ultimately limiting who is accessing Powershell over 00:37:07.959 --> 00:37:13.598 a remote session. Which leverages in or out. You can do 00:37:13.598 --> 00:37:17.368 this by adjusting the win RM listener scope on the server, 00:37:17.368 --> 00:37:20.939 that way, say you have exchange, not be able to kill Powershell 00:37:20.939 --> 00:37:25.110 on that. You can adjust the Powershell listener which is the 00:37:25.110 --> 00:37:30.915 win RM listener, to just a few admin subs, you want to track 00:37:30.915 --> 00:37:34.853 who is remoting in your system. Look at the events that are 00:37:34.853 --> 00:37:39.090 triggered or logged by that. And then audit meter Powershell 00:37:39.090 --> 00:37:43.027 usage you can audit it by using app locker in audit mode or 00:37:43.027 --> 00:37:46.631 track and meter Powershell usage with something like SSCM 00:37:46.631 --> 00:37:50.368 software meet are or something similar. If you realize that Joe 00:37:50.368 --> 00:37:53.238 user was running Powershell on like ten different computers in 00:37:53.238 --> 00:37:58.143 two hours, that could be a problem. But the story gets 00:37:58.143 --> 00:38:02.914 better with Powershell version 5. Which based on tweet I saw 00:38:02.914 --> 00:38:06.317 this morning from Microsoft should be out later in Q4. 00:38:06.317 --> 00:38:09.854 Probably in a few months. Of course if you want it today you 00:38:09.854 --> 00:38:12.090 have to install Windows 10 but I don't think anyone is that 00:38:12.090 --> 00:38:16.494 daring except me who put Windows 10 on my presentation laptop 00:38:16.494 --> 00:38:20.698 because I like to live dangerously. Start with script 00:38:20.698 --> 00:38:27.672 lock logging. The command I mentioned where if you had 00:38:27.672 --> 00:38:31.075 Powershell logging enabled it would just give you what that 00:38:31.075 --> 00:38:35.013 encoded command was. To create Sim alerts. It actually locks 00:38:35.013 --> 00:38:40.752 the final command that is executed by Powershell. 00:38:40.752 --> 00:38:47.125 Powershell, decodes whatever that command is and passes it 00:38:47.125 --> 00:38:50.395 over to the processor when it does that it logs that. Now we 00:38:50.395 --> 00:38:53.064 can create some really interesting alerts in our Sim 00:38:53.064 --> 00:38:58.136 tool. Also we get system-wide transcripts. Which means that 00:38:58.136 --> 00:39:02.640 all activity the users are doing on every computer can get logged 00:39:02.640 --> 00:39:05.443 to a transcript file. Historically just had one little 00:39:05.443 --> 00:39:08.680 transcript for this activity or whatever couldn't capture 00:39:08.680 --> 00:39:12.217 everything. We can create a group policy to have this data 00:39:12.217 --> 00:39:16.788 go to a share which we can Ackle so users can access it but they 00:39:16.788 --> 00:39:19.657 can be copied, data can be copied up there but not deleted 00:39:19.657 --> 00:39:23.461 later. We can ingest that information into our sim tool 00:39:23.461 --> 00:39:29.467 and create alerts on. If we had a host -- that's could be a 00:39:34.072 --> 00:39:39.277 problem. I don't know about you but I don't usually run 00:39:39.277 --> 00:39:44.515 Powershell from excel. There's also constrained Powershell 00:39:44.515 --> 00:39:46.618 which is really interesting. Constained Powershell language 00:39:46.618 --> 00:39:49.320 mode or contrained language mode something that's been around a 00:39:49.320 --> 00:39:52.290 couple of years, but there hasn't been a lot of information 00:39:52.290 --> 00:39:56.194 on how to leverage it. It is core Powershell which means that 00:39:56.194 --> 00:39:58.963 advance techniques that attackers typically use and 00:39:58.963 --> 00:40:01.966 leverage won't work. Because they won't have the .Net 00:40:01.966 --> 00:40:06.738 functional that is available within Powershell by default. 00:40:06.738 --> 00:40:09.507 Constrained Powershell locks it down to that core component. 00:40:09.507 --> 00:40:15.313 This gets enabled if you have app locker in allow mode when 00:40:15.313 --> 00:40:19.717 you have Powershell version 5 on your client's. Then in Windows 00:40:19.717 --> 00:40:22.854 10 the stories gets better you get anti-malware scanner before 00:40:22.854 --> 00:40:27.525 any code gets executed by Powershell, it gets kicked over 00:40:27.525 --> 00:40:31.496 to the AMSI, the anti-malware scanner device which means that 00:40:31.496 --> 00:40:34.399 whatever anti-malware software you have installed is actually 00:40:34.399 --> 00:40:37.669 going to check that code and Powershell not going to execute 00:40:37.669 --> 00:40:41.372 it until it gets status okay. This is pretty strong for blue 00:40:41.372 --> 00:40:46.377 teamers. About five years from now with Windows 10. But at 00:40:46.377 --> 00:40:49.113 least we're moving in the right direction, right? Because stuff 00:40:49.113 --> 00:40:52.350 like invoke mimikatz not going to work off the web, not going 00:40:52.350 --> 00:40:56.421 to work when run locally. Because it can be blocked by 00:40:56.421 --> 00:41:01.059 this. Can be blocked by either code snippets or signatures or 00:41:01.059 --> 00:41:07.899 even URL. Block Powershell execution from GitHub. Maybe not 00:41:07.899 --> 00:41:13.705 bank of America. So, to summarize some of the mitigation 00:41:13.705 --> 00:41:17.008 that I've been talking about this is what I call low 00:41:17.008 --> 00:41:20.578 complexity level or low implementation level. Starts 00:41:20.578 --> 00:41:24.015 with making sure that users aren't admins, really obvious. 00:41:24.015 --> 00:41:28.119 Unfortunately we use group, love group nesting using it all the 00:41:28.119 --> 00:41:31.422 time. Because of group nesting we end up with this group and 00:41:31.422 --> 00:41:36.327 that group and this group it's a spiderweb. And so we end up with 00:41:36.327 --> 00:41:38.629 a situation where people don't really know what this group is 00:41:38.629 --> 00:41:41.532 for any more or what it was delegated to. We go ahead put 00:41:41.532 --> 00:41:44.035 people in it where we add another group all of a sudden we 00:41:44.035 --> 00:41:50.108 have like 500 domain admins. I don't hear anyone laughing I'm 00:41:50.108 --> 00:41:56.481 guessing that's a true story. Followed up by nervous laughter. 00:41:56.481 --> 00:42:02.086 I'm really concerned now. The other beginning or other part of 00:42:02.086 --> 00:42:04.322 these mitigations making sure that the admin accounts are 00:42:04.322 --> 00:42:07.125 protected because also service accounts as I mentioned earlier. 00:42:07.125 --> 00:42:13.531 Good way to protect your admins to look at RDP restricted admin 00:42:13.531 --> 00:42:18.436 mode. Which is where when an admin logs in or RDPs into a 00:42:18.436 --> 00:42:22.740 server their credentials aren't stored in LSAS over there. It's 00:42:22.740 --> 00:42:27.445 turned into a network log in. Which means there's no 00:42:27.445 --> 00:42:31.916 credentials in LSAS to be stolen there. We move on to level two, 00:42:31.916 --> 00:42:35.420 moderate. And we start again with the randomizing computer 00:42:35.420 --> 00:42:40.091 local admin account passwords. Protecting our service account 00:42:40.091 --> 00:42:45.129 admins, service accounts. Hardening those up, basically we 00:42:45.129 --> 00:42:47.698 need to push back on our vendors because whenever a vendor comes 00:42:47.698 --> 00:42:50.001 into your organization what do they say the rights that are 00:42:50.001 --> 00:42:53.938 required for your service account. Domain admins, exactly. 00:42:53.938 --> 00:43:00.244 What do we say? Okay. You have this product I want this 00:43:00.244 --> 00:43:05.850 functionality. Yes, of course, where do I sign. But it's 00:43:05.850 --> 00:43:09.387 usually because the developers have not fully tested this 00:43:09.387 --> 00:43:15.726 product with anything but domain admins, may be -- may need 00:43:15.726 --> 00:43:20.231 domain admins for that initial install. So we also want to make 00:43:20.231 --> 00:43:24.001 sure that our service accounts are limited in scope and that we 00:43:24.001 --> 00:43:27.672 don't have service accounts that are running as domain admins. We 00:43:27.672 --> 00:43:33.678 need limits where they're running. Level three, it's 00:43:37.081 --> 00:43:42.587 complicated. It starts with emptying your domain admin 00:43:42.587 --> 00:43:47.258 group. We cannot use domain admins any more. It's way too 00:43:47.258 --> 00:43:50.928 powerful. Anyone want to guess where domain admins came from? 00:43:50.928 --> 00:43:56.934 Windows NT. Who loves Windows NT? Not me. Domain admins is 00:43:58.936 --> 00:44:05.409 1990s mentality. It's 1990s thinking approach to managing an 00:44:05.409 --> 00:44:10.948 enterprise. I love the '90s. Sure. Time to move on. We need 00:44:10.948 --> 00:44:15.653 to look at who the roles are that our admins need not just 00:44:15.653 --> 00:44:20.458 put them in domain admins. I've beein in customer sites where 00:44:20.458 --> 00:44:22.460 there were lot of different groups that were in domain 00:44:22.460 --> 00:44:24.462 admin, is that never did anything with active directory 00:44:24.462 --> 00:44:27.832 administration. We need to separate these out. We need to 00:44:27.832 --> 00:44:31.068 protect them. We need to drop the level of rights down, we 00:44:31.068 --> 00:44:33.938 need to clear out domain admins we need to ensure that service 00:44:33.938 --> 00:44:36.641 account are not members of groups that they don't need to 00:44:36.641 --> 00:44:40.344 be members of. And we need to make sure that domain admins are 00:44:40.344 --> 00:44:42.980 only logging on to domain controllers, special admin 00:44:42.980 --> 00:44:47.118 servers, work stations and also look at that for lower tiers as 00:44:47.118 --> 00:44:53.624 well. Lower tiers being server admins and work station admins. 00:44:53.624 --> 00:44:56.694 Because once an attacker compromises a domain admin 00:44:56.694 --> 00:45:00.164 account it's over, right? We also should be looking at 00:45:00.164 --> 00:45:03.734 temporal group membership. I'm sure that there's some domain 00:45:03.734 --> 00:45:07.705 admins here in this room, in Vegas, partying, you're at DEF 00:45:07.705 --> 00:45:11.609 CON, you're not back working. Your domain admin account is 00:45:11.609 --> 00:45:16.881 still active. We need to look at ways to limit our attack surface 00:45:16.881 --> 00:45:22.386 for these accounts. Network segmentation is part of this. I 00:45:22.386 --> 00:45:28.626 mentioned earlier. In Windows 10 we have some really great 00:45:28.626 --> 00:45:33.431 protection. I went into the Microsoft presentation of Black 00:45:33.431 --> 00:45:36.801 Hat couple days ago, and it sound like there's a bunch of 00:45:36.801 --> 00:45:39.503 requirements which is going to take a couple of years for us to 00:45:39.503 --> 00:45:41.505 get there, but again at least we're moving in the right 00:45:41.505 --> 00:45:43.841 direction. So what is traditionally been the Windows 00:45:43.841 --> 00:45:49.647 OS now moved into the blue box. High level OS. Zits on a 00:45:49.647 --> 00:45:54.118 hypervisor now have a new micro kernel called isolated user 00:45:54.118 --> 00:45:59.890 mode, IUM or whatever Microsoft wants to call it today that's 00:45:59.890 --> 00:46:04.662 that green box, micro kernel, no third party code runs in it and 00:46:04.662 --> 00:46:10.534 the only way that reg can communicate with it is through 00:46:10.534 --> 00:46:15.106 trust. These are small purposes built processes which run within 00:46:15.106 --> 00:46:21.646 the IUM. Or within that scope. The credentials at least what 00:46:21.646 --> 00:46:25.082 we're used to being credentials, those secrets are no longer in 00:46:25.082 --> 00:46:29.186 LSAS. They have been moved over to a new process in the IUM or 00:46:29.186 --> 00:46:35.493 the SM called LSALSO. Because LSAS can request but never the 00:46:35.493 --> 00:46:41.198 secrets are divulged. Be interested to see how this 00:46:41.198 --> 00:46:48.205 develops and works in practice as we start rolling this out 00:46:48.205 --> 00:46:54.812 hopefully two to three, four years. So, as the attackers 00:46:54.812 --> 00:46:57.348 approach has become more sophisticated I'm not going to 00:46:57.348 --> 00:47:03.287 use the advanced word. More sophisticated, we need more 00:47:05.489 --> 00:47:09.660 sophisticated attack detection. Microsoft recognized this and 00:47:09.660 --> 00:47:12.897 they're doing a better job. They ought a product or company 00:47:12.897 --> 00:47:18.469 called Lorado they have taken integrated this company's 00:47:18.469 --> 00:47:22.473 product and technology into a new tool or product called 00:47:22.473 --> 00:47:25.076 Microsoft advanced threat analytics which is coming out 00:47:25.076 --> 00:47:28.779 this month or is out already. I don't work for Microsoft but I 00:47:28.779 --> 00:47:31.248 find this very exciting because finally we're looking at things 00:47:31.248 --> 00:47:34.351 from where we need to look at them. This doesn't look at event 00:47:34.351 --> 00:47:37.054 logs. There's no event log parsing, no agent to be 00:47:37.054 --> 00:47:42.793 installed. This is a straight up tap the network device it 00:47:42.793 --> 00:47:46.230 watches the authentication traffic to and from that DC and 00:47:46.230 --> 00:47:50.634 gains real intelligence where users are logging on and what 00:47:50.634 --> 00:47:56.006 they're doing. That ATA sensor data send over to the ASA center 00:47:56.006 --> 00:47:58.442 and then it's crunched then there's some user behavior 00:47:58.442 --> 00:48:03.247 analysis that's extracted out of this. It says, this user logs on 00:48:03.247 --> 00:48:06.417 to these two computers and these four resources is what they 00:48:06.417 --> 00:48:11.489 access but that's it. If any user steps out of that lane it 00:48:11.489 --> 00:48:15.726 flags that. What's interesting that is user behavior it's got 00:48:15.726 --> 00:48:18.763 deterministic behavior or deterministic detection as well 00:48:18.763 --> 00:48:21.399 on the bottom of the slide you can see the detection 00:48:21.399 --> 00:48:25.636 capability. Lot of the advanced attacks -- sophisticated attacks 00:48:25.636 --> 00:48:29.874 that we're seeing now are the ones that I've listed at the 00:48:29.874 --> 00:48:33.611 bottom which ATA can help us identify. Including recon which 00:48:33.611 --> 00:48:39.283 is not going to show up in your event logs. If you have a big 00:48:39.283 --> 00:48:46.991 enterprise you may actually already own this. Might want to 00:48:46.991 --> 00:48:53.097 look into it. This is what it looks like. Credential theft 00:48:53.097 --> 00:49:00.905 detection. Pass the ticket, over pass the hash. MS1406 exploit 00:49:00.905 --> 00:49:07.878 because it can identify the communication patterns and 00:49:07.878 --> 00:49:15.719 behaviors for that. Golden ticket. Skeleton key. And some 00:49:15.719 --> 00:49:19.423 others. There's couple more mitigating -- again mostly 00:49:19.423 --> 00:49:25.663 common sense but now we need to start looking at if we're in 00:49:25.663 --> 00:49:28.332 breach recovery scenario that we change our computer account 00:49:28.332 --> 00:49:34.638 passwords as well as all the others. We need to change our 00:49:34.638 --> 00:49:41.579 TGT password at least when an directory admin leaves. But the 00:49:41.579 --> 00:49:44.281 fact of the matter is that we need to change them on a fairly 00:49:44.281 --> 00:49:47.484 regular basis, I put twice a year here. Maybe once a year. 00:49:47.484 --> 00:49:51.822 Because if someone pull, is that back up file they have this 00:49:51.822 --> 00:49:59.496 account. In summary, attackers will get code running on your 00:49:59.496 --> 00:50:05.369 system at some point. What they're able to do, how far 00:50:05.369 --> 00:50:09.106 they're able to get, what data they're able to access, what 00:50:09.106 --> 00:50:12.509 level of privilege they're able to attain is entirely based on 00:50:12.509 --> 00:50:16.046 your defensive posture. It's time for us to change our 00:50:16.046 --> 00:50:20.184 defensive posture from the way we've been doing. Thank you very 00:50:20.184 --> 00:50:24.321 much for your time. That has been mine. [ Applause ]