Page cover

Cobalt Strike

This is a temporary notes while I finished the course then I moved to

How to set up the Team Server

#Start the teamserver and run as service
Intrusionz3r0@htb[/crto]$ tmux
Intrusionz3r0@htb[/crto]$ cd cobaltstrike
Intrusionz3r0@htb[/crto]$ sudo ./teamserver <Attacker-Box> <Password-TeamServer> c2-profiles/normal/webbug.profile

Launch cobalt strike client from the taskbar and enter the next details as follows:

#Set parameters:
Alias: Kali-Intrusionz3r0
Host: <Attacker-Box>
Port: Defaul Port
Username: Intrusionz3r0
Password: <Password-TeamServer>

Running team server as service to start automatically

Intrusionz3r0@htb[/crto]$ sudo nano /etc/systemd/system/teamserver.service
[Unit]
Description=Cobalt Strike Team Server
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
WorkingDirectory=/home/attacker/cobaltstrike
ExecStart=/home/attacker/cobaltstrike/teamserver <Attacker-Box> <Password-TeamServer> c2-profiles/normal/webbug.profile

[Install]
WantedBy=multi-user.target

Setting up DNS records for DNS based beacon payloads

Cobalt Functionalities

Listeners

How to Set Up an Listener:

  • Go to Cobalt Strike > Listeners or click the headphone icon. 🎧

  • Click Add (Below bar), choose Beacon HTTP/DNS/TCP/SMB, and name it (something easy to remember).

    • beacon_http_1234

    • beacon_initial-access_1234

    • beacon_tcp_1234

  • Add the server's IP or domain name Ex: nickelviper.com

Setting up a listener proxy aware (beacon)

Setting up the SMB Listener

  • Default pipe name is quite well signatured. A good strategy is to emulate names known to be used by common applications or Windows itself.

  • Select one for example: TSVCPIPE-4036c92b-65ae-4601-1337-57f7b24a0c57

  • Change the final 4 characters: TSVCPIPE-4036c92b-65ae-4601-1337-57f7b24aAAAA

Pivot Listeners

Pivot Listeners are an advanced Cobalt Strike feature that lets you use an already compromised Beacon as a "bridge" to reach other internal systems in a network.

Setting up: Click on beacon > pivoting > listener

circle-exclamation

Set up a Script web delivery

Setting up: Attacks > Scripted Web Delivery (S)

Hosting a file

Setting up: Site Management > Host file

Session passing

Cobalt Strike kits (extensions)

Cobalt Strike → Script Manager → Load:

Cobalt Strike useful commands

circle-info

The longer the sleep, the healthier the beacon due to less communication and stealth.

Notes for CRTO

External Reconnaissance

Linkedln enumeration

Gaining Initial foothold

Bypassing AV/EDR

  • Remote shellcode loader/ Shellcode embeeded on image

  • Function call obfuscation

  • Encoding Shellcode (RC4,XOR,AES)

  • SysWhisperer3 Direct & Indirect Syscalls.

  • Trampoline via breakpoint & direct instruction pointer setting

  • Early Bird (NtQueueUserAPC) into a remote process

  • Keeping Memory RX

Simple Macro for MS Word

Advanced Macro for MS Word

Internal Enumeration

Identify security solutions in placed through the system.

EDR / (AV)

  • CrowdStrike Falcon: csagent.exe, CSFalconService.exe

  • Microsoft Defender: MsMpEng.exe, MSASCui.exe

  • Elastic Security: elastic-agent.exe, elastic-endpoint.exe

  • Carbon Black: cb.exe, CbDefense.exe

  • SentinelOne: SentinelAgent.exe

  • CylancePROTECT: CylanceSvc.exe

  • Symantec: ccSvcHst.exe, Rtvscan.exe

  • Trend Micro: TmCCSF.exe

  • Kaspersky: avp.exe

SIEM

  • Splunk: splunkd.exe

  • IBM QRadar: qradar.exe

  • Tanium: TaniumClient.exe

Another tools

  • Sysmon: sysmon.exe

  • Osquery: osqueryd.exe

  • Wazuh: wazuh-agent.exe

Host Persistence

Tool: SharPersistarrow-up-right

Aggressor Scripts: persistence-sharpersistarrow-up-right

