1 00:00:00,000 --> 00:00:00,400 Okay. 2 00:00:00,400 --> 00:00:04,720 So Tote is going to be talking about Active Directory and something. 3 00:00:04,720 --> 00:00:05,940 So let's give him a welcome . 4 00:00:10,420 --> 00:00:11,280 Yeah . 5 00:00:11,280 --> 00:00:12,000 Wow. 6 00:00:12,660 --> 00:00:14,100 Hello, everyone. 7 00:00:14,660 --> 00:00:15,620 Welcome. 8 00:00:15,760 --> 00:00:17,460 Thank you so much for joining. 9 00:00:17,460 --> 00:00:21,840 So this is actually my first time talking. 10 00:00:21,840 --> 00:00:26,980 I mean, this is actually my first time actually being in an international conference. 11 00:00:27,740 --> 00:00:31,380 So talking in DEF CON feels like a dream. 12 00:00:31,380 --> 00:00:37,600 So anyway, today I'm going to talk about a vulnerability I found in Active Directory. 13 00:00:37,760 --> 00:00:46,020 And before we actually get to the vulnerability, let me start with some background. 14 00:00:46,020 --> 00:00:52,760 So I found this vulnerability while doing a research about DMSA. 15 00:00:53,300 --> 00:00:57,700 And three years ago I also did a research on GMSA. 16 00:00:58,200 --> 00:01:03,740 Now, there is just one thing that I couldn't figure out about MSA. 17 00:01:03,740 --> 00:01:11,300 Because I can, like, I mean, after I did research on both of them, I can say that I have a grasp of how they work. 18 00:01:11,300 --> 00:01:19,740 But the thing that I just couldn't figure out was why the D in DMSA and the G in GMSA are lower case. 19 00:01:19,800 --> 00:01:24,440 And the at first I thought this is just because I'm not an English speaker. 20 00:01:24,440 --> 00:01:31,460 So when I worked on GMSA, I asked like a ton of people why the G is lower case. 21 00:01:31,700 --> 00:01:44,120 And so I'm telling you this story just so you know that if at some point during the presentation you will ask yourself why it is written that way, I have no clue. 22 00:01:44,620 --> 00:01:48,500 And yeah, so I'm Yuval Gordon. 23 00:01:48,500 --> 00:01:51,120 I'm a security researcher at Akamai Technologies. 24 00:01:51,440 --> 00:01:58,280 And in the past decade or so, I've been working on different roles in cyber security. 25 00:01:58,280 --> 00:02:05,000 But the one domain that I keep coming back to is identity research and active directory. 26 00:02:05,100 --> 00:02:09,200 And so in Akamai, I'm now doing an offensive research. 27 00:02:09,200 --> 00:02:12,040 So that's how I got to this research. 28 00:02:12,380 --> 00:02:16,880 And that's my X handle over somewhere. 29 00:02:16,880 --> 00:02:19,680 So feel free to follow me or reach out to me. 30 00:02:20,900 --> 00:02:24,140 And okay, so let's get started. 31 00:02:24,500 --> 00:02:31,880 So we're going to start by with a quick introduction of service accounts. 32 00:02:32,160 --> 00:02:38,440 So this is just to make sure that everyone has some understanding of what service account is. 33 00:02:38,740 --> 00:02:41,960 And then I'm going to do a deep dive to GMSA. 34 00:02:41,960 --> 00:02:47,540 I'm going to explain exactly how they work and where I found the vulnerability. 35 00:02:48,400 --> 00:02:58,120 And after that, I will be talking about that successor, which is the name of the technique that we use to exploit this vulnerability. 36 00:02:59,300 --> 00:03:07,600 Okay, so in order to explain what a service account is, I'm going to use a story by Elad Shamir. 37 00:03:07,600 --> 00:03:13,140 So Elad Shamir is, I think, the VP research of Specter Ops. 38 00:03:13,140 --> 00:03:16,680 And he has some talks related to Kerberos. 39 00:03:16,680 --> 00:03:23,600 And in his talks, he has this concept to explain about Kerberos and different things in Kerberos. 40 00:03:23,600 --> 00:03:26,120 And I just really love his story. 41 00:03:26,120 --> 00:03:31,300 So I really recommend you guys to watch his talks. 42 00:03:31,300 --> 00:03:36,520 But for now, I will just summarize the relevant parts for us. 43 00:03:37,140 --> 00:03:42,640 So in his story, Elad is talking about this amusement park. 44 00:03:43,360 --> 00:03:47,980 And in this amusement park, there are, you know, visitors. 45 00:03:48,320 --> 00:03:53,160 And when a visitor enters the park, they get a daily ticket. 46 00:03:53,160 --> 00:03:58,180 So the daily ticket, it's like a TGT in Kerberos. 47 00:03:58,920 --> 00:04:02,820 And so in the park, we have a lot of different rides. 48 00:04:02,820 --> 00:04:06,780 So every ride, it's like a different service. 49 00:04:06,800 --> 00:04:10,240 And service, for example, can be a web application. 50 00:04:11,140 --> 00:04:17,620 So when the visitor wants to get on a ride, they need a ticket for that ride. 51 00:04:17,620 --> 00:04:25,120 So actually, the daily ticket that they got is not enough to get on a ride. 52 00:04:25,380 --> 00:04:29,500 Each ride requires a different ticket. 53 00:04:30,000 --> 00:04:40,760 So what the visitor has to do, they go to the ticket office once again, and they now ask for a ticket for the specific ride they want to get on. 54 00:04:41,600 --> 00:04:45,560 And so when they get the ticket, they will go to the ride operator. 55 00:04:47,980 --> 00:04:52,440 And this will be the main focus of our talk today. 56 00:04:52,480 --> 00:04:59,240 So they will go to the ride operator with this ticket, and they will hand it the ticket. 57 00:04:59,240 --> 00:05:02,920 So the ride operator will validate the ticket. 58 00:05:03,220 --> 00:05:08,460 They will, so the ticket has some information about the user. 59 00:05:08,460 --> 00:05:28,960 So it will include the age of the visitor and the height of the visitor and maybe the different membership, like maybe this is a premium user and the ride operator will validate it and decide whether the visitor should be allowed to get on the ride or not. 60 00:05:28,960 --> 00:05:34,780 So maybe it's like a premium ride and the visitor can't actually access it. 61 00:05:34,780 --> 00:05:38,780 So that's the purpose of service account, kind of. 62 00:05:38,780 --> 00:05:43,980 So there are different types of service accounts. 63 00:05:43,980 --> 00:05:51,840 We have the legacy type of service account, the unmanaged type, and we have the managed type. 64 00:05:51,840 --> 00:06:08,040 So actually the legacy service account, they had like a lot, they have a lot of security risks involved with them and the most major one is that they are a target for an attack called Kerberos thing. 65 00:06:08,040 --> 00:06:12,720 So this is a widely used attack, very common today. 66 00:06:12,720 --> 00:06:14,220 Attackers love it. 67 00:06:14,240 --> 00:06:30,520 And in 2008 and 2012, Microsoft introduced MSA and then GMSA and we will refer to both of them as MSA because for the sake of our talk, we don't really care about the differences between them. 68 00:06:30,520 --> 00:06:38,140 So MSA actually solved the security risks that were related to the legacy service account. 69 00:06:38,140 --> 00:06:49,920 But if that's the case, you might think that it's pretty weird that I'm still talking about legacy service accounts more than a decade after MSA were introduced. 70 00:06:49,920 --> 00:06:57,380 So the reason for that is that unfortunately, GMSA just didn't take over. 71 00:06:57,380 --> 00:07:01,340 So let's talk about why that is the case. 72 00:07:01,620 --> 00:07:10,540 So the first and I think most major problem with MSA is that they are just not fully supported. 73 00:07:10,620 --> 00:07:19,680 So for us to configure a service , to configure an MSA for a service, the service has to support MSA. 74 00:07:19,680 --> 00:07:27,680 And if the service doesn't support MSA, well, we can't just do it and then we have to use a legacy service account. 75 00:07:28,400 --> 00:07:43,040 And so the other problem is that even if the service does support MSA, so say we have an existing service that is running with a legacy service account because we have our environment for like decades. 76 00:07:43,040 --> 00:07:44,520 So it makes sense. 77 00:07:44,520 --> 00:07:47,440 We couldn't done anything before. 78 00:07:47,440 --> 00:07:54,120 So now we want to have this service that uses the legacy service account use MSA. 79 00:07:54,120 --> 00:07:56,560 Well, that's a pretty difficult task. 80 00:07:56,560 --> 00:08:00,620 It will require a lot of time and work from the IT team. 81 00:08:00,620 --> 00:08:08,480 And if they will have some mistake, if they will get something wrong, the results can be down time for the service. 82 00:08:08,480 --> 00:08:14,180 And some services are too critical to risk with this kind of risk. 83 00:08:14,180 --> 00:08:16,660 So that's a problem . 84 00:08:16,660 --> 00:08:25,320 But luckily for us, just recently in 2025, Microsoft introduced a new kind of MSA , DMSA. 85 00:08:25,320 --> 00:08:28,820 So DMSA is delegated managed service account. 86 00:08:28,820 --> 00:08:36,900 It's a new type of MSA that has all of the advantages that the previous types of MSA had. 87 00:08:36,900 --> 00:08:40,980 But this time, the IT team can just lay back and relax. 88 00:08:40,980 --> 00:08:53,180 Because there is a really new cool migration process that let IT teams take an existing legacy service account and migrate it into a DMSA. 89 00:08:53,180 --> 00:08:59,000 And every service that uses the legacy service account will now use the DMSA. 90 00:08:59,000 --> 00:09:04,600 And it doesn't matter if the service supports MSA or not, it will work. 91 00:09:04,680 --> 00:09:10,180 And it doesn't require much work from the IT team. 92 00:09:10,180 --> 00:09:12,540 It's pretty straightforward. 93 00:09:12,540 --> 00:09:15,820 So they can't make any mistake there. 94 00:09:15,820 --> 00:09:18,340 So it's pretty amazing process. 95 00:09:19,420 --> 00:09:32,880 And one more thing about DMSA, Microsoft documentation says, I'm not sure if you can read the quote, but DMSA secret can be retrieved or found anywhere other than on the DC. 96 00:09:33,400 --> 00:09:38,120 So when I saw this sentence, it was pretty weird for me. 97 00:09:38,280 --> 00:09:49,400 And we will get to this sentence back later because I think that we can debate on if this statement is actually true or not. 98 00:09:49,400 --> 00:09:51,200 But that's for later. 99 00:09:51,200 --> 00:09:54,080 So let's talk about the migration process. 100 00:09:54,960 --> 00:10:00,740 So we can actually divide the migration process into three phases. 101 00:10:01,060 --> 00:10:04,020 At first we start the migration. 102 00:10:04,020 --> 00:10:06,040 Then we have to wait. 103 00:10:06,040 --> 00:10:08,580 And then we complete the migration. 104 00:10:08,920 --> 00:10:18,100 So before actually talking about each of those phases, let's start with how authentication looks like before we even start the migration. 105 00:10:18,220 --> 00:10:24,380 So we have a server on our left, an SQL server. 106 00:10:24,480 --> 00:10:28,700 And that server is running an SQL service. 107 00:10:28,800 --> 00:10:33,980 And we have configured a legacy service account for that service. 108 00:10:33,980 --> 00:10:37,500 So the name of the legacy service account is SBC SQL. 109 00:10:37,860 --> 00:10:48,600 And when the service will ‑‑ so the service needs to authenticate and for that it will request to authenticate as SBC SQL. 110 00:10:48,640 --> 00:10:52,080 And the DC will respond with a TGT. 111 00:10:52,680 --> 00:10:53,120 Okay. 112 00:10:53,120 --> 00:10:54,560 So that's nice. 113 00:10:54,560 --> 00:10:57,580 So now let's start the migration. 114 00:10:58,180 --> 00:11:03,860 So when we start the migration, what happens is we have now a new DMSA. 115 00:11:03,860 --> 00:11:05,040 I have created a DMSA. 116 00:11:05,040 --> 00:11:07,200 I called it DMSA dollar. 117 00:11:07,260 --> 00:11:09,340 And we started the migration. 118 00:11:09,340 --> 00:11:13,540 So what happens is the two accounts get automatically linked. 119 00:11:13,540 --> 00:11:16,540 So each account is pointing to the other. 120 00:11:16,640 --> 00:11:24,660 And also the legacy service account is granted the right permissions on a certain attribute on the DMSA. 121 00:11:24,780 --> 00:11:28,980 So this attribute is a pretty critical one. 122 00:11:28,980 --> 00:11:32,260 It controls who can authenticate as the DMSA. 123 00:11:32,260 --> 00:11:40,640 And I will explain why the legacy service accounts need these permissions in the next slide. 124 00:11:40,700 --> 00:11:46,960 So, okay, we have started the migration process and now we are entering the waiting phase. 125 00:11:46,960 --> 00:12:01,080 So what happens during this phase, so when the server is authenticating now, when the service will try to authenticate as SBC SQL, it will get a TGT in response once again. 126 00:12:01,420 --> 00:12:06,300 This time, however, the response will include some additional information. 127 00:12:06,300 --> 00:12:15,380 So the additional information will have a message saying that this user will be soon superseded by DMSA dollar. 128 00:12:15,560 --> 00:12:36,180 So when the Kerberos client, which actually handles all of the authentication for the SQL service, so when the Kerberos client will see this message, it will automatically send an LDAP modification request to the DC requesting to allow SQL server, which is the server we are currently running on, 129 00:12:36,180 --> 00:12:39,500 to be able to authenticate as the DMSA. 130 00:12:39,500 --> 00:12:51,760 So we are, so the Kerberos client is doing that to make sure that the server will be able to use the DMSA after the migration will be completed. 131 00:12:51,780 --> 00:12:56,180 And this is why the waiting phase is actually there. 132 00:12:56,180 --> 00:13:13,540 So we want every server that is currently using this service, this service account, sorry, to authenticate with the service account and get the permissions to actually access the DMSA for the moment that we will complete the migration. 133 00:13:13,900 --> 00:13:16,840 So at this point, we need to wait. 134 00:13:16,840 --> 00:13:19,840 So, okay, we are waiting for about a week. 135 00:13:19,840 --> 00:13:22,340 Then we complete the migration. 136 00:13:22,500 --> 00:13:26,740 And when we complete the migration, we have the legacy service account. 137 00:13:26,740 --> 00:13:29,560 And it gets automatically disabled. 138 00:13:29,620 --> 00:13:33,660 And some Kerberos configurations are being copied to the DMSA. 139 00:13:34,440 --> 00:13:39,440 Okay, so let's look at what happens during authentication now. 140 00:13:39,700 --> 00:13:45,280 So once again, the service is configured to run with SVC SQL. 141 00:13:45,280 --> 00:13:57,440 So it will try to authenticate as SVC SQL, but this time the DC will respond with an error because, and then the error will have some additional information. 142 00:13:57,440 --> 00:14:06,620 So the error was because the user is disabled, but the additional information will say that this user is superseded by DMSA dollar. 143 00:14:06,900 --> 00:14:14,680 So when the Kerberos client sees this message, it will just try to authenticate automatically as DMSA dollar. 144 00:14:14,680 --> 00:14:24,540 And because we allowed SQLSRV to authenticate as the DMSA, it will work and the DC will reply with a TGT. 145 00:14:24,960 --> 00:14:26,760 So that's great. 146 00:14:26,760 --> 00:14:32,960 And almost everything I just showed is from Microsoft documentation about DMSA. 147 00:14:32,980 --> 00:14:37,840 But there was this one thing that they didn't mention at all. 148 00:14:37,840 --> 00:14:42,000 So it really bothered me because it's a really critical thing. 149 00:14:42,000 --> 00:14:45,300 So this thing is privileges. 150 00:14:45,540 --> 00:14:58,920 So we have a legacy service account and we have a DMSA and I said that there is a really cool new migration process that, you know, migrate the service account to the DMSA. 151 00:14:58,920 --> 00:15:09,240 But I expected the permissions of DMSA to be the same as the legacy service account. 152 00:15:09,240 --> 00:15:13,940 But the process was pretty weird. 153 00:15:14,000 --> 00:15:21,260 So in order to understand what happens, let's talk a bit about Kerberos privileges. 154 00:15:21,440 --> 00:15:34,360 So in Kerberos, in Kerberos TKET, we have a structure that is called the pack and our privileges in the domain are determined by the pack when we authenticate with Kerberos. 155 00:15:34,560 --> 00:15:44,120 So in the pack, we have some information about the user and also a list of every group that the user is a member of. 156 00:15:44,120 --> 00:15:51,520 So we had the legacy service account and they were a member of several groups. 157 00:15:52,340 --> 00:15:57,640 And so that was like their privileges in the domain. 158 00:15:57,640 --> 00:15:59,740 And now I've created a new DMSA. 159 00:15:59,740 --> 00:16:06,720 I completed the migration process and I checked whether the DMSA is a member of the same groups. 160 00:16:06,780 --> 00:16:10,280 And well, the DMSA is not a member of any group. 161 00:16:10,360 --> 00:16:17,100 So by this logic, I can expect the pack of the DMSA to look like this. 162 00:16:17,700 --> 00:16:32,080 But if that's the case, that's a huge problem because it means that those two users don't have the same privileges in the domain and therefore the service wouldn't work as expected. 163 00:16:32,320 --> 00:16:45,200 So I guess Microsoft engineers have watched Dragon Ball, same as me, because they too knew that when a problem is just too big, there is only one solution, which is fusion. 164 00:16:45,760 --> 00:16:50,420 So the pack of the DMSA actually looks like this. 165 00:16:50,420 --> 00:16:58,600 So what this is doing, when we authenticate as a DMSA, it will build a pack for the DMSA just as we can expect. 166 00:16:58,600 --> 00:17:03,460 But then it will also check if the DMSA is linked to another account. 167 00:17:03,840 --> 00:17:25,740 If so, the DC will also generate a pack for the other account and will just merge the two together and that way we will have a pack that has, I mean, that way the DMSA will have the privileges of SVC, SQL and the exact same privileges. 168 00:17:26,080 --> 00:17:45,340 Okay, so when we saw that, we thought that this is like really interesting because I have never heard of any mechanism in Active Directory that just let you copy the privileges of one user, give it to another and without changing any group membership or something like that. 169 00:17:45,340 --> 00:17:51,380 So I thought this was really cool and I wanted to know whether I can abuse it or not. 170 00:17:51,660 --> 00:17:54,540 So, spoiler alert, I did abuse it. 171 00:17:54,540 --> 00:18:03,300 But before actually talking about how I abused it, let's talk about how the migration process, like how we start the migration process. 172 00:18:03,700 --> 00:18:11,760 So, Microsoft documentation says that in order to start a migration process, we need to execute this partial commandlet. 173 00:18:12,220 --> 00:18:23,320 Now, if you will try to execute this partial commandlet as a non-domain admin, well, it will fail because Microsoft probably thought about it. 174 00:18:23,320 --> 00:18:30,460 They don't want regular users to just migrate a legacy service to DMSA. 175 00:18:30,460 --> 00:18:31,540 It's problematic. 176 00:18:31,540 --> 00:18:33,120 Okay, that makes sense. 177 00:18:33,120 --> 00:18:37,520 So, let's understand like why it is failing. 178 00:18:37,520 --> 00:18:40,480 What is happening when we execute this command? 179 00:18:40,560 --> 00:18:47,040 So, apparently this command is just a wrapper for an LDAP operation. 180 00:18:47,460 --> 00:18:53,140 So this is just basically a request that we send to the DC to invoke some functionality. 181 00:18:53,720 --> 00:19:04,460 And, well, if you will try to manually send this LDAP operation, this request to the DC as a non-domain admin, it will fail. 182 00:19:04,700 --> 00:19:07,200 Yeah, sorry, forgot the animation. 183 00:19:07,200 --> 00:19:21,200 So, what happens is that on the DC side, there is a verification and the DC checks if the color of this LDAP operation is a domain admin or not. 184 00:19:21,200 --> 00:19:24,300 And if we're not a domain admin, it will just fail. 185 00:19:24,300 --> 00:19:25,700 So, again, it makes sense. 186 00:19:25,700 --> 00:19:31,380 Microsoft don't want us to just migrate services, service accounts. 187 00:19:31,380 --> 00:19:40,600 So, at this point, let's understand what the DC is doing when this functionality gets invoked. 188 00:19:40,600 --> 00:19:45,780 So, what the DC is doing is actually just changing some attributes. 189 00:19:45,780 --> 00:19:51,620 So, it changes attributes on both the DMSA and the superseded user. 190 00:19:51,700 --> 00:20:18,380 So, at this point, what we want to check if, like, if we have control over the DMSA, maybe even if we don't have domain admin rights, maybe we can just write to the same attributes and, like, you know, mimic the migration process and apparently that just worked. 191 00:20:18,380 --> 00:20:26,120 So, if we change an attribute on the DMSA, that DMSA is now linked to whatever account we want. 192 00:20:26,120 --> 00:20:28,040 There is no protection from that. 193 00:20:28,040 --> 00:20:39,280 So, even if the account is in the protected users group or, like, I don't know, there is the account sensitive and, like, cannot be configured for delegation. 194 00:20:39,280 --> 00:20:41,800 So, that won't work as well. 195 00:20:41,800 --> 00:20:50,440 I mean, I can link the DMSA to any account I want and just copy the privileges of that account to my DMSA. 196 00:20:50,960 --> 00:20:53,560 So, that leads us to bad success. 197 00:20:55,180 --> 00:20:55,920 Okay. 198 00:20:55,920 --> 00:20:58,320 So, let's go over the attack flow. 199 00:20:58,320 --> 00:21:06,820 So, we have an attacker and that attacker has a control over a DMSA and their goal is to achieve domain admin privileges. 200 00:21:07,080 --> 00:21:13,440 So, what the attacker will do is they will just simulate the DMSA migration. 201 00:21:13,700 --> 00:21:27,320 So, they will link the DMSA to another user, a domain admin, and then what they have to do is to authenticate as a DMSA and the DC will just grant them the privileges. 202 00:21:27,420 --> 00:21:29,160 So, okay, that's nice. 203 00:21:29,160 --> 00:21:32,760 The attacker achieved their goals and that's pretty bad. 204 00:21:32,760 --> 00:21:44,420 But, actually, I mean, the starting point, that's not trivial at all because, I mean, first of all, DMSA is a brand new feature. 205 00:21:44,420 --> 00:21:47,980 So, I mean, most organizations don't use it. 206 00:21:47,980 --> 00:21:52,460 So, gaining control over an existing DMSA is a pretty difficult task. 207 00:21:52,460 --> 00:22:01,340 But, also, the DMSA by default are being created in a container called a managed service account container. 208 00:22:01,340 --> 00:22:15,960 So, this container is highly restrictive and if we're not like tier zero accounts, we probably don't have control over this container or any object inside which includes the DMSA. 209 00:22:15,960 --> 00:22:21,360 So, okay, that's not like a really strong attack. 210 00:22:21,360 --> 00:22:32,720 But then we figured that while DMSA by default are being created in the managed account, in the managed service account container, they don't have to be created there. 211 00:22:32,720 --> 00:22:37,340 So, apparently, we can create DMSA in any OU. 212 00:22:37,340 --> 00:22:46,220 So, OU is organizational unit and basically this is like a folder in active directory. 213 00:22:46,220 --> 00:23:07,160 And so, some folders may be considered like as, you know, less important because maybe they don't have any important object inside and maybe there is a team that consistently annoys the IT team in requesting to do stuff in that OU. 214 00:23:07,160 --> 00:23:11,960 So, the IT team will just grant this team permissions over the OU. 215 00:23:11,960 --> 00:23:19,640 I mean, it's their OU so they can just manage it and what's the worst that can happen, right? 216 00:23:19,640 --> 00:23:22,300 So, that's the worst that can happen. 217 00:23:22,300 --> 00:23:34,380 So, now the attacker has control over an OU and they will just create a DMSA there and the rest of the attack flow will be the exact same. 218 00:23:35,180 --> 00:23:38,640 So, now let's see a demo of this attack. 219 00:23:40,040 --> 00:23:40,720 Okay. 220 00:23:40,720 --> 00:23:48,800 So, we are running as a weak user and we will try to add ourselves to the managed meals but we fail because we don't have permissions. 221 00:23:49,080 --> 00:23:58,000 So, now we see that we have privileges to create an object inside of the temp OU and we will create a DMSA in that OU. 222 00:23:58,860 --> 00:24:03,740 And now we will link this DMSA to the administrator account. 223 00:24:04,580 --> 00:24:05,000 Okay. 224 00:24:05,000 --> 00:24:08,980 So, the DMSA is linked and now we need to authenticate as the DMSA. 225 00:24:08,980 --> 00:24:11,040 We will use Rubius for that. 226 00:24:13,000 --> 00:24:16,800 So, now we can see that we are authenticated as the DMSA. 227 00:24:16,800 --> 00:24:18,980 We will try to add ourselves to the managed meals once again. 228 00:24:18,980 --> 00:24:22,860 This time we succeed as we are running with administrator privileges. 229 00:24:33,180 --> 00:24:33,880 Right. 230 00:24:33,880 --> 00:24:37,480 That was a great time for drinking water. 231 00:24:37,560 --> 00:24:37,920 Okay. 232 00:24:37,920 --> 00:24:48,080 So, we have reported this vulnerability to Microsoft and they agreed with us that this is actually a vulnerability. 233 00:24:48,720 --> 00:25:03,760 And so, they said that if we have an attacker and that attacker has a control over an OU and from that they can just gain the privileges of any account in the domain and basically just own the domain. 234 00:25:03,760 --> 00:25:06,860 This is a moderate severity vulnerability. 235 00:25:07,100 --> 00:25:12,660 And because of that, it does not meet the bar for immediate servicing . 236 00:25:13,240 --> 00:25:18,240 But, however, they did say that they will fix it in the future. 237 00:25:18,280 --> 00:25:20,200 So, yeah. 238 00:25:21,020 --> 00:25:24,780 But that's actually not the end of it. 239 00:25:25,580 --> 00:25:31,700 So, when I started with the research, I saw this structure. 240 00:25:31,700 --> 00:25:37,080 So, this structure is a structure that, okay. 241 00:25:37,080 --> 00:25:47,760 So, the TGTs for DMSA includes this structure and this structure holds two very important fields. 242 00:25:47,760 --> 00:25:51,820 It holds the current keys and previous keys of the DMSA. 243 00:25:51,820 --> 00:26:00,260 So, in the current keys and previous keys, there are the Kerberos keys for the DMSA, which are basically credentials. 244 00:26:00,440 --> 00:26:05,140 So, we can think about it as the password hash of the DMSA. 245 00:26:05,300 --> 00:26:14,340 And when I saw it at first, I thought it makes, I mean, I thought this is, I mean, it makes sense. 246 00:26:14,340 --> 00:26:20,260 The machine actually needs the credentials of the DMSA to do different stuff. 247 00:26:20,900 --> 00:26:26,640 And I didn't give it any attention until I saw this response. 248 00:26:26,720 --> 00:26:30,580 So, I hope you guys can actually see it. 249 00:26:30,580 --> 00:26:34,660 But what happens here is we have a decoded response. 250 00:26:34,660 --> 00:26:38,340 So, this is the Kerb DMSA key package structure. 251 00:26:38,340 --> 00:26:42,040 And we have the current keys and previous keys. 252 00:26:42,040 --> 00:26:47,800 So, in the current keys, we have the existing Kerberos keys of the DMSA. 253 00:26:47,800 --> 00:26:53,700 I have just created and simulated the migration linked to the administrator account. 254 00:26:53,760 --> 00:26:57,520 And we also have the previous keys. 255 00:26:57,520 --> 00:27:04,700 So, that's pretty weird because this account is, I have just created it. 256 00:27:04,700 --> 00:27:08,380 It doesn't suppose to have a previous password. 257 00:27:08,380 --> 00:27:13,060 So, that's weird, but I actually didn't notice that. 258 00:27:13,060 --> 00:27:22,380 What I did notice is that the value in the previous keys, and again, maybe you can't actually see it, but that's okay. 259 00:27:22,380 --> 00:27:24,540 It's just an NTLM hash. 260 00:27:24,540 --> 00:27:36,460 And usually I wouldn't recognize a specific NTLM hash, but I did recognize this specific NTLM hash because that's the NTLM hash of that password. 261 00:27:36,460 --> 00:27:39,920 And this is the password that I always use. 262 00:27:40,060 --> 00:27:42,360 I mean, in my lab environment, yeah? 263 00:27:42,360 --> 00:27:52,020 So, when I saw the NTLM hash of that password, I immediately recognized it and I thought it's, it was like really weird. 264 00:27:52,020 --> 00:28:00,580 Why the DMSA that I have just created and DMSA is this, you know, it's so secure and it has like randomly generated password. 265 00:28:00,660 --> 00:28:08,300 So, why does it have a previous password that is AA126, my default password? 266 00:28:08,300 --> 00:28:20,980 So, apparently what happens is when we link a DMSA to another account, we are not only stealing their privileges, we are also getting their credentials as well. 267 00:28:20,980 --> 00:28:24,580 So, that's pretty cool, I think. 268 00:28:24,580 --> 00:28:29,760 And that, of course, was the password that I configured for the administrator account. 269 00:28:29,860 --> 00:28:31,940 As again, I always use it. 270 00:28:31,940 --> 00:28:45,780 So, I created a tweet about it and in this tweet I show a video and I'm running this script and it will just dump the credentials of every user and computer in the domain. 271 00:28:45,880 --> 00:28:53,380 And we also have here the credentials of which is, I think, the most critical account in the domain. 272 00:28:53,380 --> 00:28:56,720 If you have it, you can craft golden tickets. 273 00:28:57,600 --> 00:29:06,180 Yeah, so, I'm showing this because there was this one comment that I think summarized this whole thing perfectly. 274 00:29:06,300 --> 00:29:09,960 So, it seems quite moderate. 275 00:29:10,560 --> 00:29:11,320 Yeah. 276 00:29:12,120 --> 00:29:13,080 Okay. 277 00:29:13,080 --> 00:29:15,120 So, that's about it. 278 00:29:15,120 --> 00:29:16,480 That's the attack. 279 00:29:16,560 --> 00:29:19,560 And now, let's talk about detection. 280 00:29:19,940 --> 00:29:29,520 So, I will talk just about detection and not mitigation at all because we will wait for Microsoft to patch it for the mitigation. 281 00:29:30,680 --> 00:29:32,320 But, yeah. 282 00:29:32,320 --> 00:29:40,620 So, for detection, when we execute the successor, there are a couple of logs that will be logged. 283 00:29:40,720 --> 00:29:47,460 So, we have a log for creation but for this log we have to configure a cycle. 284 00:29:47,460 --> 00:29:49,940 Cycle is system ACL. 285 00:29:49,980 --> 00:29:58,160 So, you need to configure a cycle to actually log every time that a new DMSA will be created. 286 00:29:58,500 --> 00:30:01,340 The next one is DMSA linkage. 287 00:30:01,340 --> 00:30:13,360 So, again, configure a cycle and then every time that the attribute that controls the link will be, every time that it will be modified, the log will be generated. 288 00:30:14,040 --> 00:30:18,680 And the next one, I think it's pretty interesting. 289 00:30:19,020 --> 00:30:23,440 So, this is actually a log for DMSA. 290 00:30:23,760 --> 00:30:33,840 And so, this log is for when you fetch a password for the DMSA, this log will be logged. 291 00:30:33,840 --> 00:30:48,320 So, and you will have the caller seed and caller IP and they will hold the seed that actually fetched the password and IP that the request was originating from. 292 00:30:48,320 --> 00:31:12,880 But when I authenticated as a DMSA, this log and this exact log has been generated and the weird thing about it is that in the caller seed, instead of like, I'm not sure what because I'm just authenticated as a DMSA, but the caller seed that we can see here is the seed of anonymous log on. 293 00:31:13,880 --> 00:31:25,620 So, that's pretty weird and I think that it might be, like, it might be worth to take another look at it, but I haven't got the chance to do it yet. 294 00:31:25,620 --> 00:31:26,820 So, maybe later. 295 00:31:26,820 --> 00:31:31,120 But it will also include a blank in the caller IP. 296 00:31:31,280 --> 00:31:34,040 So, that's pretty interesting, I think. 297 00:31:34,360 --> 00:31:43,260 And anyway, I, MSRC were great to work with. 298 00:31:43,280 --> 00:31:50,520 I mean, we did disagree on the vulnerability severity, but other than that, they were great. 299 00:31:50,520 --> 00:31:54,180 So, I sent them the presentation before this talk. 300 00:31:54,180 --> 00:32:02,540 I asked if they want to include any official statement and so they said that this is their official statement. 301 00:32:02,540 --> 00:32:07,000 We are aware of this report and we'll be addressing it in an upcoming update. 302 00:32:07,000 --> 00:32:08,600 So, stay tuned. 303 00:32:10,680 --> 00:32:13,660 So, let's talk about conclusions. 304 00:32:14,340 --> 00:32:20,960 So, first of all, DMSA is like a new security feature. 305 00:32:20,960 --> 00:32:23,680 It was designed with security in mind. 306 00:32:23,680 --> 00:32:26,120 It actually solves a lot of problems. 307 00:32:26,440 --> 00:32:36,860 And it doesn't mean that the feature itself is necessarily secured just because they made it with, like, security in mind. 308 00:32:37,400 --> 00:32:55,440 And so, the second point is to never skip the obvious because when I saw the whole pack merging thing and I talked with my manager about it and he said, well, maybe you can just try to change the attribute that control the link. 309 00:32:55,620 --> 00:32:58,740 And I was like, no, that would be, like, way too easy. 310 00:32:59,160 --> 00:33:03,260 But it apparently just worked and it was that easy. 311 00:33:03,520 --> 00:33:04,520 So, yeah. 312 00:33:04,800 --> 00:33:08,980 Next point is to log in the layer on DMSA links and creation. 313 00:33:09,240 --> 00:33:09,880 Yeah. 314 00:33:10,520 --> 00:33:16,960 And the final one is that DMSA is a great new feature. 315 00:33:16,960 --> 00:33:17,500 I really love DMSA. 316 00:33:17,520 --> 00:33:25,420 When Microsoft will patch it, I think it will be really worth for organizations to actually use this feature. 317 00:33:25,760 --> 00:33:27,140 And, yeah. 318 00:33:27,140 --> 00:33:28,520 So, that was it. 319 00:33:28,520 --> 00:33:29,660 And hope you enjoyed. 320 00:33:29,660 --> 00:33:30,700 Thank you so much.