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.NETarrow-up-right bofnet_executeassembly or another .NET assembly loader BOF (i.e. InlineExecute-Assemblyarrow-up-right). For everything else, use BOFs instead of run or shell commands for best OPSEC. (BOF cheat sheet herearrow-up-right).


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 toolarrow-up-right - 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

PowerViewarrow-up-right

SharpSharesarrow-up-right - List accessible shares on remote systems and check read/write privileges

Snafflerarrow-up-right - 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

PowerUparrow-up-right - PowerSploit module

SharpUparrow-up-right - .NET port of PowerUp

WinPEASarrow-up-right - Windows Privilege Escalation Awesome Script

execute-assembly winpeas.exe #run all checks

SeatBeltarrow-up-right - .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.ps1arrow-up-right: ACL attacks for lateral movement, persistence and privilege escalation Stealthier than above method since it doesn't touch disk

Scheduled task lateral movement

Invoke-TheHasharrow-up-right - 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 Kitarrow-up-right Aggressor script using execute-assembly, SharpMove and SharpRPD assemblies for doing lateral movement with various techniques

SharpExecarrow-up-right - CSharp tooling lateral movement


Domain Privilege Escalation

GPP Passwords

Get-GPPPassword.ps1arrow-up-right PowerSploit module

Net-GPPPasswordarrow-up-right .NET port of get-gpppassword

Get-GPPAutologon.ps1arrow-up-right PowerSploit module

LAPS Passwords

SharpLapsarrow-up-right - 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.ps1arrow-up-right

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

SharpSprayarrow-up-right - .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

PetitPotamarrow-up-right - 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-patchitarrow-up-right for current process patchit amsi

boku7/InjectAmsiBypassarrow-up-right BOF Patch AMSI in remote process inject-amsiBypass <PID>

ETW patch

BOF-patchitarrow-up-right for current process patchit etw

ajpc500/BOFsarrow-up-right 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

SharpDPAPIarrow-up-right

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

SharpWebarrow-up-right - Retrieve saved credentials in Chrome, Firefox and Edge

Active Directory Certificate Services (AD CS) Attack

Certify - GhostPackarrow-up-right Enumerate and abuse misconfigurations in AD CS

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

MalSCCMarrow-up-right - 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 PowerSploitarrow-up-right without touching disk

Extract LSASS process with SafetyKatzarrow-up-right

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

SharpSecDumparrow-up-right 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.ps1arrow-up-right to perform DCSync attacks remotely

Copy-VSS.ps1 from Nishang toolkitarrow-up-right to dump NTDS.dit locally on the DC

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

Credential Prompt

CredPromptarrow-up-right to ask the current user for their username/password.


Exfiltration - Email

PowreShell tool to search mailboxes in a Microsoft Exchange environment


Persistence

SharpStayarrow-up-right - .NET Persistence

SharpPersistarrow-up-right

StayKitarrow-up-right - Cobalt Strike persistence kit aggressor script


Cobalt Strike BOFs

My BOF Collection GitHub pagearrow-up-right

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 sheetarrow-up-right

AD exploitation cheat sheetarrow-up-right

Sharphoundarrow-up-right

PowerShell remoting cheat sheetarrow-up-right

Mimikatz reference cheat sheetarrow-up-right

SpectreOps Cobalt Strike command referencearrow-up-right

Last updated