Home » Blog » Beacon Object File ADVENTURES: Some Zerologon, SMBGhost, and Situational Awareness
Beacon Object File ADVENTURES: Some Zerologon, SMBGhost, and Situational Awareness
Thursday 17 September, 2020
Cobalt Strike can use PowerShell, .NET, and Reflective DLLs for its post-exploitation features. This is the weaponization problem set. How to take things, developed outside the tool, and create a path to use them in the tool. One of the newest weaponization options in Cobalt Strike are Beacon Object Files.
A Beacon Object File is a tiny C program that is compiled as an object and parsed, linked, and executed by Cobalt Strike’s Beacon payload. The value of Beacon Object Files is that they’re small, they have less execution baggage than the other methods (e.g., no fork and run), and they’re not that bad to develop either.
In this post, I’d like to share with you a few examples of how to extend Cobalt Strike with Beacon Object Files.
CVE-2020-1472 (aka Zerologon)
Let’s start with CVE-2020-1472, aka the Zerologon exploit. This is an opportunity to remotely attack and gain privileged credential material from an unpatched Windows Domain Controller.
This is a risky attack to carry out. It resets the machine account password for the target domain controller. This will break the domain controller’s functionality. I would limit use of this capability to demonstrations in a snapshotted lab or red vs. blue wargames in a snapshotted lab. I would not use this in production.
Secura, the company that discovered the bug, documents the details of the attack and weaponization chains in their whitepaper. Rich Warren from NCC Group’s Full Spectrum Attack Simulation team published a .NET program that executes this attack too.
BeaconPrintf(CALLBACK_OUTPUT, &quot;Success! Use pth .\\%S 31d6cfe0d16ae931b73c59d7e0c089c0 and run dcscync&quot;, dc_account);<br /><br />
56
}<br /><br />
57
else{<br /><br />
58
BeaconPrintf(CALLBACK_ERROR, &quot;Failed to set machine account pass for%S&quot;, dc_account);<br /><br />
59
}</p><br />
60
<p>return;<br /><br />
61
}<br /><br />
62
}</p><br />
63
<p>BeaconPrintf(CALLBACK_ERROR, &quot;%S is not vulnerable&quot;, dc_fqdn);<br /><br />
64
}<br /><br />
I’ve recorded a demonstration of this attack chain as well:
The above is a good example of a Beacon Object File that implements an of-interest attack. I’ll add that Benjamin Delpy has also added ZeroLogon to mimikatz. I like that he’s extended the options for dcsync to authenticate to a domain controller with the blank credential. This is a cleaner overall attack chain as we run mimikatz once and get the desired outcome. The same “you’ll wreck this DC” caveats apply. That said, the mimikatz implementation is what I’d use going forward.
A new #mimikatzrelease with #zerologon / CVE-2020-1472 detection, exploit, DCSync support and a lots of love inside
It now uses direct RPC call (fast and supports unauthenticated on Windows)
Another cool exploit is CVE-2020-0796, aka the SMBGhost exploit. This is an escalation of privilege opportunity against an unpatched Windows 10 system.
What about weaponizing CVE-2020-0796 as a Beacon Object File? This is also pretty easy to do. I found that this exploit was a very straight-forward move from Metasploit’s Reflective DLL implementation to BOF. I posted the BOF code for SMBGhost to Github with an Aggressor Script too. The README.txt documents some of the steps I took as well.
The second path, implemented as an smbghost alias, exploits the vulnerability, yields the slightly enhanced privileges, and lets you choose what to do with it. This second path is very much Bring Your Own Weaponization, I want to re-emphasize the some privileges limitation. The token manipulation, made possible by this exploit, allows us to get away with opening/interacting with processes in the same session–where we couldn’t before. The second step of injecting into a privileged process (or spawning a process under a privileged process) is required to cleanly take on a fully privileged context to work from.
Closing Thoughts…
I hope you’ve enjoyed this tour of Beacon Object Files. If you have working C code for a post-exploitation concept, Beacon Object Files are a path to turn that C code into something that can work from Cobalt Strike. If you want to see another perspective on this process, watch the Cobalt Strike BOF Making episode of the HackThePlanet twitch stream. I also wanted to highlight that there’s some great Beacon Object File capability available in the open source space too. Enjoy!