Cobalt Strike
Great Cobalt-Strike Reading
Cobalt-Strike cheat sheet.
All credit for content below goes to:
Start teamserver
Create a listener
Cobalt Strike --> Listeners --> Click the Add button and a New Listener dialogue will appear.
Choose a descriptive name such as
<protocol>-<port>
example:http-80
.Set the variables and click Save.
Create a payload
OPSEC: Staged payloads are good if your delivery method limits the amount of data you can send. However, they tend to have more indicators compared to stageless. Given the choice, go stageless.
OPSEC: The use of 64-bit payloads on 64-bit Operating Systems is preferable to using 32-bit payloads on 64-bit Operating Systems.
Attacks --> Packages --> Windows Executable (S).
Create dll payload
Bypasses default applocker configuration
Create peer-to-peer listener
Creating P2P listeners can be done in the Listeners menu, by selecting the TCP or SMB Beacon payload type.
Then create payload for the new listener!
Connect to beacon
Works like a bind shell. Most used are SMB or TCP.
Run the payload on the target
Connect to the beacon with
link
for smb andconnect
for tcp.
Create pivot listener
To start a Pivot Listener on an existing Beacon, right-click it and select Pivoting --> Listener.
Might need to open port on the firewall
Upload and download files
Take screenshots
Keylogger
Execute assembly in memory
Load PowerShell script
Execute cmd command
Execute powershell command
Execute powershell command through powerpick
Bypasses Constrained Language Mode
Create service binary
Used for privilege escalation with services
Attacks --> Packages --> Windows Executable (S) and selecting the Service Binary output type.
TIP: I recommend the use of TCP beacons bound to localhost only with privilege escalations
Connect to beacon
UAC bypass method 1
UAC bypass method 2 runasadmin
Not all UAC bypasses are created equal, can elevate to system with:
Elevate to system
Lateral movement
Jump
Remote-exec
Using credentials
Each of these strategies are compatible with the various credential and impersonation methods described in the next section, Credentials & User Impersonation. For instance, if you have plaintext
credentials of a domain user who is a local administrator on a target, use
make_token
and thenjump
to use that user's credentials to move laterally to the target.
PowerShell Remoting
Getting the architectur
for winrm or winrm64 with jump
Jump winrm smb beacon
PSexec
WMI
WMI exec commands
CoInitializeSecurity
Beacon's internal implementation of WMI uses a Beacon Object File, executed using the beacon_inline_execute Aggressor function. When a BOF is executed the CoInitializeSecurity COM object can be called, which is used to set the security context for the current process. According to Microsoft's documentation, this can only be called once per process. The unfortunate consequence is that if you have CoInitializeSecurity get called in the context of, say "User A", then future BOFs may not be able to inherit a different security context ("User B") for the lifetime of the Beacon process.
if CoInitializeSecurity has already been called, WMI fails with access denied.
As a workaround, your WMI execution needs to come from a different process. This can be achieved with commands such as spawn and spawnas, or even execute-assembly with a tool such as SharpWMI.
DCOM
Credentials
Mimikatz logonpasswords
Mimikatz ekeys
Mimikatz sam
Make token - runas other user
rev2self
Undo the make token
Steal token
Inject payload into process
Spawnas
Will spawn a new process using the plaintext credentials of another user and inject a Beacon payload into it.
Must be run from a folder the user has access to.
This command does not require local admin privileges and will also usually fail if run from a SYSTEM Beacon.
Dcsync
Pass the hash
Overpass the hash
OPSEC: Use AES256 keys
Overpass the hash elevated context
Extract tickets
Extract tickets of a user, create new process, inject ticket into process, steal token from the process
Load ticket
Use ccache file
Session passing
Cobalt strike --> Metasploit
Go to Listeners --> Add and set the Payload to Foreign HTTP. Set the Host, the Port to 8080, Set the name to Metasploit and click Save.
Cobalt strike --> Metasploit shellcode inside process
Metasploit --> Cobalt strike
Go to Attacks --> Packages --> Windows Executable (S), select the desired listener, select Raw as the Output type and select Use x64 payload.
Pivoting
Socksproxy
Enable Socksproxy
OPSEC: This binds 1080 on all interfaces and since there is no authentication available on SOCKS4, this port can technically be used by anyone
Proxychains
For linux
Proxifier
For windows
Open Proxifier, go to Profile > Proxy Servers and Add a new proxy entry, which will point at the IP address and Port of your Cobalt Strike SOCKS proxy.
Next, go to Profile > Proxification Rules. This is where you can add rules that tell Proxifier when and where to proxy specific applications. Multiple applications can be added to the same rule, but in this example, I'm creating a single rule for adexplorer64.exe (part of the Sysinternals Suite).
Target hosts fill in the target internal network range with the action
proxy socks <TARGET>
NOTE: You will also need to add a static host entry in your C:\Windows\System32\drivers\etc\hosts file: . You can enable DNS lookups through Proxifier, but that will cause DNS leaks from your computer into the target environment.
Proxychains netonly or overpass the hash
Metasploit
In Cobalt Strike, go to View > Proxy Pivots, highlight the existing SOCKS proxy and click the Tunnel button.
Paste string in msfconsole
Stop with
socks stop
Manual port forwards
Remote port forward netsh
Requires administrator privs
List forwards netsh
Remove port forward netsh
Create port forward rportfwd
Beacon's reverse port forward always tunnels the traffic to the Team Server and the Team Server sends the traffic to its intended destination, so shouldn't be used to relay traffic between individual machines.
Does not require administrator privs
Stop port forward rportfwd
Create port forward rportfwd_local
Beacon also has a rportfwd_local command. Whereas rportfwd will tunnel traffic to the Team Server, rportfwd_local will tunnel the traffic to the machine running the Cobalt Strike client.
Does not require administrator privs
If 127.0.0.1 doesn't work use teamserver IP
Stop port forward local
NTLMRelaying with cobalt strike
Requires administrator privs
Place portbender driver on the target
Load portbender.cna
Load PortBender.cna from C:\Tools\PortBender this adds a new PortBender command to the console.
Create port forward
Create a reverse port forward that will then relay the traffic from port 8445 to port 445 on the Team Server (where ntlmrelayx will be waiting).
Create sockx proxy
NTLMRelay execute command
Stop portbender
Create link file
Portscan
Evasion
Artifact-kit
Changed this part from --> to
Then run build.sh
Download files to W10
Make sure C:\tools\cobaltstrike\Artifactkit\dist-pip\artifact.cna is loaded
Resource-kit
Changed all variables in the file from this part --> to
Find & Replace for $x -> $i and $var_code -> $var_service.
Make sure C:\tools\cobaltstrike\Resourcekit\resources.cna is loaded
Amsi
Add the following to the .profile
Last updated