Cobalt Strike

Overview

  • Malleable C2 Profiles

  • Reflective Shellcode Loaders

  • Domain Enumeration

  • Local Privilege Escalation

  • Lateral Movement

  • Domain Privilege Escalation

  • Defense Evasion

  • Exploitation

  • Exfiltration - Password Attacks

  • Exfiltration - Email

  • Persistence

  • Cobalt Strike BOFs

  • References


Important OPSEC notes...

For an actual red team, do NOT use execute-assembly at all, ever! Instead, sub the command for BOF.NET bofnet_executeassembly or another .NET assembly loader BOF (i.e. InlineExecute-Assembly). For everything else, use BOFs instead of run or shell commands for best OPSEC. (BOF cheat sheet here).


Malleable C2 Profiles

A collection of tools used to generate new malleable C2 profiles to use with Cobalt Strike and better obfuscate your traffic/commands.


Reflective Shellcode Loaders

Shellcode loaders to add in Cobalt Strike before generating your shellcode which are used to reflectively generate shellcode for added obfuscation, encryption, and ultimately better evasion.


Domain Enumeration

Running PowerView and SharpView

Running Sharphound (.NET version of Bloodhound) for AD domain collection

AD Recon tool - Perform different collection methods (ACLs, OUs, DCs, etc.) and output to Excel files

Get domain trusts and domain controllers with built-in nltest.exe utility

Domain SMB Share Enumeration

PowerView

SharpShares - List accessible shares on remote systems and check read/write privileges

Snaffler - Automated network share enumeration to look for interesting files/creds

Miscellaneous Remote Workstation/Server stuff

List and kill processes on remote system (requires local Admin)

  • Using tasklist.exe and taskkill.exe


Local Privilege Escalation

PowerUp - PowerSploit module

SharpUp - .NET port of PowerUp

WinPEAS - Windows Privilege Escalation Awesome Script

execute-assembly winpeas.exe #run all checks

SeatBelt - .NET tool by GhostPack

GREAT tool to query a local system to gather system/user/remote/misc data Can be used as Admin or normal-privileged user

Watson - .NET version of Sherlock.ps1 to look for missing KBs on Windows

PrintNightmare priv esc exploit (CVE-2021-3452)

HiveNightmare priv esc SAM dump (CVE-2021–36934)

Exploit in Windows 10 and 11 which allows you to read the SAM, SYSTEM and SECURITY hives as a low-privileged user

Stealing logon tokens

If you obtained local Administrator privileges, you can steal a session token of another process to inherit their token privileges. This might require you to escalate to a SYSTEM Beacon if its being blocked. steal_token <PID>

Elevating to SYSTEM Beacon

Assuming you gained local administrator privileges, one option to elevate to a SYSTEM Beacon is to use scheduled tasks to create a new scheduled task to run your payload as SYSTEM.


Lateral Movement

Cobalt Strike jumping (OUTDATED)

Cobalt Strike remote-exec - Executes commands on a target system using psexec, winrm or wmi (OUTDATED)

Enable Powershell Remoting manually

RACE.ps1: ACL attacks for lateral movement, persistence and privilege escalation Stealthier than above method since it doesn't touch disk

Scheduled task lateral movement

Invoke-TheHash - PS tools to perform SMB and WMI pass-the-hash attacks

Over-pass-the-hash with Rubeus Inject a ticket into memory using known credentials and then move to a system that user has access to

Move Kit Aggressor script using execute-assembly, SharpMove and SharpRPD assemblies for doing lateral movement with various techniques

SharpExec - CSharp tooling lateral movement


Domain Privilege Escalation

GPP Passwords

Get-GPPPassword.ps1 PowerSploit module

Net-GPPPassword .NET port of get-gpppassword

Get-GPPAutologon.ps1 PowerSploit module

LAPS Passwords

SharpLaps - Retrive LAPS password from AD The attribute ms-mcs-AdmPwd stores the clear-text LAPS password which is targeted here from LDAP execute-assembly SharpLAPS.exe /user:DOMAIN\USER /pass:PASSWORD /host:IPADDRESS