Powershell Executable file location: PowerShell_Executables_File_System_Locations.phparrow-up-right

Powerlurck: PowerLurkarrow-up-right

Hijacking COM objects

Process Monitor: procmonarrow-up-right

Use process monitor and set filters as follows:

Look for any particular process is loading a .dll or .exe and take note about CLSID.

Script to detect CLSID with Powershell

Host Privilege Escalation

circle-check

Script to obtain ACLs: Get-ServiceAclarrow-up-right

UAC Bypass

Credential Theft

! Run command as SYSTEM

@ Use current token

How to crack Domain cached credentials (DCC): https://www.ired.team/offensive-security/credential-access-and-credential-dumping/dumping-and-cracking-mscash-cached-domain-credentials#cracking-mscash-mscache-with-hashcatarrow-up-right

Domain Reconnaissance

Powerview: powerviewarrow-up-right

User impersonation

Pass the hash

Pass the ticket

Over pass the hash

Stealing tokens

Allows you to steal the token from another process

Token store

Improved version of steal_token

Making tokens

Allows you to impersonate a user if you know their plaintext password.

Injecting arbitrary shellcode into a process

Lateral movement

Data Protection API

Windows Credential Manager uses a two-layer system for credential storage:

  1. Vaults (Containers):

    • Web Credentials: Stores browser-saved passwords (IE/Edge)

    • Windows Credentials: Stores RDP, network shares, and application credentials

    • Each vault contains metadata about stored credentials

  2. Credentials (Actual Data):

    • Encrypted blobs containing the sensitive data

    • Protected via DPAPI (Data Protection API)

    • Stored in separate locations from vault references

Kerberos

Kerberoast

Asreproast

Unconstrained Delegation

Constrained delegation enabled

Resource Based Constrained delegation RBCD

Useful ticket combinations

Technique
Required Service Tickets

psexec

HOST & CIFS

winrm

HOST & HTTP

dcsync (DCs only)

LDAP

Silver Ticket

Golden Ticket

Kerberos Relay

Setting up Cobalt Strike

Kerberos Relay + RBCD attack workflow

Kerberos Relay Attack using Shadow Credentials

Shadow Credentials

NTLM Relay

Tools: https://github.com/praetorian-inc/PortBender/blob/main/static/PortBender.cnaarrow-up-right

WebClient Abuse (WebDAV)

You can check if WebDAV is enabled on target machine, if so, it can be used to perform a NTLM relay attack to compromise the server.

Tool: https://github.com/G0ldenGunSec/GetWebDAVStatus/tree/mainarrow-up-right

Pivoting

Set up Socks Proxy on cobalt strike

Active Directory Certificate Services

How to exploit ESC1 - ESC13

ADCS - ESC1

Requirements:

  • Enrollment Rights: youruser

  • Requires Manager Approval: False.

  • Authorized Signature Required: 0.

  • Client Authentication: True or Extended Key Usage Client Authentication.

  • Enrollee Supplies Subject: True.

ADCS - ESC8

Requirements:

  • A vulnerable web enrollment endpoint.

  • At least one certificate template enabled allows domain computer enrollment and client authentication (like the default Machine/Computer template).

  • Request Disposition : Issue

Golden Certificate

GPO Abuse

Modify Existing GPO

Create and Link new GPO

MSSQL

System Center Configuration Manager (SCCM)

Forest & Domain Trusts

Bidireccional Trust

Inbound trust

Outbound trust

Defense Evasion

AV/Bypass

Three loader variants:

  1. Download Stager ⇒ download shellcode from file hosted on Cobalt Strike team server over HTTPS

  2. Read Stager ⇒ read shellcode from disk, by default C:\Windows\beacon.bin but you can change this

  3. Stageless ⇒ include shellcode directly in PE as a resource (in .rsrc section) - requires encoding the shellcode so it's not caught by EDR

Recommend Techniques:

  • SysWhisperer3 Direct & Indirect Syscalls

  • Trampoline via breakpoint & direct instruction pointer setting

  • Early Bird (NtQueueUserAPC) into a remote process

  • Keeping Memory RX

Applocker

circle-check

Lateral movement via MSBUILD

Manual AMSI bypass

One line AMSI bypass

Remote AMSI bypass

Last updated