Last Updated: 2019-01-14 16:49:29 UTC
by Rob VandenBrink (Version: 1)
The story is all too familiar, the chain of events almost the same every time:
- A malicious email makes its way in past the SPAM filter.
- The recipient person clicks on a link or downloads an attachment with a macro in it
- Malware executes
- The malware uses Mimikatz (or some variation thereof) to harvest the local administrator password from the machine
- The malware then uses that password for lateral movement to infect other workstations and servers
- then bad things start to happen, and the phone rings!
The Blue Team "fix" for this? Well, there are lots of them (starting with the SPAM filter, user education and blocking macros), but the one I'll discuss today is that local administrator password, the one that's the same on all workstations (and often on all servers as well). Microsoft LAPS (Local Administrator Password Solution) is a nifty, free download that allows you to set the local admin password for each workstation to a random string of configurable length. Not only that, it allows you to schedule resets of those passwords, and it's all configurable through Group Policy:
The passwords are stored in a field in AD, which is part of the schema extension for this product. You can then set rights on that field so that only authorized folks can use those passwords.
LAPS can be downloaded here (note that this link is subject to change over time):
Note to the Blue Team / IT Ops Team- don't include your Domain Controllers in the scope of your LAPS workstations, or you're in for a bad day
Neat eh? If done right, this fixes the lateral movement problem nicely right?
... Time for the Red Team Point of View ....
LAPS works great, except that authorized folks can read those passwords in clear text (because they need to). What this does is focus the efforts of the attackers on the IT Administration team. If you can compromise the right helpdesk password, you'll be able to collect all the workstation local administrator passwords with a simple PowerShell one-liner, then save that off to a spreadsheet as part of your Penetration Test findings (or L00T if the attack is malicious):
To collect one password:
Or, as they say in Pokemon Universe, if you want to collect them all - dump out all hosts in the domain, and collect the hostname, the OS and the local admin passwords:
Your data will look something like:
Note that all stations don't have set - you normally enforce the LAPS GPO by OU in Active Directory. Try to get the coverage you want for this tool by building your OUs and enforcing the GPO appropriately, but again, be sure not to apply this to any domain controllers.
If you're running a penetration test, exporting it to a CSV so you can do some more analysis in Excel is a handy final step (be careful where this data goes though!)
Note to the Blue Team or Ops Team - DON'T RUN THIS LAST COMMAND - EVER. SAVING ALL OF YOUR PASSWORDS IN A SPREADSHEET IS AN EPICALLY BAD IDEA!
The "moral of the story"? A few actually:
- No security measure is 100% effective, and every security measure can be exploited if it's not done right (or even if it is done right).
- Approaches like this work best against malware and other automated / semi-automated attacks. If you have an intelligent adversary, they'll likely get administrative fairly quickly in most domains.
- "Defence in Depth" is a thing people say for a reason, it's the most effective way to protect your assets. If you put all of your eggs in one basket, count on the fact that at some point, you'll drop that basket (or someone will do that for you)
- LAPS is a great tool, but it should be one tool of many that you use to protect your infrastructure.
- Implementing things like this start to focus attackers on your helpdesk and domain admins - be sure that those admin accounts are protected as much as possible - start by making sure that folks can't browse or check email while using an admin account!!
Have I missed anything? Please use our comment form if so!
Last Updated: 2019-01-14 13:41:07 UTC
by Rob VandenBrink (Version: 1)
For folks still running Windows 7, Microsoft has it scheduled for End of Life in exactly 1 year - https://support.microsoft.com/en-ca/help/13853/windows-lifecycle-fact-sheet
Not such a big deal if you have 1 or 2 machines at home to manage, but if you are an enterprise with hundreds or thousands of Windows 7 machines, it's really time to start that migration project. If you're still running Windows XP, you're in even deeper trouble! If you've got business apps keeping you at W7 (or XP for that matter), it's past time to consider an update or migration to better applications!
The difference I'm seeing between companies that run Windows 10 / Office 2016, and companies that run Windows 7 and older versions of office is a significant difference in rates of malware infection. Maybe start your project by updating machines as a standard first response to malware incident response? Or make the decision that it's better for the business to pay for updates, as opposed to paying ransomware (and maybe not even getting what you pay for in that case)?