Password spraying

DomainPasswordSpray.ps1

Rubeus brute-force password spraying a single password or using a password file

SharpSpray - .NET port of PowerSpray.ps1

Kerberoasting

PowerView kerberoasting (Outdated and still reliant on PowerShell)

Rubeus kerberoasting

AS-REP Roasting

Target users in AD that do not require pre-authentication

Coercion attacks

PetitPotam - NTLM relay to AD CS

PoC tool to coerce Windows hosts to authenticate to other machines via MS-EFSRPC EfsRpcOpenFileRaw or other functions

  • Requires AD CS web server enrollment enabled

  • Requries Kali running Impacket on target domain

References:


Defense Evasion

Shellcode injection techniques

Several methods here within Cobalt Strike or using BOFs

AMSI patch

BOF-patchit for current process patchit amsi

boku7/InjectAmsiBypass BOF Patch AMSI in remote process inject-amsiBypass <PID>

ETW patch

BOF-patchit for current process patchit etw

ajpc500/BOFs ETW patch for current process etw stop / etw start

API Unhooking

Cobalt Strike's hail-mary unhooking function. "This is a Beacon Object File to refresh DLLs and remove their hooks. The code is from Cylance's Universal Unhooking research" unbook


Exploitation

DPAPI decryption and extraction on Windows systems

SharpDPAPI

SharpChrome to extract and decrypt a user's Chrome sessions/passwords

SharpWeb - Retrieve saved credentials in Chrome, Firefox and Edge

Active Directory Certificate Services (AD CS) Attack

Certify - GhostPack Enumerate and abuse misconfigurations in AD CS

Certipy - Python Use Python through a SOCKS proxy or a Linux VM on the domain to find and exploit misconfigured AD CS certs

MalSCCM - Exploiting SCCM servers to deploy malicious applications

  • Requires admin privileges on target SCCM server


Exfiltration - Password Attacks

Dumping LSASS locally (all commands below require local Admin)

Mimikatz built-in to dump passwords/hashes to console

Dumping LSASS with ProcDump.exe (requires touching disk) (NOTE: Might get flagged by AV and raise alerts but can still output LSASS dump file)

Dumping LSASS with Out-Minidump.ps1 from PowerSploit without touching disk

Extract LSASS process with SafetyKatz

LSASS dump BOFs

Extracting passwords/hashes offline from LSASS dump using Mimikatz (ON YOUR OWN SYSTEM!)

SAM database dump

SAM dump built into CS - Injects into LSASS to dump local SAM database hashes to console

SAM dump using reg.exe

SharpSecDump SAM and LSA extraction

Remotely dump SAM and LSA secrets (same functionality as Impacket's secretsdump.py)

NTDS.dit dump (all commands below require Domain Admin privileges!)

Invoke-DCSync.ps1 to perform DCSync attacks remotely

Copy-VSS.ps1 from Nishang toolkit to dump NTDS.dit locally on the DC

NTDSutil.exe to dump NTDS.dit locally on a Domain Controller

Credential Prompt

CredPrompt to ask the current user for their username/password.


Exfiltration - Email

PowreShell tool to search mailboxes in a Microsoft Exchange environment


Persistence

SharpStay - .NET Persistence

SharpPersist

StayKit - Cobalt Strike persistence kit aggressor script


Cobalt Strike BOFs

My BOF Collection GitHub page

A .NET runtime tool to load assemblies in memory and avoid the typical fork-and-run model from execute-assembly. Use BOF.NET to run any .NET tool for better evasion by residing in your current process. Note that this will not bypass AMSI or ETW as those will have to be unhooked separately, if needed.


References

Cobalt Strike commands cheat sheet

AD exploitation cheat sheet

Sharphound

PowerShell remoting cheat sheet

Mimikatz reference cheat sheet

SpectreOps Cobalt Strike command reference

Last updated