All right. We're going to start off with Sean. He's got a little special message he's got to do. So here he is, Sean. Morning, DEF CON. How we doing? Love it. So happy to be back at DEF CON. I got a friend here. This is Bunny. My daughter asked me to bring Bunny. So can everyone say hi, Bunny? Hi, Bunny. Awesome. Thank you. All right. So Bunny's going to sit over here and get a front seat. So this is exploiting Active Directory Administrator and Securities. I'm Sean Metcalf. I'm really excited about this slide deck because one of the things that I've talked about before, problems with Active Directory, the way it's configured, the way that people manage it, configurations within it, but rarely have I gotten to talk about the problems with how it's administered and the challenges with the systems that are often connected that are secure. So I'm Sean Metcalf, founder of Trimark. We help companies better secure their Microsoft platform, which is part of the reason why I do all this fun Active Directory security stuff. I'm a Microsoft Certified Master in Active Directory. I'm a Microsoft Certified Master in Active Directory. There's about 100 in the world, most of whom work at Microsoft. I don't. So I can talk about whatever I want. Very happy to be back on stage at DEF CON. I'm a security consultant and researcher and I run ADSecurity.org. Show of hands, have you used ADSecurity.org? Okay, everyone who's not raising your hand, talk to one of the people that raised their hand and ask them what they think about it. So we're going to talk about the evolution of admin discovery. How do we find admins in the environment, the challenges with that, and some of the issues with correctly discovering admins around in Active Directory. How to exploit typical administration, at least how I often see AD administered. Challenges and problems with multi-factor. Password vaults seem to be more popular, so we're going to talk about bypassing and subverting password vaults. And then the vaulted admin forest, aka the red forest. And then I'm going to talk about how you can actually attack read-only domain controllers to compromise AD, which would be fun. So the evolution of admin discovery. We look for domain admins. We love domain admins, right? That's great. So we run a command like this. Get net group member. Thank you, Will Harmjoy, for giving us Power View. So we can do this easily and quickly. And enumerate the members of domain admins. But a lot of times, pen testers and red teamers and security folks forget about administrators. So if we're just looking at domain admins, we're going to miss a ton of Active Directory administrators. How does this look? How does this look? How does this look? How does this look? How does this look? How does this look? How does this look? How does this look? In most environments, we end up with, what, six domain admins? But once we enumerate the administrators group, we might have as many as 20 or more. And so if we don't pay attention to the administrators group, they have full AD admin rights as well as full domain controller admin rights. So it's very important to make sure we're capturing both of those. And if we see something like this, what do you do? There are no domain admins. There doesn't need to be any domain admins in order to correctly manage and administer Active Directory. Domain admins really are not the AD admins. The administrators are. So the other way that we've talked about, or I've talked about discovering admins is by using admin count equals one, right? Right? We look for any account in that domain that has admin count, the attribute set to one. Active Directory is a process that goes through and enumerates the most privileged accounts, groups in the domain, and then flags them, puts some security, additional security permissions on them, and flags it with admin count equals one. The issue here is that if you're just looking for this, that's only in that single domain. So in a multi-domain forest, you're going to miss all of the others. In multi-forest environments, you're going to miss the others as well. And if we have a tool that isn't multi-domain or multi-forest capable, which by the way, this is Microsoft's PowerShell commandlet, it is not correctly multi-forest capable because when I add a group from another forest into the administrator's group in this domain, it breaks. At least in half of the environments I've seen. And when I run it against the administrator's group recursive, it doesn't give me everything. So definitely use the tool. Will's PowerView works really well for correctly enumerating the membership, but test your tool in a lab, test it to make sure that you're getting what you're supposed to be seeing. Otherwise, you might miss something. So there's also what I call hidden admins. Many people forget about group policy. The default domain controller's group policy, or policy, GPO, contains something called USP. User Rights Assignments. These are the user rights assignments that you would find on workstations and servers, who can log on locally, who can do certain things on the system, but the ones that are configured for domain controllers actually has domain rights also. Very privileged rights. And this is often missed. This is what I call hidden gold. If you're a pen tester or a red teamer, which is my target audience today, and you're not looking at group policy settings that are applied to domain controllers, please start doing that. Because user rights assignments is going to help you find an even easier way in, and be able to get you to meet your objective more quickly, a lot of times. Why is this? Well, it looks like this. I know you can't read that. It's okay. But this is the display. This is what you look at. So let's dig into a couple of these. Allow log on locally. It is what you think it is. This gives you the ability to log on locally. But when you apply this setting to a domain controller, guess what? You can log on locally to that domain controller. So if you can walk up to that domain controller and physically get on that keyboard, you can log on to that domain controller like it was a workstation. And you might have noticed something weird on this slide. That is not a typo. I have actually found this in customer sites. So anybody can log on to a domain controller. I don't know. Just in case the admin left early that Friday and they needed to reboot it or something. Who knows? But the thing about log on locally, it's not always local. There are remote ways to do local. Right? When we have a VM, we can use the remote console to connect to the VM's console and log on locally over the network. There is also this little thing called ILO, which has been around for many years. Physical servers, physical domain controllers have ILO. It gives you the ability to out of band, off another network, connect into that server as if you could RDP into it or connect to it and get that console access. And the recommendation is to often have that ILO connection be on a separate network, an out of band network, a back end network, and not just a remote network. backup network, not on the production network. But guess what everyone does? They put it on the production network. Guess what can happen? HP ILO vulnerability from last year, about a year ago. Some very clever researchers fuzzed, reverse engineered the ILO configuration and what you can do with it. And they discovered that, you want to see the POC? Yeah? Okay. Here it is. You run curl. You send 29 A's. And you completely bypass authentication. So this vulnerability is brought to you by the letter A. So this is not mine. They did a great job on it. I was chatting with one of the members of the team over at Mandalay a couple days ago. And he was talking about some really cool stuff that they figured off of this. Because ILO is connected into the hardware. So not only can you bypass the ILO auth and just get what you need, but you can also local console access over ILO. But there's some other interesting things they'll be talking about. So he told me a little bit about it, but I'll let him talk about that later. So that's one way you can do it. So you definitely want to check this out, especially when you have physical DCs. By the way, the physical DCs usually don't have VM in the name. Just a hint. But there is a way through the Microsoft settings and user rights assignments to have the ability to log on over RDP to a domain controller. If there's allow log on locally, and the ability to log on to terminal services well guess what server tier 3 can do this only domain admins only administrators should ever be able to log on to the domain controllers via RDP but a lot of times we find this when we do assessments for customers and who's a member of server tier 3 well it's Eddie and that's just a regular user account so whoever can control Eddie's account or manage Eddie's account or compromise Eddie I don't know then they can get on to the domain controller if you can log on interactively on a domain controller you can do a lot of fun stuff from there the other interesting thing is manage auditing and security log so when you're doing an assessment for a customer you're on an engagement definitely check this out you'll typically see exchange that's configured this way but this gives you the rights to actually clear the event log now not advocating depending on your scope to clear event logs on DCs but certainly bring it up to your customer and say hey by the way this group lab admins can clear your event logs on your DCs you probably don't want that and we compromised one of the members of this group and we could have cleared the event logs on all your domain controllers as we were doing our engagement so you want to take care of this trusted for delegation this is a really interesting thing Will Harmjoy did a great blog article about this I've talked about the dangers of unconstrained Kerberos delegation Kerberos delegation is impersonation so when you configure a computer or an account with the ability to delegate to impersonate a user that means they can impersonate that user for Kerberos services on the network this right that's configured in user rights assignments for domain controllers enables these accounts actually set up and configure and can set the delegation Kerberos delegation on those accounts and those computer accounts now they do need one extra right for it to actually follow up and finish but most of the time these groups will have those rights they'll have full control over this those accounts because they have controls on those OHU's so it's dangerous and a lot of times if you if you enumerate the Kerberos delegation in the environment to see what accounts have Kerberos delegation configured if there's more than like 30 or 40 you definitely want to check this out because there's probably a big group that has this ability that aren't... that aren't the administrators and then as we have environments that are getting better some of you have probably seen some environments that have gotten better we've got codes that there are really hope stronger. They set up better restrictions. They have more controls over their admin environment. Things that have been around forever that people have forgotten about are logon hours. So you can restrict when someone can log on to Active Directory and what they can do in that time frame. You can also configure what workstations or computers are actually allowed to log on interactively to. So most of the tools that I've looked at that are used in pen tests and red teams don't look for this. So if you find an account, you're like, I popped this account, but I can't do anything with it. Why? Check this out. You want to check these two attributes, logon hours and logon restrict workstation. The other thing you want to check is a lot of times you'll have deceptive accounts or honeypot accounts in the environment that will look like they're great. They're honey tokens in the environment. They're a member of the right groups. You can't do anything with them. Check these attributes. It's probably why they're locked down, why you can't do anything with them. So when we talk about administration, where it's been, where it's going, who here remembers VNC? Just applause. Yeah, right? Some environments still have VNC, right? And VNC by default is not secured, so that's probably a bad idea. We moved on to RDP. We had run as. People would use MMC on their computer in order to perform administration. So we moved forward from that. But in the beginning, there were admins everywhere, user accounts for domain admins. Every local administrator account was the same, probably. Same now in some places. Please change that. But some environments have as many domain admins as users, which is bad. So, like, as many admins as ostriches in this picture. I like ostriches. And so this was target-rich. There were a lot of opportunities. Any account you found had some sort of admin rights, which is probably not too much different in some of the environments you walk into. And the methods that were used then were bad. Log on to a workstation as an admin, credentials in LSAS. Run as, credentials in LSAS. Even the RDP. So this is the thing that people forget. They stop doing the things on their local workstation. They then RDP into a server, like an admin server, and then don't track how that admin server is protected, how it's controlled. So Mimikatz, obviously. Newer admin security methods. So no more run as, no more MMC on the local system. Should be great, right? We're going to use RDP. We're going to connect to another system. I'm not going to log in with my admin credentials on this workstation because someone could use Bloodhound and know that I'm on this system, and they could potentially get access to that and then compromise my account. So I'm going to use RDP. And maybe I'll use MFA. Maybe I'll use something like Duo. I pick on Duo. They were in the news for something. I don't remember, but I pick on Duo. Duo's good. But there's some interesting things that happen when you use a regular workstation to administration. And as a pen tester, red teamer, you want to be aware of some of those interesting things that happen. Some people are using password vaults. We're going to talk about those. So we have the typical administrator. Logs on to their workstation as a regular user. Then they open up the RDP window, and they connect to their server, their domain controller, and they connect as a domain admin. But something interesting happens in the background when this occurs. There's a new file that shows up on the C drive, a temp file. That's kind of weird. Okay, but Windows drops temp files everywhere because it's a crazy OS like that, so who cares? Well, the problem is that in this situation, there's actually a WMI implant that's been dropped on the system. So there's a WMI implant that is looking for the process MSTSC.NET. And when that executes, it's going to run this script that I'm very helpfully named SCCM health check, which is probably benign. It's for the good of the system. Let's make the Windows great again. Yes. And so what actually happens is this is that SCCM health check PowerShell script, and it actually has a function called get keystrokes. Well, that's a little weird. What is that? So let's look at that file. Well, we open up that file. It's a text file, and it's a key logger. So as soon as someone opens up that RDP window, it's key logging whatever is typed in on that keyboard and logging it to a file, and it keeps doing that for a preset amount of time, 20 minutes, 30 minutes, whatever we set. And then we can use PowerShell to go through and parse that and actually extract the information that would be useful for us. So while the admin thinks they're secure because they're not using their admin credentials on that workstation, they're typing them in on the keyboard. Now, I will just give you a slip sheet download for you. So we use MFA, right? That will solve the problem. We're going to MFA the RDP so we've got our RDP MFA'd. Problem solved, right? Okay. So let's look at that. We use RDP. We MFA it. We click on the button, send me a push. I get the little popup on my phone. I go, Yeah, that looks fine. Approve. But a second later, I get a second one. I just approved the first one. I'll approve this one. It's probably a hiccup. Right? Sure it's okay. Do I tell anyone about it? Do I deny the first one? Do I approve? What's the situation? How do I make that decision? Or with ADFS, same thing. I get two of these. Or maybe I'm the admin. I log in in the morning, and I log into three different systems, and I get these prompts in a row. And I don't keep track. I'm like, yeah, yeah, yeah, yeah, I've got to get my coffee. What happens when I get this pop-up on my phone which says log on request, and there's none of that additional detail, like the IP address, the location, the time, the date? Here it just says log on request. Okay, yeah, approve. Oh, wait, approve. Oh, wait, approve. Uh-oh. I'm pretty sure I only logged in twice. I'm sure it was just like the phone. It's been acting up recently. It's probably okay. So if we can set up a situation where there's a race condition between the admin clicking the push and the attacker clicking the push, we might be able to have a situation where the admin MFAs for us. And we've seen this before with other things, like scams and different situations where they get an email, they get a text message, they're like, oh, by the way, if you see this, just send that code to me. It's okay. Please do that. But there's actually a way that you can subvert MFA in certain environments based on what I've seen. And so it has to do with a certain type of configuration, which is fairly common. This is the self-service portal. This is the configuration where users are able to update their own attributes. And there's very benign attributes like their work phone number, their mobile number. Their org-specific attributes. Maybe sometimes the title, department, whatever. It looks like this. So we have a user, has their mobile number set. That way their boss can call them or they can be called when they're on call. But the problem is that if the attacker knows that they can change this and then they do to their number, 867-530-99, that works well. So they change it to theirs. What they can actually do is instead of clicking the push button within Duo or the MFA product, they can force a text message to be sent to their phone, this number that they just updated. Because in some environments where they have this attribute, the admin user has the attribute, their mobile phone number, associated with their account. And that's associated with their admin account for MFA. So if we can modify that phone number, we can say, give me a text message, and the admin gets nothing. No notification, nothing at all. And we can bypass it. MFA can. There's other MFAs that have this as a backup. Duo has it as a backup method that I've seen in many environments. That was a quick summary for the people who are looking at slides later about how this actually works. There's another interesting thing about Duo, is that Duo fails open. So for Duo to work, it connects to an API, a record, DuoSecurity.com. And that's configured with that company in that instance of Duo within that company. And what happens is when you connect, and you connect to it, and you have that prompt, it's got to check, obviously, to figure out how to push to you, how to know that you can access it, who you are, et cetera. What if we block that? If we block that communication, if we can interfere or influence that connection, guess what happens? No MFA at all. So thanks to Nupi for this, because he did a blog post earlier this month, and Jared Haidt pointed this out to me. There's another thing that's interesting here. If we change this default, so if we have access to the registry, or something, we can actually turn off MFA for local accounts. So if we compromise the local account on the server, we can connect into that using user and password all day long, without any MFA when we're going through the RDP connection. The other interesting thing about MFA is there's an onboarding process. What is this onboarding process? Well, a lot of times, you go to a website, you click on something, you click a request, and you get an email. Hmm, that's interesting. The email comes in. And then they click on the link to approve it, and the MFA gets set up for whatever they put in that form. All right, but if we've compromised that account, that admin account, we have influence over that email, so we can set up a rule to filter it out, or we can just delete it, so they never see it. So we could potentially add additional devices for MFA, or even switch it over entirely. Because what happens when they lose their phone? They're at DEF CON, they're hanging out at a party, and they're like, I don't know where my phone is. They've got to get MFA set up. Again, a lot of times, text SMS is the backup to that. Okay, I have a new phone. I've got to email this person and say, I had to get a temporary phone because I lost mine. Here's the number. Can you just update the MFA? Because, you know, the executive, Mr. Kawasaki, says I need this right now, so I've got to do this. Okay, fine. So there's some recommendations around this. I'll put the slide up. You can look at them later. But, yes, MFA is good. But there are situations and conditions where MFA could be subverted or bypassed, depending on how it's configured. You want to let your customers know about this. You want to let them know, oh, you have MFA? That's great. That's going to make my life a little harder. But let me take a look at what that actually is doing. And we want customers to better try to think through what are the potential bypass methods, because they know it better than we do. We talk to customers all the time. We're like, well, let's talk about your MFA and how that works and the setup, and what if this happens? They're like, oh, yeah, we know that this could be an issue. Okay, well, I'm going to write that in my report. Thank you. Here you go. But what's interesting about this is attackers don't, they don't need to bother with MFA at all, because nowadays MFA is typically something that's added to RDP. So if we can pull and extract that AD admin account name and password, we just can use that to DC sync. We don't have to bother with RDP at all. And that way we can pull any credential we want from Active Directory. So customers are going to think, well, our admins have to use MFA to do things because they RDP in. Make sure they understand. Make sure that the attackers are not bound by the same rules. And there's something about password vaults. So I'm seeing password vaults more and more. I'm probably sure you are as well. It's typically CyberArk or Secret Server, and oftentimes there's a reconciliation account, which is a domain admin account, which is used to ensure that certain accounts that the password vault is managing stay in compliance, have the correct current password. So if someone has changed the password for that account outside of that vault, then it goes through and sets it back to what it should be. But that means that this password vault is running under the context of domain admins or AD administration. So if we can compromise or take over the password vault, we would have access to that account. And password vaults more and more are managing these AD admin accounts and have something called a session manager, which is often used. Password vaults are being pushed more and more into being part of the administrative workflow. So let's look at one of these workflows. Scenario. The admin logs onto the workstation as a user. They connect to the password vault via HTTPS using their web browser. They then check out the password. They copy it out of the web browser into their clipboard. They paste it into RDP, the RDP window, and then connect to their admin server, and they have a great day. I'm sure you see a problem here. There's a password on that workstation in the clipboard. But we can use another power supply function called getClipboardContents. So we can do kind of the same thing as before. Malware has been doing this for years, where they're monitoring the title windows in web browsers. So if they see certain bank names, they see financial, they see password, they see logon, they screenshot, they key log. You can also do keyboard, clipboard scraping, and then from that, they have the information that's going into that web browser. So we can gather that, and the same thing sort of happens. We have a second temp file here that has text file that has passwords. I made up these passwords. These are not from a password vault. Hopefully, a password vault would have a much better randomizer than my Star Wars knowledge. But the issue is that we can also, on top of this, do getTimeScreenshot. Because if we just have the password, we're like, I'm not really sure what that's for or what server they're connecting to, but we can combine these two. We can say, all right, it was this account at this time on this server, and here's the password, and correlate that. So we want to make sure that organizations and companies know that just because you have a password, just because you're using a password vault, they are not secure just because they have dropped it into the environment. Second option, this hardens it up. So we use the password vault as an RDP proxy. So the admin connects to the password vault via HTTPS or some sort of RDP pass-through connection or RDP direct connection, and they use the web browser just like before. And then the password vault then does the RDP connection to the server on the user's behalf. And the user never actually sees it. The user never sees that account or credential, which is interesting because everything's handled by the password vault. But there's a few issues with this approach. First of all, who's logging on to the workstation? It's usually the admin user, so it's a user account. And then what account is used to connect to that password vault? Again, an admin user. Who has the ability to, or I'm sorry, that connectivity and connection and logon, is that using MFA? Sometimes it is. Sometimes it's not. And then of course, who has control of that password vault? Who's the administrators of that password vault system? And then ultimately, can just anybody on the network connect to that password vault over HTTPS or any other connection? What else is running on that system? So I started thinking about this. I'm like, there's a lot of dependencies on this web browser, right? So what if we just compromise the web browser? We don't have to do anything else. What if we installed, I don't know, an extension? And what if we didn't put it in the toolbar? And what if when, all it did was it looked for the connection to the password vault system, and when that happened, it just set up a secondary connection to another system that we own. And that way we could interact with the password vault in a separate hidden web tab. So as the admin's doing what they're doing, we can go through and copy out credentials for admin accounts. But then the other problem is, a lot of times the administrators, other administrators, of the password vault are regular users. I find this too often. It's very simple. You just look for a secret server or CyberArk, and then you look for groups with those names. And you're probably going to find something like CyberArk admins, with a space or without, or some other things that are in there. These are user accounts. We just have to compromise this user, and then I can potentially own the CyberArk system. That sounds bad to me. And sometimes there's password vaults in the internet. Against the recommendations of the vendors, people are putting their password vaults on the internet. So depending on your scoping, you definitely want to do some showdown to see what other things pop up in their range. And sometimes they're using a really old version of that password vault, and it's on the internet. I don't know what credentials they're storing, but they shouldn't be on the internet. So here's a summary of what I've talked about. Again, making sure that what accounts are accessing the password vault, that they're admin accounts, or they're protected with MFA. Making sure that the system is administered correctly. Because as a pen tester or a red teamer, we want to make sure that we're testing out all of these defenses. And password vaults oftentimes are not protected at the same level as, say, a domain controller. I can tell you right now that they're not. Very rarely do I see an organization protecting their password vault and putting a lot of extra time and energy into it. A lot of times they just stand it up. And then the vulnerability or the problem with that could result in complete and total Active Directory compromise. So while I'm talking about vulnerabilities, there happened to be one a few months ago for CyberArk. This was an RCE, so that's, what, about as bad as it can get, right? And this happened to have to do with serialize.net object to the authorization HTTP header. They realized, this pen test team realized, that they could modify the information that was sent to this API that's built in, part of the web server, and connect into it. And what they could do is they could use YSO serial. In order to modify it. And they could run ping on that system. They could do something else on it. It's pretty interesting. So what about the admin forest or the red forest? What do we do with that? This is meant to be the most secure method of administering Active Directory and managing the system. While it's a high security configuration, it's isolated from the production network with firewalls, encrypted communication, has a one-way trust where the production forest trusts this admin forest, and then, ideally, correctly, all of the admin groups in the production forest are emptied, except for the one group that's in this admin forest. Well, as attack emulators, it's easy to discover this. We just need to enumerate the trust, look for an outbound trust for something that looks kind of weird, like .priv. Or, in addition to that, we enumerate the administrator's group, and what we see in this group is a group from this other domain. And if we find that there's no other members of administrators, this is very likely an admin forest, which means that we're probably not going to find anyone that has really good privileges in this environment, in this Active Directory forest, as far as accounts go. But the other thing to look at is, for this account, we notice that it's in foreign security principles. That means that it's in a different forest. So that'll tell you right away that that account or that group or security principle is not something that you can find in that forest. You'd have to try to connect to the other one. If you can't connect to the other one and do any kind of enumeration, it's possible that it's an admin forest. So what do we go after? We look at agents, we look at service counts. One of my favorites in this situation is backups. Everyone overlooks backups. It's the thing that we need, so we're going to make it work. We're going to make sure that it's configured. We're going to make sure it has the rights it needs. Backup operators gives that backup service count everything it needs. So here we have a backup computer account in backup operators, which doesn't make sense to me. It's a backup AD service account, which is pretty interesting. And sometimes these backup accounts are members of the administrator's group for the domain because they do a lot of interesting things like per attribute recovery. And so if we look at this backup server account at the top, this computer account, it's in the server's OU and a sub-OU of that called backup. Very likely in this environment, the first thing I think of is who manages the server OU. And nine times out of ten, it's a group called server admins. Or something along those lines. We can compromise one of those accounts. We can compromise this computer and this server's account, which will enable us to jump up and potentially compromise the domain without ever touching the admin forest. So if you run into an environment where you see it's locked down like this, don't worry about it. Just kind of ignore it for now. Focus on the production AD forest because nine times out of ten, they have not fixed the issues that were inherent in that production AD forest. Someone sold the CIO a lot of the times. Here's an admin forest. We need this. Now there are some environments where an admin forest makes sense. But that's outside the scope of this talk. Did you know? This is interesting to me. The Splunk Universal Forwarder is often installed on the domain controller. It's effectively a mini version of Splunk and can run scripts. It's pretty fascinating. So I was trying to look up some more information about this and I found that there was this talk at a Splunk conference a couple of years ago where someone's talking about how this is working. Well, you could leverage the deployment server, leverage Splunk to potentially run scripts, run arbitrary commands. So that means if Splunk is in the environment and it's installed on the domain controllers, depending on the configuration, if we can compromise a Splunk account or an admin account, we can potentially jump to our domain controllers. Pretty interesting. So again, this is a summary of the things that I just talked about. But the key here is identifying the systems and agents that connect to the domain controllers. What agents, what services, what service accounts have ability to install and run code on domain controllers? And that answer isn't always obvious. But we can do a lot of that discovery from Active Directory because most of this is in the directory. And the problem stems from cross-forest administration. A lot of organizations have multiple forests. Well, not a ton, but a bunch of them do. And so they have their production forest, Forest A, and they have their production forest, Forest B, because I'm really creative in my naming. And there's a trust from Forest B to Forest A. This untrusted lower level of trust, Forest, Forest B, trusts all of the accounts in Forest A to connect to it, connect to resources. So what is how this is set up? So the users in Forest A connect in. That means that we can have a domain admin in Forest A actually administer and control and manage Forest B. The problem here is that Forest B is an untrusted environment. Oftentimes it's in a DMZ. It's a dev test environment. It's for some external configuration, some external system. But since the domain admin account in Forest A is connecting in via RDP to that Forest B environment, the credentials are there. So if Forest B gets compromised, or if you have that in scope and you can go after that forest to jump back to A, you can compromise Forest B to compromise the domain admin account to compromise the forest. The problem is a lot of organizations are going by Microsoft guidance. Microsoft guidance from 10 years ago says this is okay. They don't realize, and they haven't updated the documentation a lot of times, to our new world of how Mimikatz works, how credentials are stored and managed in most organizations, and that the compromise of this could lead to the other. So the recommendations you can give your customers is to please just use an external forest account to manage that forest, or use an unprivileged account in our production forest to then manage that other forest. This is not necessary. So let's talk about read-only domain controllers. Read-only domain controllers are very interesting. You probably won't see them in a lot of environments. Some of the larger ones you will. There's a very specific circumstance where a read-only will actually be deployed. Oftentimes at a branch office where it can't be trusted. Maybe it's just put next to the reception desk or in a closet. They can't trust that it's going to be well protected. Some environments put them in DMZs, but the RDCs connect back into production. That's not a good idea either. So discovering read-only domain controllers is not that complicated. We look for is read-only is true, or there's another option to do it. This one's a little easier. We can just look for the primary group ID 521, or enumerate the membership of read-only domain controllers. And that will give us a list of our read-only domain controllers. So what's interesting about read-onlys is that oftentimes I find these three things set up. Maybe not all the time, but I'd say half the time I find a configuration like this in an environment. They cache more passwords that are actually required. They're typically administered by RDC admins, which may include user accounts. And the passwords for the DSRM account, which is the built-in administrator account for that single domain controller, is often the same across all the DCs and the read-only domain controllers. And that's text for later. So there's four key attributes on read-only domain controllers that we want to enumerate. One is the reveal-on-demand group, which tells the RDC and the domain controllers what can actually be replicated, what accounts' security principles can have their password data replicated to that RDC. And then never reveal means that these can never be replicated. The reveal list is a list of the accounts that have ever had their passwords copied to that read-only domain controller. Read-only domain controller is a domain controller. It has an ntds.dit, just like the writables. And you can extract the information from it, just like a writable. The authenticated to is a little interesting because this tells you the accounts that have ever authenticated to the read-only. And if the read-only doesn't have the password data for that user, it's going to chain up that authentication request to a nearby writable. But you still know which accounts are actually connecting to it. And then based on password replication policy, those are the ones that are allowed on there, are allowed to have their passwords there or not. So this allowed RDC password policy is defined at the domain level. A lot of times that's how it's configured. Domain level, all of these groups for all read-only domain controllers. The denied RDC password replication group is very often default. And then it's interesting because you can delegate rights to the read-onlys on regular server effectively. So Microsoft's recommendation of mine is not to use domain admins to manage read-onlys. But they're full administrators on the RDC. This is easy, they can do it during install. Or interestingly enough, we can use the manage by app attribute to update who has admin rights to this server. And so we can enumerate that. Manage by, once we get that information about who the admins are, we can then enumerate the membership and we see there's Ray and Poe here. It's interesting because these have admin in the name but these are in the regular accounts OU. So we can compromise one of these accounts. Once we do, we're an admin on the read-only domain controller. So then we start poking around and figuring out what we can find in this environment. And we can use the GUI to see what the password caching is. But we can get all this information from the attribute itself or the attributes on the read-only. But there's an interesting part of the GUI here. And this is something that I haven't seen anyone write about before. If you have admin rights in the directory environment, you can interact with and control read-only capability. And one of the things that read-onlys can do that most people aren't aware of is that you can pre-populate passwords on a read-only. So let's think of this from a persistence perspective. Let's say we have 80 admin rights for like five minutes. What we can do is we can remove the CurbTT account from the denied replicate. We can remove the administrators group from the denied replicate. And then we can click pre-populate. And we can pre-populate and say, these accounts I want you to put on this RDC like now. Potentially, we can replicate the CurbTT account password hash to our read-only that we control. And if we can stay on the read-only, even if they take care of everything else we have, no one's going to notice this. So how do we figure out what password hashes are on the read-only? Well, there's an attribute called msdsRevealedUsers. And it looks like this, which looks very difficult to read. So let's make it simpler. Basically, here's Han Solo. He's logged in a bunch of times. Every time he logs in, the read-only domain controller tries to authenticate him with the password that it has. And if it can, then it's good. If it's not certain what's going on, it will track each instance of that authentication. So we can see that there is a password hash version. And so the read-only will update the password that it has every time that user logs on, if it needs to, to make sure it has the current password for that user. So we can use PowerShell and break this down and identify all of the unique accounts that are on this read-only domain controller. And one of them is pretty interesting, because it's account provisioning. Well, that sounds like an account that could have some rights. So let's take a look at that. So we look at it. Let's look at it a little bit more closely. And it has an SVC name to it. So we're going to use a PowerView function called InvokeACLScanner to look for anything in this domain that has permissions for this account, this SVC account, to see what it can do. And the first thing we find is that it has generic all rights to this group's OU. Well, generic all in Active Directory lingo just means full control. Okay, so we have a password hash for the server's account that is full control on the group's OU. Okay, well, what's in that group's OU? It's the ROTC admins, which, okay, I don't really care about that, but there's a server admins group at the bottom here. Server admins probably has rights to a bunch of things, like maybe the password vault. So we dig into server admins, and we find that there's a group policy that's actually adding this server admins group to the local administrator's group on all of the computers in this OU. So at this point, just because we compromised one user that had ROTC admin rights, we were able to compromise all of the servers that are in the server OU. Well, what else can we get? What else can we find off an ROTC, depending on the configuration? And if you're thinking, well, ROTCs, they don't cache passwords by default. You're right, they don't. But pretty much 99% of the time, in order to effectively use ROTCs, you have to turn on password caching, because it cannot authenticate users without their password data, and computer accounts as well. So in order for an ROTC to authenticate a user, they need that user's password hash and the computer password hash that the user has authenticated from. So ROTCs can be a goldmine, because organizations ignore them a lot of the time. So let's look at this again. What else can we find in here? That's really interesting. There's a computer account that says admin in the name. Let's look at that. Let's look at that. What is that? Well, we do some discovery, do some more digging in, and we discover that this admin server, or admin in the name, is the admin server. All of the admins use this server. Somehow, this computer account password for the admin server ended up on this read-only. And so we just go ahead and dump the password hash for this account, this computer account, and then we can create a silver ticket. Create a couple of silver tickets, and then we can do PowerShell remoting once we have those Kerberos tickets on our system, just because we were able to compromise that ROTC and get that password hash. So once we get onto that, we can implant whatever we want. We can start dumping credentials from LSAS, because all of our admins are going to be logging on to that admin server. And then there's one other thing that's pretty interesting. I mentioned the DSRM account, and I talked about this before. The DSRM account is that built-in default admin account on domain controllers. When a domain admin is standing up a new domain controller, they type in the credential or a password for this DSRM account. And this account is a break glass account in case you need to get on the domain controller. Typically, you need to restart the domain controller into DSRM mode, Directory Services Restore mode, in order to use this account and do anything with it. But there's a registry key as of 2008 where you can log in with this, not by default, but you can configure this registry key as of 2008, where you can log on to the domain controller without restarting it into the special mode. You can log on from the console. Depending on the registry key, if it's set to 1, you can log on when the Active Directory services are stopped. If it's set to 2, you can log on anytime you want. If it's set to 2, you can actually pass the hash using this password hash on the network. And there are environments that have that configured. So, it is entirely possible that you could compromise the environment from just taking over a single RODC. So, some key recommendations here for you to give to your customers and for red teamers and pen testers. Make sure that you're actively looking for all the AD admins you can find. See what you can discover. Correlate these user to admin accounts because if you're using net session enumeration or group membership to see where users are or what computer they're logged on to, you might not be seeing the full picture. And there's a lot more that could be there. Look at MFA. Look at password vaults. See how they're configured. Poke the edges around them. And then look at the RDCs if there's any in the environment because they're rarely configured in a very secure manner. That's been my time. Thank you so much for yours. I think I have some time for questions.