Cs Manual 43
Cs Manual 43
3
Manual
Strategic Cyber LLC (A HelpSystems Company)
www.cobaltstrike.com
Table of Contents
Table of Contents .................................................................................................................................. 2
1. Welcome to Cobalt Strike .............................................................................................................. 6
1.1 What is Cobalt Strike? ............................................................................................................................ 6
1.2 Installation and Updates ....................................................................................................................... 7
System Requirements ................................................................................................................................................... 7
Run the ‘update’ program ............................................................................................................................................ 7
1.3 The Team Server ...................................................................................................................................... 8
1.4 Cobalt Strike Client ................................................................................................................................. 9
1.5 Distributed and Team Operations ................................................................................................... 10
1.6 Scripting Cobalt Strike ......................................................................................................................... 11
1.7 Running the Client on MacOS X ......................................................................................................... 12
2. User Interface ................................................................................................................................. 13
2.1 Overview ................................................................................................................................................... 13
2.2 Toolbar ...................................................................................................................................................... 14
2.3 Session and Target Visualizations ................................................................................................... 15
Targets Table ................................................................................................................................................................. 15
Sessions Table ............................................................................................................................................................... 16
Pivot Graph ..................................................................................................................................................................... 16
2.4 Tabs ............................................................................................................................................................ 18
2.5 Consoles .................................................................................................................................................... 18
2.6 Tables ........................................................................................................................................................ 19
3. Data Management .......................................................................................................................... 20
3.1 Overview ................................................................................................................................................... 20
3.2 Targets ...................................................................................................................................................... 20
3.3 Services ..................................................................................................................................................... 21
3.4 Credentials ............................................................................................................................................... 21
3.5 Maintenance ............................................................................................................................................ 21
4. Listener and Infrastructure Management ............................................................................. 22
4.1 Overview ................................................................................................................................................... 22
4.2 Listener Management .......................................................................................................................... 22
4.3 Cobalt Strike’s Beacon Payload ......................................................................................................... 22
4.4 Payload Staging ...................................................................................................................................... 23
4.5 HTTP Beacon and HTTPS Beacon ..................................................................................................... 23
Manual HTTP Proxy Configuration ...................................................................................................................... 25
Redirectors ...................................................................................................................................................................... 26
4.6 DNS Beacon .............................................................................................................................................. 26
Data Channels ................................................................................................................................................................ 27
Listener Setup ................................................................................................................................................................ 27
4.7 SMB Beacon ............................................................................................................................................. 29
Linking and Unlinking ................................................................................................................................................ 30
4.8 TCP Beacon .............................................................................................................................................. 31
Connecting and Unlinking ........................................................................................................................................ 31
4.9 External C2 ............................................................................................................................................... 31
4.10 Foreign Listeners ................................................................................................................................ 33
4.11 Infrastructure Consolidation .......................................................................................................... 33
2
www.cobaltstrike.com
3
www.cobaltstrike.com
4
www.cobaltstrike.com
5
www.cobaltstrike.com
A thought-out targeted attack begins with reconnaissance. Cobalt Strike’s system profiler is a
web application that maps your target’s client-side attack surface. The insights gleaned from
reconnaissance will help you understand which options have the best chance of success on your
target.
Use Cobalt Strike’s spear phishing tool to deliver your weaponized document to one or more
people in your target’s network. Cobalt Strike’s phishing tool repurposes saved emails into pixel-
perfect phishes.
Control your target’s network with Cobalt Strike’s Beacon. This post-exploitation payload uses
an asynchronous “low and slow” communication pattern that’s common with advanced threat
malware. Beacon will phone home over DNS, HTTP, or HTTPS. Beacon walks through
common proxy configurations and calls home to multiple hosts to resist blocking.
6
www.cobaltstrike.com
Exercise your target’s attack attribution and analysis capability with Beacon’s Malleable
Command and Control language. Reprogram Beacon to use network indicators that look like
known malware or blend in with existing traffic.
Pivot into the compromised network, discover hosts, and move laterally with Beacon’s helpful
automation and peer-to-peer communication over named pipes and TCP sockets. Cobalt Strike is
optimized to capture trust relationships and enable lateral movement with captured credentials,
password hashes, access tokens, and Kerberos tickets.
Demonstrate meaningful business risk with Cobalt Strike’s user-exploitation tools. Cobalt
Strike’s workflows make it easy to deploy keystroke loggers and screenshot capture tools on
compromised systems. Use browser pivoting to gain access to websites that your compromised
target is logged onto with Internet Explorer. This Cobalt Strike-only technique works with most
sites and bypasses two-factor authentication.
Cobalt Strike’s reporting features reconstruct the engagement for your client. Provide the
network administrators an activity timeline so they may find attack indicators in their sensors.
Cobalt Strike generates high quality reports that you may present to your clients as stand-alone
products or use as appendices to your written narrative.
Throughout each of the above steps, you will need to understand the target environment, its
defenses, and reason about the best way to meet your objectives with what is available to you.
This is evasion. It is not Cobalt Strike’s goal to provide evasion out-of-the-box. Instead, the
product provides flexibility, both in its potential configurations and options to execute offense
actions, to allow you to adapt the product to your circumstance and objectives.
System Requirements
Cobalt Strike requires Oracle Java 1.8, Oracle Java 11, or OpenJDK 11.
If you have an anti-virus product on your system, make sure you disable it before you install
Cobalt Strike.
7
www.cobaltstrike.com
Figure 2. The Update Process (Nice try, but the pictured key is no longer valid)
Make sure you update both your team server and client software with your license key. Cobalt
Strike is generally licensed on a per user basis. The team server does not require a separate
license.
The Cobalt Strike team server must run on a supported Linux system. To start a Cobalt Strike
team server, use the teamserver script included with the Cobalt Strike Linux package.
The team server has two mandatory parameters and two optional parameters. The first is the
externally reachable IP address of the team server. Cobalt Strike uses this value as a default host
for its features. The second is the password your team members will use to connect the Cobalt
Strike client to the team server.
The third parameter is optional. This parameter specifies a Malleable C2 Profile. Chapters 11 and
12 discuss this feature.
The fourth parameter is also optional. This parameter specifies a kill date in YYYY-MM-DD
format. The team server will embed this kill date into each Beacon stage it generates. The
Beacon payload will refuse to run on or after this date. The Beacon payload will also exit if it
wakes up on or after this date as well.
8
www.cobaltstrike.com
When the team server starts, it will publish the SHA256 hash of the team server’s SSL
certificate. Distribute this hash to your team members. When your team members connect, their
Cobalt Strike client will ask if they recognize this hash before it authenticates to the team server.
This is an important protection against man-in-the-middle attacks.
You will see a connect dialog when the Cobalt Strike client starts.
Specify your team server’s address in the Host field. The default Port for the team server is
50050. There’s rarely a reason to change this. The User field is your nickname on the team
server. Change this to your call sign, handle, or made-up hacker fantasy name. The Password
field is the shared password for the team server.
If this is your first connection to this team server, Cobalt Strike will ask if you recognize the
SHA256 hash of this team server. If you do, press OK, and the Cobalt Strike client will connect
to the server. Cobalt Strike will also remember this SHA256 hash for future connections. You
may manage these hashes through Cobalt Strike -> Preferences -> Fingerprints.
9
www.cobaltstrike.com
Cobalt Strike keeps track of the team servers you connect to and remembers your information.
Select one of these team server profiles from the left-hand-side of the connect dialog to populate
the connect dialog with its information. You may also prune this list through Cobalt Strike ->
Preferences -> Team Servers.
10
www.cobaltstrike.com
This switchbar allows you to switch between active Cobalt Strike server instances. Each server
has its own button. Right-click a button and select Rename to make the button’s text reflect the
role of the server during your engagement. This button name will also identify the server in the
Cobalt Strike Activity Report..
When connected to multiple servers, Cobalt Strike aggregates listeners from all of the servers it’s
connected to. This aggregation allows you to send a phishing email from one server that
references a malicious website hosted on another server. At the end of your engagement, Cobalt
Strike’s reporting feature will query all of the servers you’re connected to and merge the data to
tell one story.
A default script inside of Cobalt Strike defines all of Cobalt Strike’s popup menus and formats
information displayed in Cobalt Strike’s consoles. Through the Aggressor Script engine, you
may override these defaults and customize Cobalt Strike to your preferences.
You may also use Aggressor Script to add new features to Cobalt Strike’s Beacon and to
automate certain tasks.
• https://www.cobaltstrike.com/aggressor-script/
11
www.cobaltstrike.com
By default, OSX limits what access applications have to the Documents, Desktop, and Download
folders. These applications need to explicitly be granted access to these folders.
Since Cobalt Strike is a third party application, it isn't as straight forward as granting the app
"Cobalt Strike" access. You may need to give the JRE running Cobalt Strike client access to the
file system. You can give access to the specific Files and Folders or Full Disk Access.
Or, if the access has been previously denied, you may need to edit the access in the OSX System
Preferences / Security & Privacy / Privacy dialog:
12
www.cobaltstrike.com
Please be advised that other applications that use the JRE will also have this access.
2. User Interface
2.1 Overview
The Cobalt Strike user interface is split into two parts. The top of the interface shows a
visualization of sessions or targets. The bottom of the interface displays tabs for each Cobalt
Strike feature or session you interact with. You may click the area between these two parts and
resize them to your liking.
13
www.cobaltstrike.com
2.2 Toolbar
The toolbar at the top of Cobalt Strike offers quick access to common Cobalt Strike functions.
Knowing the toolbar buttons will speed up your use of Cobalt Strike considerably.
View credentials
View downloaded files
View keystrokes
View screenshots
14
www.cobaltstrike.com
Targets Table
The Targets Table shows the targets in Cobalt Strike’s data model. The targets table displays the
IP address of each target, its NetBIOS name, and a note that you or one of your team members
assigned to the target. The icon to the left of a target indicates its operating system. A red icon
with lightning bolts indicates that the target has a Cobalt Strike Beacon session associated with
it.
Click any of the table headers to sort the hosts. Highlight a row and right-click it to bring up a
menu with options for that host. Press Ctrl and Alt and click to select and deselect individual
hosts.
The target’s table is a useful for lateral movement and to understand your target’s network.
15
www.cobaltstrike.com
Sessions Table
The sessions table shows which Beacons are calling home to this Cobalt Strike instance. Beacon
is Cobalt Strike’s payload to emulate advanced threat actors. Here, you will see the external IP
address of each Beacon, the internal IP address, the egress listener for that Beacon, when the
Beacon last called home, and other information. Next to each row is an icon indicating the
operating system of the compromised target. If the icon is red with lightning bolts, the Beacon is
running in a process with administrator privileges. A faded icon indicates that the Beacon session
was asked to exit and it acknowledged this command.
If you use a DNS Beacon listener, be aware that Cobalt Strike will not know anything about a
host until it checks in for the first time. If you see an entry with a last call time and that’s it, you
will need to give that Beacon its first task to see more information.
Pivot Graph
Cobalt Strike has the ability to link multiple Beacons into a chain. These linked Beacons receive
their commands and send their output through the parent Beacon in their chain. This type of
chaining is useful to control which sessions egress a network and to emulate a disciplined actor
who restricts their communication paths inside of a network to something plausible. This
chaining of Beacons is one of the most powerful features in Cobalt Strike.
Cobalt Strike’s workflows make this chaining very easy. It’s not uncommon for Cobalt Strike
operators to chain Beacons four or five levels deep on a regular basis. Without a visual aid it’s
very difficult to keep track of and understand these chains. This is where the Pivot Graph comes
in.
The Pivot Graph shows your Beacon chains in a natural way. Each Beacon session has an icon.
As with the sessions table: the icon for each host indicates its operating system. If the icon is red
with lightning bolts, the Beacon is running in a process with administrator privileges. A darker
icon indicates that the Beacon session was asked to exit and it acknowledged this command.
The firewall icon represents the egress point of your Beacon payload. A dashed green line
indicates the use of beaconing HTTP or HTTPS connections to leave the network. A yellow
dashed line indicates the use of DNS to leave the network.
16
www.cobaltstrike.com
An arrow connecting one Beacon session to another represents a link between two Beacons.
Cobalt Strike’s Beacon uses Windows named pipes and TCP sockets to control Beacons in this
peer-to-peer fashion. An orange arrow is a named pipe channel. SSH sessions use an orange
arrow as well. A blue arrow is a TCP socket channel. A red (named pipe) or purple (TCP)
arrow indicates that a Beacon link is broken.
Click a Beacon to select it. You may select multiple Beacons by clicking and dragging a box
over the desired hosts. Press Ctrl and Shift and click to select or unselect an individual Beacon.
• Ctrl+Plus — zoom in
• Ctrl+Minus — zoom out
• Ctrl+0 — reset the zoom level
• Ctrl+A — select all hosts
• Escape — clear selection
• Ctrl+C — arrange hosts into a circle
• Ctrl+S — arrange hosts into a stack
• Ctrl+H — arrange hosts into a hierarchy.
Right-click the Pivot Graph with no selected Beacons to configure the layout of this graph. This
menu also has an Unlinked menu. Select Hide to hide unlinked sessions in the pivot graph.
Select Show to show unlinked sessions again.
17
www.cobaltstrike.com
2.4 Tabs
Cobalt Strike opens each dialog, console, and table in a tab. Click the X button to close a tab.
Use Ctrl+D to close the active tab. Ctrl+Shift+D will close all tabs except the active on.
You may right-click the X button to open a tab in a window, take a screenshot of a tab, or close
all tabs with the same name.
Keyboard shortcuts exist for these functions too. Use Ctrl+W to open the active tab in its own
window. Use Ctrl+T to quickly save a screenshot of the active tab.
Ctrl+B will send the current tab to the bottom of the Cobalt Strike window. This is useful for
tabs that you need to constantly watch. Ctrl+E will undo this action and remove the tab at the
bottom of the Cobalt Strike window.
Hold shift and click X to close all tabs with the same name. Hold shift + control and click X to
open the tab in its own window.
2.5 Consoles
Cobalt Strike provides a console to interact with Beacon sessions, scripts, and chat with your
teammates.
The consoles track your command history. Use the up arrow to cycle through previously typed
commands. The down arrow moves back to the last command you typed.
18
www.cobaltstrike.com
Use Ctrl+Plus to make the console font size larger, Ctrl+Minus to make it smaller, and Ctrl+0
to reset it. This change is local to the current console only. Visit Cobalt Strike -> Preferences to
permanently change the font.
Press Ctrl+F to show a panel that will let you search for text within the console.
2.6 Tables
Cobalt Strike uses tables to display sessions, credentials, targets, and other engagement
information.
Most tables in Cobalt Strike have an option to assign a color highlight to the highlighted rows.
These highlights are visible to other Cobalt Strike clients. Right-click and look for the Color
menu.
Press Ctrl+F within a table to show the table search panel. This feature lets you filter the current
table.
The text field is where you type your filter criteria. The format of the criteria depends on the
column you choose to apply the filter to. Use CIDR notation (e.g., 192.168.1.0/24) and host
ranges (192.168.1-192.169.200) to filter columns that contain addresses. Use numbers or ranges
of numbers for columns that contain numbers. Use wildcard characters (*, ?) to filter columns
that contain strings.
The ! button negates the current criteria. Press enter to apply the specified criteria to the current
table. You may stack as many criteria together as you like. The Reset button will remove the
filters applied to the current table.
19
www.cobaltstrike.com
3. Data Management
3.1 Overview
Cobalt Strike’s team server is a broker for information collected by Cobalt Strike during your
engagement. Cobalt Strike parses output from its Beacon payload to extract targets, services, and
credentials.
If you’d like to export Cobalt Strike’s data, you may do so through Reporting -> Export Data.
Cobalt Strike provides options to export its data as TSV and XML files. The Cobalt Strike
client’s export data feature will merge data from all of the team servers you’re currently
connected to.
3.2 Targets
You may interact with Cobalt Strike’s target information through View -> Targets. This tab
displays the same information as the Targets Visualization.
Press Import to import a file with target information. Cobalt Strike accepts flat text files with
one host per line. It also accepts XML files generated by Nmap (the –oX option).
This dialog allows you to add multiple hosts to Cobalt Strike’s database. Specify a range of IP
addresses or use CIDR notation in the Address field to add multiple hosts at one time. Hold
down shift when you click Save to add hosts to the data model and keep this dialog open.
Select one or more hosts and right-click to bring up the hosts menu. This menu is where you
change the note on the hosts, set their operating system information, or remove the hosts from
the data model.
20
www.cobaltstrike.com
3.3 Services
From a targets display, right-click a host, and select Services. This will open Cobalt Strike’s
services browser. Here you may browse services, assign notes to different services, and remove
service entries as well.
3.4 Credentials
Go to View -> Credentials to interact with Cobalt Strike’s credential model. Press Add to add
an entry to the credential model. Again, you may hold shift and press Save to keep the dialog
open and make it easier to add new credentials to the model. Press Copy to copy the highlighted
entries to your clipboard. Use Export to export credentials in PWDump format.
3.5 Maintenance
Cobalt Strike’s data model keeps all of its state and state metadata in the data/ folder. This folder
exists in the folder you ran the Cobalt Strike team server from.
To clear Cobalt Strike’s data model: stop the team server, delete the data/ folder, and its
contents. Cobalt Strike will recreate the data/ folder when you start the team server next.
If you’d like to archive the data model, stop the team server, and use your favorite program to
store the data/ folder and its files elsewhere. To restore the data model, stop the team server, and
restore the old content to the data/ folder.
Reporting -> Reset Data resets Cobalt Strike’s Data Model without a team server restart.
21
www.cobaltstrike.com
A listener is simultaneously configuration information for a payload and a directive for Cobalt
Strike to stand up a server to receive connections from that payload. A listener consists of a user-
defined name, the type of payload, and several payload-specific options.
When you create a listener, make sure you give it a memorable name. This name is how you will
refer to this listener through Cobalt Strike’s commands and workflows.
22
www.cobaltstrike.com
Beacon’s network indicators are malleable. Redefine Beacon’s communication with Cobalt
Strike’s malleable C2 language. This allows you to cloak Beacon activity to look like other
malware or blend-in as legitimate traffic. Chapter 11 discusses this feature.
The staging process is necessary in some offense actions. Many attacks have hard limits on how
much data they can load into memory and execute after successful exploitation. This greatly
limits your post-exploitation options, unless you deliver your post-exploitation payload in stages.
Cobalt Strike does use staging in its user-driven attacks. These are most of the items under
Attacks -> Packages and Attacks -> Web Drive-by. The stagers used in these places depend on
the payload paired with the attack. For example, the HTTP Beacon has an HTTP stager. The
DNS Beacon has a DNS TXT record stager. Not all payloads have stager options. Payloads with
no stager cannot be delivered with these attack options.
If you don’t need payload staging, you can turn it off. Set the host_stage option in your
Malleable C2 profile to false. This will prevent Cobalt Strike from hosting payload stages on its
web and DNS servers. There is a big OPSEC benefit to doing this. With staging on, anyone can
connect to your server, request a payload, and analyze its contents to find information from your
payload configuration.
In Cobalt Strike 4.0 and later, post-exploitation and lateral movement actions eschew stagers and
opt to deliver a full payload where possible. If you disable payload staging, you shouldn’t notice
it once you’re ready to do post-exploitation.
To stand up an HTTP or HTTPS Beacon listener, go to Cobalt Strike -> Listeners. Press Add.
Choose Beacon HTTP as your payload option.
23
www.cobaltstrike.com
Press [+] to add one or more hosts for the HTTP Beacon to call home to. Press [-] to remove one
or more hosts. Press [X] to clear the current hosts. If you have multiple hosts, you can still paste
a comma-separated list of callback hosts into this dialog. That’s OK. J
The length of the beacon host list in beacon payload is limited to 255 characters. This includes a
randomly assigned URI for each host and delimiters between each item in the list. If the length is
exceeded, hosts will be dropped from the end of the list until it fits in the space. There will be
messages in the team server log for dropped hosts.
The Host Rotation Strategy field configures the beacons behavior for choosing which host(s)
from the list to use for egress.
Strategy Description
round-robin Loop through the list of host names in the order they are
provided. Each host is used for one connection.
random Randomly select a host name from the list each time a
connection is attempted.
failover-xx Use a working host as long as possible. Use each host in the list
until they reach a consecutive failover count (x) or duration time
period (m,h,d), then use the next host.
duration-xx Use each host for a period of time. Use each host in the list for
the specified duration (m,h,d), then use the next host.
24
www.cobaltstrike.com
The HTTP Host (Stager) field controls the host of the HTTP Stager for the HTTP Beacon. This
value is only used if you pair this payload with an attack that requires an explicit stager.
The Profile field is where you select a Malleable C2 profile variant. A variant is a way of
specifying multiple profile variations in one file. With variants, each HTTP or HTTPS listener
you setup can have different network indicators.
The HTTP Port (C2) field sets the port your HTTP Beacon will phone home to. The HTTP
Port (Bind) field specifies the port your HTTP Beacon payload web server will bind to. These
options are useful if you want to setup port bending redirectors (e.g., a redirector that accepts
connections on port 80 or 443 but routes the connection to your team server on another port).
The HTTP Host Header value, if specified, is propagated to your HTTP stagers and through
your HTTP communication. This option makes it easier to take advantage of domain fronting
with Cobalt Strike.
Press … next to the HTTP Proxy field to specify an explicit proxy configuration for this
payload.
The Type field configures the type of proxy. The Host and Port fields tell Beacon where the
proxy lives. The Username and Password fields are optional. These fields specify the credentials
Beacon uses to authenticate to the proxy.
Check the Ignore proxy settings; use direct connection box to force Beacon to attempt its HTTP
and HTTPS requests without going through a proxy.
25
www.cobaltstrike.com
Press Set to update the Beacon dialog with the desired proxy settings. Press Reset to set the
proxy configuration back to the default behavior.
Note: the manual proxy configuration affects the HTTP and HTTPS Beacon payload stages only.
It does not propagate to the payload stagers.
Redirectors
A redirector is a system that sits between your target’s network and your team server. Any
connections that come to the redirector are forwarded to your team server to process. A
redirector is a way to provide multiple hosts for your Beacon payloads to call home to. A
redirector also aids operational security as it makes it harder to trace the true location of your
team server.
Cobalt Strike’s listener management features support the use of redirectors. Simply specify your
redirector hosts when you setup an HTTP or HTTPS Beacon listener. Cobalt Strike does not
validate this information. If the host you provide is not affiliated with the current host, Cobalt
Strike assumes it’s a redirector. One simple way to turn a server into a redirector is to use socat.
Here’s the socat syntax to forward all connections on port 80 to the team server at
192.168.12.100 on port 80:
26
www.cobaltstrike.com
In Cobalt Strike 4.0 and later, the DNS Beacon is a DNS-only payload. There is no HTTP
communication mode in this payload. This is a change from prior versions of the product.
Data Channels
Today, the DNS Beacon can download tasks over DNS TXT records, DNS AAAA records, or
DNS A records. This payload has the flexibility to change between these data channels while its
on target. Use Beacon’s mode command to change the current Beacon’s data channel. mode dns
is the DNS A record data channel. mode dns6 is the DNS AAAA record channel. And, mode
dns-txt is the DNS TXT record data channel. The default is the DNS TXT record data channel.
Be aware that DNS Beacon does not check in until there’s a task available. Use the checkin
command to request that the DNS Beacon check in next time it calls home.
Listener Setup
To create a DNS Beacon listener: go to Cobalt Strike -> Listeners, press Add, and select
Beacon DNS as the Payload type.
27
www.cobaltstrike.com
Press [+] to add one or more domains to beacon to. 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.
The length of the beacon host list in beacon payload is limited to 255 characters. This includes a
randomly assigned URI for each host and delimiters between each item in the list. If the length is
exceeded, hosts will be dropped from the end of the list until it fits in the space. There will be
messages in the team server log for dropped hosts.
The Host Rotation Strategy field configures the beacons behavior for choosing which host(s)
from the list to use for egress.
Strategy Description
round-robin Loop through the list of host names in the order they are
provided. Each host is used for one connection.
random Randomly select a host name from the list each time a
connection is attempted.
failover-xx Use a working host as long as possible. Use each host in the list
until they reach a consecutive failover count (x) or duration time
period (m,h,d), then use the next host.
duration-xx Use each host for a period of time. Use each host in the list for
28
www.cobaltstrike.com
The DNS Host (Stager) field configures the DNS Beacon’s TXT record stager. This stager is
only used with Cobalt Strike features that require an explicit stager. Your Cobalt Strike team
server system must be authoritative for this domain as well.
The Profile field allows a beacon to be configured with a selected Malleable C2 profile variant.
The DNS Resolver allows a DNS Beacon to egress using a specific DNS resolver, rather than
using the default DNS resolver for the target system. Specify the IP Address of the desired
resolver.
To test your DNS configuration, open a terminal and type nslookup jibberish.beacon domain.
If you get an A record reply of 0.0.0.0—then your DNS is correctly setup. If you do not get a
reply, then your DNS configuration is not correct and the DNS Beacon will not communicate
with you.
Make sure your DNS records reference the primary address on your network interface. Cobalt
Strike’s DNS server will always send responses from your network interface’s primary address.
DNS resolvers tend to drop replies when they request information from one server, but receive a
reply from another.
If you are behind a NAT device, make sure that you use your public IP address for the NS record
and set your firewall to forward UDP traffic on port 53 to your system. Cobalt Strike includes a
DNS server to control Beacon.
To customize the network traffic indicators for your DNS beacons, see the dns-beacon group in
the Malleable C2 help.
To configure an SMB Beacon payload, go to Cobalt Strike -> Listeners. Press Add. Choose
Beacon SMB as your payload option.
29
www.cobaltstrike.com
The only option associated with the SMB Beacon is the pipename. You can set an explicit
pipename or accept the default option.
The SMB Beacon is compatible with most actions in Cobalt Strike that spawn a payload. The
exception to this are the user-driven attacks (e.g., Attacks -> Packages, Attacks -> Web Drive-
by) that require explicit stagers.
Cobalt Strike post-exploitation and lateral movement actions that spawn a payload will attempt
to assume control of (link) to the SMB Beacon payload for you. If you run the SMB Beacon
manually, you will need to link to it from a parent Beacon.
To blend in with normal traffic, linked Beacons use Windows named pipes to communicate. This
traffic is encapsulated in the SMB protocol. There are a few caveats to this approach:
To destroy a Beacon link use unlink [ip address] [session PID] in the parent or child. The
[session PID] argument is the process ID of the Beacon to unlink. This value is how you specify
a specific Beacon to de-link when there are multiple childn Beacons.
When you de-link an SMB Beacon, it does not exit and go away. Instead, it goes into a state
where it waits for a connection from another Beacon. You may use the link command to resume
control of the SMB Beacon from another Beacon in the future.
30
www.cobaltstrike.com
To configure a TCP Beacon payload, go to Cobalt Strike -> Listeners. Press Add. Choose
Beacon TCP as your payload option.
The TCP Beacon configured in this way is a bind payload. A bind payload is one that waits for a
connection from its controller (in this case, another Beacon session). The Port (C2) option
controls the port the TCP Beacon will wait for connections on. Check Bind to localhost only to
have the TCP Beacon bind to 127.0.0.1 when it listens for a connection. This is a good option if
you use the TCP Beacon for localhost-only actions.
The TCP Beacon is compatible with most actions in Cobalt Strike that spawn a payload. The
exception to this are, similar to the SMB Beacon, the user-driven attacks (e.g., Attacks ->
Packages, Attacks -> Web Drive-by) that require explicit stagers.
Cobalt Strike post-exploitation and lateral movement actions that spawn a payload will attempt
to assume control of (connect) to the TCP Beacon payload for you. If you run the TCP Beacon
manually, you will need to connect to it from a parent Beacon.
To destroy a Beacon link use unlink [ip address] [session PID] in the parent or child session
console. Later, you may reconnect to the TCP Beacon from the same host (or a different host).
4.9 External C2
External C2 is a specification to allow third-party programs to act as a communication layer for
Cobalt Strike’s Beacon payload. These third-party programs connect to Cobalt Strike to read
frames destined for, and write frames with output from payloads controlled in this way. The
31
www.cobaltstrike.com
External C2 server is what these third-party programs use to interface with your Cobalt Strike
team server.
Go to Cobalt Strike -> Listeners, press Add, and choose External C2 as your payload.
The External C2 interface has two options. Port (Bind) specifies the port the External C2 server
waits for connections on. Check Bind to localhost only to make the External C2 server localhost-
only.
External C2 listeners are not like other Cobalt Strike listeners. You cannot target these with
Cobalt Strike’s post-exploitation actions. This option is just a convenience to stand up the
interface itself.
https://www.cobaltstrike.com/help-externalc2
32
www.cobaltstrike.com
Some engagement phases require multiple redirector and communication channel options. Cobalt
Strike 4.0 is friendly to this.
You can bind multiple HTTP, HTTPS, and DNS listeners to a single Cobalt Strike team server.
These payloads also support port bending in their configuration. This allows you to use the
common port for your channel (80, 443, or 53) in your redirector and C2 setups, but bind these
listeners to different ports to avoid port conflicts on your team server system.
33
www.cobaltstrike.com
To give variety to your network indicators, Cobalt Strike’s Malleable C2 profiles may contain
multiple variants. A variant is a way of adding variations of the current profile into one profile
file. You may specify a Profile variant when you define each HTTP or HTTPS Beacon listener.
Further, you can define multiple TCP and SMB Beacons on one team server, each with different
pipe and port configurations. Any egress Beacon, from the same team server, can control any of
these TCP or SMB Beacon payloads once they’re deployed in the target environment.
When you setup the Beacon payload for the first time, Cobalt Strike will generate a
public/private key pair that is unique to your team server. The team server’s public key is
embedded into Beacon’s payload stage. Beacon uses the team server’s public key to encrypt
session metadata that it sends to the team server.
Beacon must always send session metadata before the team server can issue tasks and receive
output from the Beacon session. This metadata contains a random session key generated by that
Beacon. The team server uses each Beacon’s session key to encrypt tasks and to decrypt output.
Each Beacon implementation and data channel uses this same scheme. You have the same
security with the A record data channel in the Hybrid HTTP and DNS Beacon as you do with the
HTTPS Beacon.
Be aware that the above applies to Beacon once it is staged. The payload stagers, due to their
size, do not have built-in security features.
34
www.cobaltstrike.com
5. Getting a Foothold
5.1 Client-side System Profiler
The system profiler is a reconnaissance tool for client-side attacks. This tool starts a local web-
server and fingerprints any one who visits it. The system profiler provides a list of applications
and plugins it discovers through the user’s browser. The system profiler also attempts to discover
the internal IP address of users who are behind a proxy server.
To start the system profiler, go to Attacks -> Web Drive-by -> System Profiler.
To start the profiler you must specify a URI to bind to and a port to start the Cobalt Strike web-
server from.
If you specify a Redirect URL, Cobalt Strike will redirect visitors to this URL once their profile
is taken. Click Launch to start the system profiler.
The System Profiler uses an unsigned Java Applet to decloak the target’s internal IP address and
determine which version of Java the target has. With Java’s click-to-run security feature—this
could raise suspicion. Uncheck the Use Java Applet to get information box to remove the Java
Applet from the System Profiler.
Check the Enable SSL box to serve the System Profiler over SSL. This box is disabled unless
you specify a valid SSL certificate with Malleable C2. Chapter 11 discusses this.
To view the results from the system profiler, go to View -> Applications. Cobalt Strike will list
all of the applications it discovered during the system profiling process.
To manage Cobalt Strike’s web services, go to View -> Web Drive-by -> Manage. Here, you
may copy any Cobalt Strike URL to the clipboard or stop a Cobalt Strike web service.
Use View -> Web Log to monitor visits to your Cobalt Strike web services.
If Cobalt Strike’s web server sees a request from the Lynx, Wget, or Curl browser; Cobalt Strike
will automatically return a 404 page. Cobalt Strike does this as light protection against blue team
snooping. This can be configured with the Malleable C2 ‘.http-config.block_useragents’ option.
35
www.cobaltstrike.com
HTML Application
An HTML Application is a Windows program written In HTML and an Internet Explorer-
supported scripting language. This package generates an HTML Application that runs a Cobalt
Strike payload. You may choose the Executable option to get an HTML Application that drops
an executable to disk and runs it. Choose the PowerShell option to get an HTML Application
that uses PowerShell to run a payload. Use the VBA option to silently spawn a Microsoft Excel
instance and run a malicious macro that injects a payload into memory.
MS Office Macro
This package generates a Microsoft Office macro and presents instructions to embed the macro
in Microsoft Word or Microsoft Excel.
Payload Generator
This package allows you to export Cobalt Strike’s stagers in a variety of formats.
Windows Executable
This package generates a Windows executable artifact that delivers a payload stager. This
package gives you several output options.
Windows Service EXE is a Windows executable that responds to Service Control Manager
commands. You may use this executable to create a Windows service with sc or as a custom
executable with the Metasploit Framework’s PsExec modules.
Windows DLL (64-bit) is an x64 Windows DLL. This DLL will spawn a 32-bit process and
migrate your listener to it. Both DLL options export a StartW function that is compatible with
rundll32.exe. Use rundll32.exe to load your DLL from the command line.
rundll32 foo.dll,StartW
Check the Use x64 payload box to generate x64 artifacts that pair with an x64 stager.
Check the Sign executable file box to sign an EXE or DLL artifact with a code-signing
certificate. You must specify a certificate in a Malleable C2 profile.
By default, this dialog exports x86 payload stages. Check the Use x64 payload box to generate
an x64 stage with an x64 artifact.
36
www.cobaltstrike.com
Check the Sign executable file box to sign an EXE or DLL artifact with a code-signing
certificate.
By itself, the capability to host a file isn’t very impressive. However, in a moment, you will learn
how to embed Cobalt Strike URLs into a spear phishing email. When you do this, Cobalt Strike
can cross-reference visitors to your file with sent emails and include this information in the
social engineering report.
The Java Signed Applet Attack uses Cobalt Strike’s Java injector. On Windows, the Java injector
will inject shellcode for a Windows listener directly into memory for you.
To get the most mileage from this attack, you will want to download the Applet Kit from the
Cobalt Strike arsenal and sign it with a code signing certificate.
The applet analyzes its environment and decides which Java exploit to use. If the Java version is
vulnerable, the applet will disable the security sandbox, and execute a payload using Cobalt
Strike’s Java injector.
• The bitsadmin option hosts an executable and uses bitsadmin to download it. The
bitsadmin method runs the executable via cmd.exe.
• The exe option generates an executable and hosts it on Cobalt Strike's web server.
• The powershell option hosts a PowerShell script and uses powershell.exe to
download the script and evaluate it.
37
www.cobaltstrike.com
• The powershell IEX option hosts a PowerShell script and uses powershell.exe to
download the script and evaluate it. Similar to prior powershell option, but it
provides a shorter Invoke-Execution one-liner command.
• The python option hosts a Python script and uses python.exe to download the script
and run it. Each of these options is a different way to run a Cobalt Strike listener.
Here’s a screenshot of msfconsole used to stand up a Flash Exploit to deliver Cobalt Strike’s
HTTP Beacon hosted at 192.168.1.5 on port 80:
38
www.cobaltstrike.com
It’s possible to embed an attack into a cloned site. Write the URL of your attack in the Embed
field and Cobalt Strike will add it to the cloned site with an IFRAME. Click the ... button to
select one of the running client-side exploits.
Cloned websites can also capture keystrokes. Check the Log keystrokes on cloned site box. This
will insert a JavaScript key logger into the cloned site.
To view logged keystrokes or see visitors to your cloned site, go to View -> Web Log.
Before you send a phishing message, you should assemble a list of targets. Cobalt Strike expects
targets in a text file. Each line of the file contains one target. The target may be an email address.
You may also use an email address, a tab, and a name. If provided, a name helps Cobalt Strike
customize each phish.
Templates
Next, you need a phishing template. The nice thing about templates is that you may reuse them
between engagements. Cobalt Strike uses saved email messages as its templates. Cobalt Strike
39
www.cobaltstrike.com
will strip attachments, deal with encoding issues, and rewrite each template for each phishing
attack.
If you’d like to create a custom template, compose a message and send it to yourself. Most email
clients have a way to get the original message source. In Gmail, click the down arrow next to
Reply and select Show original. Save this message to a file and then congratulate yourself—
you’ve made your first Cobalt Strike phishing template.
You may want to customize your template with Cobalt Strike’s tokens. Cobalt Strike replaces the
following tokens in your templates:
Token Description
%To% The email address of the person the message is sent to
%To_Name% The name of the person the message is sent to.
%URL% The contents of the Embed URL field in the spear phishing dialog.
Sending Messages
Now that you have your targets and a template, you’re ready to go phishing. To start the spear
phishing tool, go to Attacks -> Spear Phish.
To send a phishing message, you must first import your targets. Click the folder next to the
Targets field to import your targets file.
Next, choose your template file. Click on the folder next to the Template field to choose one.
Now, you have the option to attach a file if you choose. This is a great time to use one of the
social engineering packages discussed earlier. Cobalt Strike will add your attachment to the
outgoing phishing message.
40
www.cobaltstrike.com
You may also ask Cobalt Strike to rewrite all URLs in the template with a URL of your
choosing. Paste in the URL or press ... to choose one of the tools hosted by Cobalt Strike. Cobalt
Strike tools include cloned websites, the auto-exploit server, and the system profiler.
When you embed a URL, Cobalt Strike will attach ?id=%TOKEN% to it. Each sent message will
get its own token. Cobalt Strike uses this token to map website visitors to sent emails. If you care
about reporting, be sure to keep this value in place.
Set Mail Server to an open relay or the mail exchange record for your target. If necessary, you
may also authenticate to a mail server to send your phishing messages.
Press … next to the Mail Server field to configure additional server options. You may specify a
username and password to authenticate with. The Random Delay option tells Cobalt Strike to
randomly delay each message by a random time, up to the number of seconds you specify. If this
option is not set, Cobalt Strike will not delay its messages.
Set Bounce To to an email address where bounced messages should go. This value will not affect
the message your targets see. Press Preview to see an assembled message to one of your
recipients. If the preview looks good, press Send to deliver your attack.
41
www.cobaltstrike.com
The Cobalt Strike default artifacts are likely snagged by most endpoint security solutions.
Evasion is not a goal of the default Cobalt Strike product. Cobalt Strike’s does offer flexibility.
You, the operator, may change the executables, DLLs, applets, and script templates Cobalt Strike
uses in its workflows. You may also export Cobalt Strike’s Beacon payload in a variety of
formats that work with third-party tools designed to assist with evasion.
This chapter will highlight the Cobalt Strike features that provide this flexibility.
To defeat this detection, it’s common for an attacker to obfuscate the shellcode in some way and
place it in the binary. This obfuscation process defeats anti-virus products that use a simple string
search to identify malicious code.
Many anti-virus products go a step further. These anti-virus products simulate execution of an
executable in a virtual sandbox. With each emulated step of execution, the anti-virus product
checks for known bad in the emulated process space. If known bad shows up, the anti-virus
product flags the executable or DLL as malicious. This technique defeats many encoders and
packers that try to hide known bad from signature-based anti-virus products.
Cobalt Strike’s counter to this is simple. The anti-virus sandbox has limitations. It is not a
complete virtual machine. There are system behaviors the anti-virus sandbox does not emulate.
The Artifact Kit is a collection of executable and DLL templates that rely on some behavior that
anti-virus product’s do not emulate to recover shellcode located inside of the binary.
One of the techniques [see: src-common/bypass-pipe.c in the Artifact Kit] generates executables
and DLLs that serve shellcode to themselves over a named pipe. If an anti-virus sandbox does
not emulate named pipes, it will not find the known bad shellcode.
42
www.cobaltstrike.com
Even that isn’t enough though. Some anti-virus products call home to the anti-virus vendor’s
servers. There the vendor makes a determination if the executable or DLL is known good or an
unknown, never before seen, executable or DLL. Some of these products automatically send
unknown executables and DLLs to the vendor for further analysis and warn the users. Others
treat unknown executables and DLLs as malicious. It depends on the product and its settings.
The point: no amount of “obfuscation” is going to help you in this situation. You’re up against a
different kind of defense and will need to work around it accordingly. Treat these situations the
same way you would treat application whitelisting. Try to find a known good program (e.g.,
powershell) that will get your payload stager into memory.
https://www.cobaltstrike.com/scripts
Strategic Cyber LLC distributes the Artifact Kit as a .tgz file. Use the tar command to extract it.
The Artifact Kit includes a build.sh script. Run this script on Kali Linux, with no arguments, to
build the default Artifact Kit techniques with the Minimal GNU for Windows Cross Compiler.
The Artifact Kit build script creates a folder with template artifacts for each Artifact Kit
technique. To use a technique with Cobalt Strike, go to Cobalt Strike -> Script Manager, and
load the artifact.cna script from that technique’s folder.
You’re encouraged to modify the Artifact Kit and its techniques to make it meet your needs.
While skilled C programmers can do more with the Artifact Kit, it’s quite feasible for an
43
www.cobaltstrike.com
adventurous non-programmer to work with the Artifact Kit too. For example, a major anti-virus
product likes to write signatures for the executables in Cobalt Strike’s trial each time there is a
release. Up until Cobalt Strike 2.5, the trial and licensed versions of Cobalt Strike used the
named pipe technique in its executables and DLLs. This vendor would write a signature for the
named pipe string the executable used. Defeating their signatures, release after release, was as
simple as changing the name of the pipe in the pipe technique’s source code.
Launch the Veil Evasion Framework and choose the technique you want to use. Veil will
eventually ask about shellcode. Select Veil’s option to supply custom shellcode. Paste in the
contents of the file Cobalt Strike’s payload generator made. Press enter and you will have a fresh
Veil-made executable.
Use the included build.sh script to build the Applet Kit on Kali Linux. Many Cobalt Strike
customers use this flexibility to sign Cobalt Strike’s Java Applet attacks with a code-signing
certificate that they purchased. This is highly recommended.
To make Cobalt Strike use your Applet Kit over the built-in one, load the applet.cna script
included with the Applet Kit.
44
www.cobaltstrike.com
On the Cobalt Strike Arsenal Page you will also notice the Power Applet. This is an alternate
implementation of Cobalt Strike’s Java Applet attacks that uses PowerShell to get a payload into
memory. The Power Applet demonstrates the flexibility you have to recreate Cobalt Strike’s
standard attacks in a completely different way and still use them with Cobalt Strike’s workflows.
To make Cobalt Strike use your Applet Kit over the built-in one, load the applet.cna script
included with the Applet Kit.
The README.txt supplied with the Resource Kit documents the included scripts and which
features use them. To evade a product, consider changing strings or behaviors in these scripts.
To make Cobalt Strike use your script templates over the built-in script templates, load the
resources.cna script included with the Resource Kit.
45
www.cobaltstrike.com
7. Post Exploitation
7.1 The Beacon Console
Right-click on a Beacon session and select interact to open that Beacon’s console. The console is
the main user interface for your Beacon session. The Beacon console allows you to see which
tasks were issued to a Beacon and to see when it downloads them. The Beacon console is also
where command output and other information will appear.
In between the Beacon console’s input and output is a status bar. This status bar contains
information about the current session. In its default configuration, the statusbar shows the
target’s NetBIOS name, the username and PID of the current session, and the Beacon’s last
check-in time.
Each command that’s issued to a Beacon, whether through the GUI or the console, will show up
in this window. If a teammate issues a command, Cobalt Strike will pre-fix the command with
their handle.
You will likely spend most of your time with Cobalt Strike in the Beacon console. It’s worth
your time to become familiar with its commands. Type help in the Beacon console to see
available commands. Type help followed by a command name to get detailed help.
46
www.cobaltstrike.com
Some of Cobalt Strike’s visualizations (the pivot graph and sessions table) let you select multiple
Beacons at one time. Most actions that happen through this menu will apply to all selected
Beacon sessions.
By default, Beacons check in every sixty seconds. You may change this with Beacon’s sleep
command. Use sleep followed by a time in seconds to specify how often Beacon should check in.
You may also specify a second number between 0 and 99. This number is a jitter factor. Beacon
will vary each of its check in times by the random percentage you specify as a jitter factor. For
example, sleep 300 20, will force Beacon to sleep for 300 seconds with a 20% jitter percentage.
This means, Beacon will sleep for a random value between 240s to 300s after each check-in.
To make a Beacon check in multiple times each second, try sleep 0. This is interactive mode. In
this mode commands will execute right away. You must make your Beacon interactive before
you tunnel traffic through it. A few Beacon commands (e.g., browserpivot, desktop, etc.) will
automatically put Beacon into interactive mode at the next check in.
Use the run command to execute a command without cmd.exe. The run command will post
output to you. The execute command runs a program in the background and does not capture
output.
47
www.cobaltstrike.com
Use the powershell command to execute a command with PowerShell on the compromised host.
Use the powerpick command to execute PowerShell cmdlets without powershell.exe. This
command relies on the Unmanaged PowerShell technique developed by Lee Christensen. The
powershell and powerpick commands will use your current token.
The psinject command will inject Unmanaged PowerShell into a specific process and run your
cmdlet from that location.
The powershell-import command will import a PowerShell script into Beacon. Future uses of
the powershell, powerpick, and psinject commands will have cmdlets from the imported script
available to them. Beacon will only hold one PowerShell script at a time. Import an empty file to
clear the imported script from Beacon.
The execute-assembly command will run a local .NET executable as a Beacon post-exploitation
job. You may pass arguments to this assembly as if it were run from a Windows command-line
interface. This command will also inherit your current token.
If you want Beacon to execute commands from a specific directory, use the cd command in the
Beacon console to switch the working directory of the Beacon’s process. The pwd command
will tell you which directory you’re currently working from.
Beacon can execute Beacon Object Files without creating a new process. Beacon Object Files
are compiled C programs, written to a specific convention, that run within a Beacon session. Use
inline-execute [args] to execute a Beacon Object File with the specified arguments. More
information Beacon Object Files is at:
https://www.cobaltstrike.com/help-beacon-object-files
Use the spawn command to spawn a session for a listener. The spawn command accepts an
architecture (e.g., x86, x64) and a listener as its arguments.
By default, the spawn command will spawn a session in rundll32.exe. An alert administrator
may find it strange that rundll32.exe is periodically making connections to the internet. Find a
better program (e.g., Internet Explorer) and use the spawnto command to state which program
Beacon should spawn for its sessions.
The spawnto command requires you to specify an architecture (x86 or x64) and a full path to a
program to spawn, as needed. Type spawnto by itself and press enter to instruct Beacon to go
back to its default behavior.
48
www.cobaltstrike.com
Type inject followed by a process id and a listener name to inject a session into a specific
process. Use ps to get a list of processes on the current system. Use inject [pid] x64 to inject a
64-bit Beacon into an x64 process.
The spawn and inject commands both inject a payload stage into memory. If the payload stage is
an HTTP, HTTPS, or DNS Beacon and it can’t reach you—you will not see a session. If the
payload stage is a bind TCP or SMB Beacon, these commands will automatically try to link to
and assume control of these payloads.
Use the shinject [pid] [architecture] [/path/to/file.bin] command to inject shellcode, from a
local file, into a process on target. Use shspawn [architecture] [/path/to/file.bin] to spawn the
“spawn to” process and inject the specified shellcode file into that process.
The runu command will execute a command with another process as the parent. This command
will run with the rights and desktop session of its alternate parent process. The current Beacon
session must have full rights to the alternate parent. The spawnu command will spawn a
temporary process, as a child of a specified process, and inject a Beacon payload stage into it.
The spawnto value controls which program is used as a temporary process.
1. Starts the matched process in a suspended state (with the fake arguments)
2. Updates the process memory with the real arguments
3. Resumes the process
The effect is that host instrumentation recording a process launch will see the fake arguments.
This helps mask your real activity.
Use argue [command] [fake arguments] to add a command to this internal list. The [command]
portion may contain an environment variable. Use argue [command] to remove a command
from this internal list. argue, by itself, lists the commands in this internal list.
The process match logic is exact. If Beacon tries to launch “net.exe”, it will not match net,
NET.EXE, or c:\windows\system32\net.exe from its internal list. It will only match net.exe.
49
www.cobaltstrike.com
x86 Beacon can only spoof arguments in x86 child processes. Likewise, x64 Beacon can only
spoof arguments in x64 child processes.
The real arguments are written to the memory space that holds the fake arguments. If the real
arguments are longer than the fake arguments, the command launch will fail.
Type downloads to see a list of file downloads in progress for the current Beacon. Use the
cancel command, followed by a filename, to cancel a download that’s in progress. You may use
wildcards with your cancel command to cancel multiple file downloads at once.
Go to View -> Downloads in Cobalt Strike to see the files that your team has downloaded so far.
Only completed downloads will show up in this tab. Downloaded files are stored on the team
server. To bring files back to your system, highlight them here, and press Sync Files. Cobalt
Strike will then download the selected files to a folder of your choosing on your system.
When you upload a file, you will sometimes want to update its timestamps to make it blend in
with other files in the same folder. Use the timestomp command to do this. The timestomp
command will match the Modified, Accessed, and Created times of one file to another file.
The file browser will request a listing for the current working directory of Beacon. When this
result arrives, the file browser will populate.
The left-hand side of the file browser is a tree which organizes the known drives and folders into
one view. The right-hand side of the file browser shows the contents of the current folder.
50
www.cobaltstrike.com
Each file browser caches the folder listings it receives. A colored folder indicates the folder’s
contents are in this file browser’s cache. You may navigate to cached folders without generating
a new file listing request. Press Refresh to ask Beacon to update the contents of the current
folder.
A dark-grey folder means the folder’s contents are not in this file browser’s cache. Click on a
folder in the tree to have Beacon generate a task to list the contents of this folder (and update its
cache). Double-click on a dark-grey folder in the right-hand side current folder view to do the
same.
To go up a folder, press the folder button next to the file path above the right-hand side folder
details view. If the parent folder is in this file browser’s cache, you will see the results
immediately. If the parent folder is not in the file browser’s cache, the browser will generate a
task to list the contents of the parent folder.
51
www.cobaltstrike.com
To start the keystroke logger, use keylogger pid x86 to inject into an x86 process. Use keylogger
pid x64 to inject into an x64 process. Use keylogger by itself to inject the keystroke logger into a
temporary process. The keystroke logger will monitor keystrokes from the injected process and
report them to Beacon until the process terminates or you kill the keystroke logger post-
exploitation job.
Be aware that multiple keystroke loggers may conflict with each other. Use only one keystroke
logger per desktop session.
To take a screenshot, use screenshot pid x86 to inject the screenshot tool into an x86 process.
Use screenshot pid x64 to inject into an x64 process. This variant of the screenshot command
will take one screenshot and exit. screenshot, by itself, will inject the screenshot tool into a
temporary process.
The screenwatch command (with options to use a temporary process or inject into an explicit
process) will continuously take screenshots until you stop the screenwatch post-exploitation job.
Use the printscreen command (also with temporary process and inject options) to take a
screenshot by a different method. This command uses a PrintScr keypress to place the screenshot
onto the user's clipboard. This feature recovers the screenshot from the clipboard and reports it
back to you.
When Beacon receives new screenshots or keystrokes, it will post a message to the Beacon
console. The screenshot and keystroke information is not available through the Beacon console
though. Go to View -> Keystrokes to see logged keystrokes across all of your Beacon sessions.
Go to View -> Screenshots to browse through screenshots from all of your Beacon sessions.
Both of these dialogs update as new information comes in. These dialogs make it easy for one
operator to monitor keystrokes and screenshots on all of your Beacon sessions.
The right-hand side shows the process details. The Process Browser is also a convenient place to
impersonate a token from another process, deploy the screenshot tool, or deploy the keystroke
logger. Highlight one or more processes and press the appropriate button at the bottom of the tab.
52
www.cobaltstrike.com
If you highlight multiple Beacons and task them to show processes, Cobalt Strike will show a
Process Browser that also states which host the process comes from. This variant of the Process
Browser is a convenient way to deploy Beacon’s post-exploitation tools to multiple systems at
once. Simply sort by process name, highlight the interesting processes on your target systems,
and press the Screenshot or Log Keystrokes button to deploy these tools to all highlighted
systems.
When the VNC server is ready, Cobalt Strike will open a tab labeled Desktop HOST@PID.
You may also use Beacon’s desktop command to inject a VNC server into a specific process.
Use desktop pid architecture low|high. The last parameter let’s you specify a quality for the
VNC session.
53
www.cobaltstrike.com
The bottom of the desktop tab has several buttons. These are:
Decrease Zoom
Increase Zoom
Zoom to 100%
Adjust Zoom to Fit Tab
Send Ctrl+Escape
Lock the Ctrl key
Lock the Alt key
If you can’t type in a Desktop tab, check the state of the Ctrl and Alt buttons. When either
button is pressed, all of your keystrokes are sent with the Ctrl or Alt modifier. Press the Ctrl or
Alt button to turn off this behavior. Make sure View only isn’t pressed either. To prevent you
from accidentally moving the mouse, View only is pressed by default.
54
www.cobaltstrike.com
Use runasadmin, by itself, to list command elevator exploits registered with Cobalt Strike. Run
runasadmin [exploit] [command + args] to attempt to run the specified command in an elevated
context.
Cobalt Strike separates command elevator exploits and session-yielding exploits because some
attacks are a natural opportunity to spawn a session. Other attacks yield a “run this command”
primitive. Spawning a session from a “run this command” primitive puts a lot of weaponization
decisions (not always favorable) in the hands of your tool developer. With runasadmin, it’s your
choice to drop an executable to disk and run it, to run a PowerShell one-liner, or to weaken the
target in some way.
If you’d like to use a PowerShell one-liner to spawn a session, go to [session] -> Access -> One-
liner. This dialog will setup a localhost-only webserver within your Beacon session to host a
payload stage and return a PowerShell command to download and run this payload stage. This
webserver is one-use only. Once it’s connected to once, it will clean itself up and stop serving
your payload. If you run a TCP or SMB Beacon with this tool, you will need to use connect or
link to assume control of the payload manually. Also, be aware that if you try to use an x64
payload—this will fail if the x86 PowerShell is in your $PATH.
Cobalt Strike does not have many built-in elevate options. Exploit development is not a focus of
the work at Strategic Cyber LLC. It is easy to integrate privilege escalation exploits via Cobalt
Strike’s Aggressor Script programming language though. To see what this looks like, download
the Elevate Kit. The Elevate Kit is an Aggressor Script that integrates several open source
privilege escalation exploits into Cobalt Strike. https://github.com/rsmudge/ElevateKit
55
www.cobaltstrike.com
Use spawnas [DOMAIN\user] [password] [listener] to spawn a session as another user using
their credentials. This command spawns a temporary process and injects your payload stage into
it. You may also go to [beacon] -> Access -> Spawn As to run this command as well.
With both of these commands, be aware that credentials for a non-SID 500 account will spawn a
payload in a medium integrity context. You will need to use Bypass UAC to elevate to a high
integrity context. Also, be aware, that you should run these commands from a working folder
that the specified account can read.
Get SYSTEM
Use getsystem to impersonate a token for the SYSTEM account. This level of access may allow
you to perform privileged actions that are not possible as an Administrator user.
Another way to get SYSTEM is to create a service that runs a payload. The elevate svc-exe
[listener] command does this. It will drop an executable that runs a payload, create a service to
run it, assume control of the payload, and cleanup the service and executable.
UAC Bypass
Microsoft introduced User Account Control (UAC) in Windows Vista and refined it in Windows
7. UAC works a lot like sudo in UNIX. Day-to-day a user works with normal privileges. When
the user needs to perform a privileged action—the system asks if they would like to elevate their
rights.
Cobalt Strike ships with a few UAC bypass attacks. These attacks will not work if the current
user is not an Administrator. To check if the current user is in the Administrators group, use run
whoami /groups.
elevate uac-token-duplication [listener] will spawn a temporary process with elevated rights
and inject a payload stage into it. This attack uses a UAC-loophole that allows a non-elevated
process to launch an arbitrary process with a token stolen from an elevated process. This
loophole requires the attack to remove several rights assigned to the elevated token. The abilities
of your new session will reflect these restricted rights. If Always Notify is at its highest setting,
this attack requires that an elevated process is already running in the current desktop session (as
the same user). This attack works on Windows 7 and Windows 10 prior to the November 2018
update.
runasadmin uac-token-duplication [command] is the same attack described above, but this
variant runs a command of your choosing in an elevated context.
runasadmin uac-cmstplua [command] will attempt to bypass UAC and run a command in an
elevated context. This attack relies on a COM object that automatically elevates from certain
process contexts (Microsoft signed, lives in c:\windows\*).
56
www.cobaltstrike.com
Privileges
Type getprivs to enable the privileges assigned to your current access token.
7.18 Mimikatz
Beacon integrates mimikatz. Use the mimikatz command to pass any command to mimikatz’s
command dispatcher. For example, mimikatz standard::coffee will give you a cup of coffee.
Beacon will take care to inject a mimikatz instance that matches the native architecture of your
target.
Some mimikatz commands must run as SYSTEM to work. Prefix a command with a ! to force
mimikatz to elevate to SYSTEM before it runs your command. For example, mimikatz
!lsa::cache will recover salted password hashes cached by the system.
Once in awhile, you may need to run a mimikatz command with Beacon’s current access token.
Prefix a command with a @ to force mimikatz to impersonate Beacon’s current access token. For
example, mimikatz @lsadump::dcsync will run the dcsync command in mimikatz with
Beacon’s current access token.
The logonpasswords command will use mimikatz to recover plaintext passwords and hashes for
users who are logged on to the current system. The logonpasswords command is the same as
[beacon] -> Access -> Run Mimikatz.
Use dcsync [DOMAIN.FQDN] to pull password hashes for all accounts from a domain
controller. This technique uses Windows APIs built to sync information between domain
controllers. It requires a domain administrator trust relationship. Beacon uses mimikatz to
execute this technique. Use dcsync [DOMAIN.FQDN] [DOMAIN\user], if you want a specific
password hash.
Credentials dumped with the above commands are collected by Cobalt Strike and stored in the
credentials data model. Go to View -> Credentials to pull up the credentials on the current team
server.
There are three target discovery options. The arp method uses an ARP request to discover if a
host is alive or not. The icmp method sends an ICMP echo request to check if a target is alive.
The none option tells the portscan tool to assume that all hosts are alive.
57
www.cobaltstrike.com
The port scanner will run, in between Beacon check ins. When it has results to report, it will send
them to the Beacon console. Cobalt Strike will process this information and update the targets
model with the discovered hosts.
The commands in Beacon’s net module are built on top of the Windows Network Enumeration
APIs. Most of these commands are direct replacements for many of the built-in net commands in
Windows. There are also a few unique capabilities here as well. For example, use net localgroup
\\TARGET to list the groups on another system. Use net localgroup \\TARGET group name to
list the members of a group on another system. These commands are great during lateral
movement when you have to find who is a local admin on another system.
Use help net to get a list of all the commands in Beacon’s net module. Use help net command
to get help for each individual command.
Use steal_token [process id] to impersonate a token from an existing process. If you’d like to
see which processes are running use ps. The getuid command will print your current token. Use
rev2self to revert back to your original token.
If you know credentials for a user; use make_token [DOMAIN\user] [password] to generate a
token that passes these credentials. This token is a copy of your current token with modified
single sign-on information. It will show your current username. This is expected behavior.
Use mimikatz to pass-the-hash with Beacon. The Beacon command pth [DOMAIN\user] [ntlm
hash] will create and impersonate an access token to pass the specified hash.
Beacon’s Make Token dialog ([beacon] -> Access -> Make Token) is a front-end for these
commands. It will present the contents of the credential model and it will use the right command
to turn the selected credential entry into an access token.
Kerberos Tickets
Use kerberos_ticket_use [/path/to/ticket] to inject a Kerberos ticket into the current session.
This will allow Beacon to interact with remote systems using the rights in this ticket. Try this
with a Golden Ticket generated by mimikatz 2.0.
58
www.cobaltstrike.com
Use kerberos_ticket_purge to clear any kerberos tickets associated with your session.
Type jump to list lateral movement options registered with Cobalt Strike. Run jump [module]
[target] [listener] to attempt to run a payload on a remote target.
Run remote-exec, by itself, to list remote execution modules registered with Cobalt Strike. Use
remote-exec [module] [target] [command + args] to attempt to run the specified command on
a remote target.
Lateral movement is an area, similar to privilege escalation, where some attacks present a natural
set of primitives to spawn a session on a remote target. Some attacks give an execute-primitive
only. The split between jump and remote-exec gives you flexibility to decide how to weaponize
an execute-only primitive.
Aggressor Script has an API to add new modules to jump and remote-exec. See the Aggressor
Script documentation (the Beacon chapter, specifically) for more information.
59
www.cobaltstrike.com
First, decide which trust you want to use for lateral movement. If you want to use the token in
one of your Beacons, check the Use session’s current access token box. If you want to use
credentials or hashes for lateral movement—that’s OK too. Select credentials from the credential
store or populate the User, Password, and Domain fields. Beacon will use this information to
generate an access token for you. Keep in mind, you need to operate from a high integrity
context [administrator] for this to work.
Next, choose the listener to use for lateral movement. The SMB Beacon is usually a good
candidate here.
Last, select which session you want to perform the lateral movement attack from. Cobalt Strike’s
asynchronous model of offense requires each attack to execute from a compromised system.
There is no option to perform this attack without a Beacon session to attack from. If you’re on an
internal engagement, consider hooking a Windows system that you control and use that as your
starting point to attack other systems with credentials or hashes.
Press Launch. Cobalt Strike will activate the tab for the selected Beacon and issue commands to
it. Feedback from the attack will show up in the Beacon console.
60
www.cobaltstrike.com
8. Browser Pivoting
8.1 Overview
Malware like Zeus and its variants inject themselves into a user’s browser to steal banking
information. This is a man-in-the-browser attack. So-called, because the attacker is injecting
malware into the target’s browser.
Man-in-the-browser malware uses two approaches to steal banking information. They either
capture form data as it’s sent to a server. For example, malware might hook PR_Write in Firefox
to intercept HTTP POST data sent by Firefox. Or, they inject JavaScript onto certain
webpages to make the user think the site is requesting information that the attacker needs.
Cobalt Strike offers a third approach for man-in-the-browser attacks. It lets the attacker hijack
authenticated web sessions—all of them. Once a user logs onto a site, an attacker may ask the
user’s browser to make requests on their behalf. Since the user’s browser is making the request,
it will automatically re-authenticate to any site the user is already logged onto. I call this a
browser pivot—because the attacker is pivoting their browser through the compromised user’s
browser.
Cobalt Strike’s implementation of browser pivoting for Internet Explorer injects an HTTP proxy
server into the compromised user’s browser. Do not confuse this with changing the user’s proxy
settings. This proxy server does not affect how the user gets to a site. Rather, this proxy server is
available to the attacker. All requests that come through it are fulfilled by the user’s browser.
61
www.cobaltstrike.com
8.2 Setup
To setup Browser pivoting, go to [beacon] -> Explore -> Browser Pivot. Choose the Internet
Explorer instance that you want to inject into. You may also decide which port to bind the
browser pivoting proxy server to as well.
Beware that the process you inject into matters a great deal. Inject into Internet Explorer to
inherit a user’s authenticated web sessions. Modern versions of Internet Explorer spawn each tab
in its own process. If your target uses a modern version of Internet Explorer, you must inject a
process associated with an open tab to inherit session state. Which tab process doesn’t matter
(child tabs share session state). Identify Internet Explorer tab processes by looking at the PPID
value in the Browser Pivoting setup dialog. If the PPID references explorer.exe, the process is
not associated with a tab. If the PPID references iexplore.exe, the process is associated with a
tab. Cobalt Strike will show a checkmark next to the processes it thinks you should inject into.
Once Browser Pivoting is setup, set up your web browser to use the Browser Pivot Proxy server.
Remember, Cobalt Strike’s Browser Pivot server is an HTTP proxy server.
62
www.cobaltstrike.com
8.3 Use
You may browse the web as your target user once browser pivoting is started. Beware that the
browser pivoting proxy server will present its SSL certificate for SSL-enabled websites you visit.
This is necessary for the technology to work.
The browser pivoting proxy server will ask you to add a host to your browser’s trust store when
it detects an SSL error. Add these hosts to the trust store and press refresh to make SSL protected
sites load properly.
If your browser pins the certificate of a target site, you may find its impossible to get your
browser to accept the browser pivoting proxy server’s SSL certificate. This is a pain. One option
is to use a different browser. The open source Chromium browser has a command-line option to
ignore all certificate errors. This is ideal for browser pivoting use:
The above command is available from View -> Proxy Pivots. Highlight the Browser Pivot
HTTP Proxy entry and press Tunnel.
To stop the Browser Pivot proxy server, type browserpivot stop in its Beacon console.
You will need to reinject the browser pivot proxy server if the user closes the tab you’re working
from. The Browser Pivot tab will warn you when it can’t connect to the browser pivot proxy
server in the browser.
63
www.cobaltstrike.com
9. Pivoting
9.1 What is Pivoting
Pivoting, for the sake of this manual, is turning a compromised system into a hop point for other
attacks and tools. Cobalt Strike’s Beacon provides several pivoting options. For each of these
options, you will want to make sure your Beacon is in interactive mode. Interactive mode is
when a Beacon checks in multiple times each second. Use the sleep 0 command to put your
Beacon into interactive mode.
All connections that go through these SOCKS servers turn into connect, read, write, and close
tasks for the associated Beacon to execute. You may tunnel via SOCKS through any type of
Beacon (even an SMB Beacon).
Beacon’s HTTP data channel is the most responsive for pivoting purposes. If you’d like to pivot
traffic over DNS, use the DNS TXT record communication mode.
To see the SOCKS servers that are currently setup, go to View -> Proxy Pivots.
Proxychains
The proxychains tool will force an external program to use a SOCKS proxy server that you
designate. You may use proxychains to force third-party tools through Cobalt Strike’s SOCKS
server. To learn more about proxychains, visit:
• http://proxychains.sourceforge.net/
Metasploit
You may also tunnel Metasploit Framework exploits and modules through Beacon. Create a
Beacon SOCKS proxy server [as described above] and paste the following into your Metasploit
Framework console:
These commands will instruct the Metasploit Framework to apply your Proxies option to all
modules executed from this point forward. Once you’re done pivoting through Beacon in this
way, use unsetg Proxies to stop this behavior.
64
www.cobaltstrike.com
If you find the above tough to remember, go to View -> Proxy Pivots. Highlight the proxy pivot
you setup and press Tunnel. This button will provide the setg Proxies syntax needed to tunnel
the Metasploit Framework through your Beacon.
Use the rportfwd_local command to setup a reverse pivot through Beacon with one variation.
This feature initiates a connection to the forward host/port from your Cobalt Strike client. The
forwarded traffic is communicated through the connection your Cobalt Strike client has to its
team server.
Use rportfwd stop [bind port] to disable the reverse port forward.
https://www.coresecurity.com/products/core-impact
65
www.cobaltstrike.com
The above will generate a Core Impact agent as a raw file. You may use spunnel x64 or
spunnel_local x64 to run this agent and tunnel it back to Core Impact.
We often use Cobalt Strike on an internet reachable infrastructure and Core Impact is often on a
local Windows virtual machine. It's for this reason we have spunnel_local. We recommend that
you run a Cobalt Strike client from the same Windows system that Core Impact is installed onto.
In this setup, you can run spunnel_local x64 127.0.0.1 9000 c:\path\to\agent.bin. Once the
connection is made, you will hear the famous "Agent Deployed" wav file. With an Impact agent
on target, you have tools to escalate privileges, scan and information gather via many modules,
launch remote exploits, and chain other Impact agents through your Beacon connection.
To setup a pivot listener, go to [beacon] -> Pivoting -> Listener…. This will open a dialog
where you may define a new pivot listener.
A pivot listener will bind to Listen Port on the specified Session. The Listen Host value
configures the address your reverse TCP payload will use to connect to this listener.
Pivot Listeners do not change the pivot host’s firewall configuration. If a pivot host has a host-
based firewall, this may interfere with your listener. You, the operator, are responsible for
anticipating this situation and taking the right steps for it.
66
www.cobaltstrike.com
To remove a pivot listener, go to Cobalt Strike -> Listeners and remove the listener there.
Cobalt Strike will send a task to tear down the listening socket, if the session is still reachable.
To activate Covert VPN, right-click a compromised host, go to [beacon] -> Pivoting -> Deploy
VPN. Select the remote interface you would like Covert VPN to bind to. If no local interface is
present, press Add to create one.
Check Clone host MAC address to make your local interface have the same MAC address as the
remote interface. It’s safest to leave this option checked.
Press Deploy to start the Covert VPN client on the target. Covert VPN requires Administrator
access to deploy.
Once a Covert VPN interface is active, you may use it like any physical interface on your
system. Use ifconfig to configure its IP address. If your target network has a DHCP server, you
may request an IP address from it using your operating systems built-in tools.
To manage your Covert VPN interfaces, go to Cobalt Strike -> Interfaces. Here, Cobalt Strike
will show the Covert VPN interfaces, how they’re configured, and how many bytes were
transmitted and received through each interface.
Highlight an interface and press Remove to destroy the interface and close the remote Covert
VPN client. Covert VPN will remove its temporary files on reboot and it automatically undoes
any system changes right away.
67
www.cobaltstrike.com
Covert VPN interfaces consist of a network tap and a channel to communicate 68thernet frames
through. To configure the interface, choose an Interface name (this is what you will manipulate
through ifconfig later) and a MAC address.
You must also configure the Covert VPN communication channel for your interface. Covert
VPN may communicate Ethernet frames over a UDP connection, TCP connection, ICMP, or
using the HTTP protocol. The TCP (Reverse) channel has the target connect to your Cobalt
Strike instance. The TCP (Bind) channel has Cobalt Strike tunnel the VPN through Beacon.
Cobalt Strike will setup and manage communication with the Covert VPN client based on the
Local Port and Channel you select.
The Covert VPN HTTP channel makes use of the Cobalt Strike web server. You may host other
Cobalt Strike web applications and multiple Covert VPN HTTP channels on the same port.
For best performance, use the UDP channel. The UDP channel has the least amount of overhead
compared to the TCP and HTTP channels. Use the ICMP, HTTP, or TCP (Bind) channels if you
need to get past a restrictive firewall.
While Covert VPN has a flexibility advantage, your use of a VPN pivot over a proxy pivot will
depend on the situation. Covert VPN requires Administrator access. A proxy pivot does not.
Covert VPN creates a new communication channel. A proxy pivot does not. You should use a
proxy pivot initially and move to a VPN pivot when it’s needed.
68
www.cobaltstrike.com
Use ssh [target] [user] [password] to launch an SSH session from a Beacon. You may also use
ssh-key [target] [user] [/path/to/key.pem] to authenticate with a key.
These commands run Cobalt Strike’s SSH client. The client will report any connection or
authentication issues to the parent Beacon. If the connection succeeds, you will see a new session
in Cobalt Strike’s display. This is an SSH session. Right-click on this session and press Interact
to open the SSH console.
Type help to see a list of commands the SSH session supports. Type help followed by a
command name for details on that command.
Use sudo [password] [command + arguments] to attempt to run a command via sudo. This
alias requires the target’s sudo to accept the –S flag.
The cd command will change the current working directory for the SSH session. The pwd
command reports the current working directory.
10.4 Peer-to-peer C2
SSH sessions can control TCP Beacons. Use the connect command to assume control of a TCP
Beacon waiting for a connection. Use unlink to disconnect a TCP Beacon session.
Go to [session] -> Listeners -> Pivot Listener… to setup a pivot listener tied to this SSH
session. This will allow this compromised UNIX target to receive reverse TCP Beacon sessions.
This option does require that the SSH daemon’s GatewayPorts option is set to yes or
ClientSpecified.
69
www.cobaltstrike.com
There is one caveat to rportfwd: the rportfwd command asks the SSH daemon to bind to all
interfaces. It’s quite likely the SSH daemon will override this and force the port to bind to
localhost. You need to change the GatewayPorts option for the SSH daemon to yes or
clientspecified.
70
www.cobaltstrike.com
To use a custom profile, you must start a Cobalt Strike team server and specify your profile at
that time.
You may only load one profile per Cobalt Strike instance.
./c2lint [/path/to/my.profile]
• https://github.com/rsmudge/Malleable-C2-Profiles
# this is a comment
set global_option "value";
protocol-transaction {
set local_option "value";
client {
# customize client indicators
}
server {
# customize server indicators
}
}
71
www.cobaltstrike.com
Comments begin with a # and go until the end of the line. The set statement is a way to assign a
value to an option. Profiles use { curly braces } to group statements and information together.
Statements always end with a semi-colon.
http-get {
set uri "/foobar";
client {
metadata {
base64;
prepend "user=";
header "Cookie";
}
}
This partial profile defines indicators for an HTTP GET transaction. The first statement, set uri,
assigns the URI that the client and server will reference during this transaction. This set
statement occurs outside of the client and server code blocks because it applies to both of them.
The client block defines indicators for the client that performs an HTTP GET. The client, in this
case, is Cobalt Strike’s Beacon payload.
When Cobalt Strike’s Beacon “phones home” it sends metadata about itself to Cobalt Strike. In
this profile, we have to define how this metadata is encoded and sent with our HTTP GET
request.
The metadata keyword followed by a group of statements specifies how to transform and embed
metadata into our HTTP GET request. The group of statements, following the metadata keyword,
is called a data transform.
The first statement in our data transform states that we will base64 encode our metadata [1]. The
second statement, prepend, takes our encoded metadata and prepends the string user= to it [2].
Now our transformed metadata is “user=“ . base64(metadata). The third statement states we will
store our transformed metadata into a client HTTP header called Cookie [3]. That’s it.
Both Beacon and its server consume profiles. Here, we’ve read the profile from the perspective
of the Beacon client. The Beacon server will take this same information and interpret it
72
www.cobaltstrike.com
backwards. Let’s say our Cobalt Strike web server receives a GET request to the URI /foobar.
Now, it wants to extract metadata from the transaction.
The header statement will tell our server where to recover our transformed metadata from [1].
The HTTP server takes care to parse headers from the HTTP client for us. Next, we need to deal
with the prepend statement. To recover transformed data, we interpret prepend as remove the
first X characters [2], where X is the length of the original string we prepended. Now, all that’s
left is to interpret the last statement, base64. We used a base64 encode function to transform the
metadata before. Now, we use a base64 decode to recover the metadata [3].
We will have the original metadata once the profile interpreter finishes executing each of these
inverse statements.
A data transform is a combination of any number of these statements, in any order. For example,
you may choose to netbios encode the data to transmit, prepend some information, and then
base64 encode the whole package.
A data transform always ends with a termination statement. You may only use one termination
statement in a transform. This statement tells Beacon and its server where in the transaction to
store the transformed data.
73
www.cobaltstrike.com
Statement What
header “header” Store data in an HTTP header
parameter “key” Store data in a URI parameter
print Send data as transaction body
uri-append Append to URI
The header termination statement stores transformed data in an HTTP header. The parameter
termination statement stores transformed data in an HTTP parameter. This parameter is always
sent as part of URI. The print statement sends transformed data in the body of the transaction.
The print statement is the expected termination statement for the http-get.server.output, http-
post.server.output, and http-stager.server.output blocks. You may use the header, parameter,
print and uri-append termination statements for the other blocks.
These blocks and the data they send are described in a later section.
Strings
Beacon’s Profile Language allows you to use “strings” in several places. In general, strings are
interpreted as-is. However, there are a few special values that you may use in a string:
In an HTTP GET or POST request, these extraneous indicators come in the form of headers or
parameters. Use the parameter statement within the client block to add an arbitrary parameter to
an HTTP GET or POST transaction.
74
www.cobaltstrike.com
This code will force Beacon to add ?bar=blah to the /foobar URI when it makes a request.
http-get {
client {
parameter "bar" "blah";
Use the header statement within the client or server blocks to add an arbitrary HTTP header to
the client’s request or server’s response. This header statement adds an indicator to put network
security monitoring teams at ease.
http-get {
server {
header "X-Not-Malware" "I promise!";
The Profile Interpreter will Interpret your header and parameter statements In order. That said,
the WinINet library (client) and Cobalt Strike web server have the final say about where in the
transaction these indicators will appear.
Options
You may configure Beacon’s defaults through the profile file. There are two types of options:
global and local options. The global options change a global Beacon setting. Local options are
transaction specific. You must set local options in the right context. Use the set statement to set
an option.
75
www.cobaltstrike.com
With the uri option, you may specify multiple URIs as a space separated string. Cobalt Strike’s
web server will bind all of these URIs and it will assign one of these URIs to each Beacon host
when the Beacon stage is built.
Even though the useragent option exists; you may use the header statement to override this
option.
http-stager {
set uri_x86 "/get32.gif";
set uri_x64 "/get64.gif";
The uri_x86 option sets the URI to download the x86 payload stage. The uri_x64 option sets the
URI to download the x64 payload stage.
76
www.cobaltstrike.com
client {
parameter "id" "1234";
header "Cookie" "SomeValue";
}
The client keyword under the context of http-stager defines the client side of the HTTP
transaction. Use the parameter keyword to add a parameter to the URI. Use the header keyword
to add a header to the stager’s HTTP GET request.
server {
header "Content-Type" "image/gif";
output {
prepend "GIF89a";
print;
}
}
}
The server keyword under the context of http-stager defines the server side of the HTTP
transaction. The header keyword adds a server header to the server’s response. The output
keyword under the server context of http-stager is a data transform to change the payload stage.
This transform may only prepend and append strings to the stage. Use the print termination
statement to close this output block.
A transaction starts when a Beacon makes an HTTP GET request to Cobalt Strike’s web server.
At this time, Beacon must send metadata that contains information about the compromised
system.
Tip: session metadata is an encrypted blob of data. Without encoding, it is not suitable
for transport in a header or URI parameter. Always apply a base64, base64url, or
netbios statement to encode your metadata.
Cobalt Strike’s web server responds to this HTTP GET with tasks that the Beacon must execute.
These tasks are, initially, sent as one encrypted binary blob. You may transform this information
with the output keyword under the server context of http-get.
As Beacon executes its tasks, it accumulates output. After all tasks are complete, Beacon checks
if there is output to send. If there is no output, Beacon goes to sleep. If there is output, Beacon
initiates an HTTP POST transaction.
77
www.cobaltstrike.com
The HTTP POST request must contain a session id in a URI parameter or header. Cobalt Strike
uses this information to associate the output with the right session. The posted content is,
initially, an encrypted binary blob. You may transform this information with the output keyword
under the client context of http-post.
Cobalt Strike’s web server may respond to an HTTP POST with anything it likes. Beacon does
not consume or use this information. You may specify the output of HTTP POST with the
output block under the server context of http-post.
Note: while http-get uses GET by default and http-post uses POST by default, you’re not
stuck with these options. Use the verb option to change these defaults. There’s a lot of
flexibility here.
This table summarizes these keywords and the data they send:
78
www.cobaltstrike.com
http-config {
set headers "Date, Server, Content-Length, Keep-Alive,
Connection, Content-Type";
header "Server" "Apache";
header "Keep-Alive" "timeout=5, max=100";
header "Connection" "Keep-Alive”;
The header keyword adds a header value to each of Cobalt Strike’s HTTP responses. If the
header value is already defined in a response, this value is ignored.
The set headers option specifies the order these HTTP headers are delivered in an HTTP
response. Any headers not in this list are added to the end.
The set trust_x_forwarded_for option decides if Cobalt Strike uses the X-Forwarded-For
HTTP header to determine the remote address of a request. Use this option if your Cobalt Strike
server is behind an HTTP redirector.
The block_useragents option allows configuring a list of user agents that are blocked with a 404
response. By default, requests from user agents that start with curl, lynx, or wget are all blocked.
The field supports a string of comma separated values. Values support simple generics:
Example Description
not specified Use the default value (curl*,lynx*,wget*). Block requests
from user agents starting with curl, lynx, or wget.
blank No user agents are blocked
something Block requests with useragent equal 'something'
something* Block requests with useragent starting with 'something'
*something Block requests with useragent ending with 'something'
*something* Block requests with useragent containing 'something'
https-certificate {
79
www.cobaltstrike.com
set CN "bobsmalware.com";
set O "Bob’s Malware";
}
https-certificate {
set keystore "domain.store";
set password "mypassword";
}
Here are the steps to create a Valid SSL certificate for use with Cobalt Strike’s Beacon:
1. Use the keytool program to create a Java Keystore file. This program will ask “What is your
first and last name?” Make sure you answer with the fully qualified domain name to your Beacon
server. Also, make sure you take note of the keystore password. You will need it later.
2. Use keytool to generate a Certificate Signing Request (CSR). You will submit this file to your
SSL certificate vendor. They will verify that you are who you are and issue a certificate. Some
vendors are easier and cheaper to deal with than others.
80
www.cobaltstrike.com
3. Import the Root and any Intermediate Certificates that your SSL vendor provides.
And, that’s it. You now have a Java Keystore file that’s ready to use with Cobalt Strike’s
Beacon.
A variant block is specified as [block name] “variant name” { … }. Here’s a variant http-get
block named “My Variant”:
A variant block creates a copy of the current profile with the specified variant blocks replacing
the default blocks in the profile itself. Each unique variant name creates a new variant profile.
You may populate a profile with as many variant names as you like.
Variants are selectable when configuring an HTTP or HTTPS Beacon listener. Variants allow
each HTTP or HTTPS Beacon listener tied to a single team server to have network IOCs that
differ from eachother.
code-signer {
set keystore "keystore.jks";
set password "password";
set alias "server";
}
81
www.cobaltstrike.com
dns-beacon "optional-variant-name" {
# Options moved into 'dns-beacon' group in 4.3:
set dns_idle "1.2.3.4";
set dns_max_txt "199";
set dns_sleep "1";
set dns_ttl "5";
set maxdns "200";
set dns_stager_prepend "doc-stg-prepend";
set dns_stager_subhost "doc-stg-sh.";
82
www.cobaltstrike.com
You can use ns_response when a DNS server is responding to a target with "Server failure"
errors. A public DNS Resolver may be initiating NS record requests that the DNS Server in
Cobalt Strike Team Server is dropping by default.
1. Each Cobalt Strike instance uses one profile at a time. If you change a profile or load a new
profile, previously deployed Beacons cannot communicate with you.
2. Always stay aware of the state of your data and what a protocol will allow when you develop a
data transform. For example, if you base64 encode metadata and store it in a URI parameter—
it’s not going to work. Why? Some base64 characters (+, =, and /) have special meaning in a
URL. The c2lint tool and Profile Compiler will not detect these types of problems.
3. Always test your profiles, even after small changes. If Beacon can’t communicate with you,
it’s probably an issue with your profile. Edit it and try again.
4. Trust the c2lint tool. This tool goes above and beyond the profile compiler. The checks are
grounded in how this technology is implemented. If a c2lint check fails, it means there is a real
problem with your profile.
83
www.cobaltstrike.com
stage {
set userwx "false";
set compile_time "14 Jul 2009 8:14:00";
set image_size_x86 "512000";
set image_size_x64 "512000";
set obfuscate "true";
transform-x86 {
prepend "\x90\x90";
strrep "ReflectiveLoader" "DoLegitStuff";
}
transform-x64 {
# transform the x64 rDLL stage
}
The transform-x86 and transform-x64 blocks pad and transform Beacon’s Reflective DLL
stage. These blocks support three commands: prepend, append, and strrep.
The prepend command inserts a string before Beacon’s Reflective DLL. The append command
adds a string after the Beacon Reflective DLL. Make sure that prepended data is valid code for
the stage’s architecture (x86, x64). The c2lint program does not have a check for this. The strrep
command replaces a string within Beacon’s Reflective DLL.
The stage block accepts commands that add strings to the .rdata section of the Beacon DLL. The
string command adds a zero-terminated string. The stringw command adds a wide (UTF-16LE
encoded) string. The data command adds your string as-is.
84
www.cobaltstrike.com
The stage block accepts several options that control the Beacon DLL content and provide hints to
change the behavior of Beacon’s Reflective Loader:
Option Example Description
allocator HeapAlloc Set how Beacon's Reflective Loader allocates
memory for the agent. Options are: HeapAlloc,
MapViewOfFile, and VirtualAlloc.
cleanup false Ask Beacon to attempt to free memory
associated with the Reflective DLL package that
initialized it.
magic_mz_x86 MZRE Override the first bytes (MZ header included) of
Beacon's Reflective DLL. Valid x86 instructions
are required. Follow instructions that change
CPU state with instructions that undo the
change.
magic_mz_x64 MZAR Same as magic_mz_x86; affects x64 DLL
magic_pe PE Override the PE character marker used by
Beacon's Reflective Loader with another value.
module_x86 xpsservices.dll Ask the x86 ReflectiveLoader to load the
specified library and overwrite its space instead
of allocating memory with VirtualAlloc.
module_x64 xpsservices.dll Same as module_x86; affects x64 loader
obfuscate false Obfuscate the Reflective DLL’s import table,
overwrite unused header content, and ask
ReflectiveLoader to copy Beacon to new
memory without its DLL headers.
sleep_mask false Obfuscate Beacon, in-memory, prior to sleeping
smartinject false Use embedded function pointer hints to
bootstrap Beacon agent without walking
kernel32 EAT
stomppe true Ask ReflectiveLoader to stomp MZ, PE, and
e_lfanew values after it loads Beacon payload
userwx false Ask ReflectiveLoader to use or avoid RWX
permissions for Beacon DLL in memory
Cloning PE Headers
The stage block has several options that change the characteristics of your Beacon Reflective
DLL to look like something else in memory. These are meant to create indicators that support
analysis exercises and threat emulation scenarios.
85
www.cobaltstrike.com
Cobalt Strike’s Linux package includes a tool, peclone, to extract headers from a DLL and
present them as a ready-to-use stage block:
./peclone [/path/to/sample.dll]
If strrep isn’t enough, set sleep_mask to true. This directs Beacon to obfuscate itself in-memory
before it goes to sleep. After sleeping, Beacon will de-obfuscate itself to request and process
tasks. The SMB and TCP Beacons will obfuscate themselves while waiting for a new connection
or waiting for data from their parent session.
Decide how much you want to look like a DLL in memory. If you want to allow easy detection,
set stomppe to false. If you would like to lightly obfuscate your Beacon DLL in memory, set
stomppe to true. If you’d like to up the challenge, set obfuscate to true. This option will take
many steps to obfuscate your Beacon stage and the final state of the DLL in memory.
One way to find memory injected DLLs is to look for the MZ and PE magic bytes at their
expected locations relative to eachother. These values are not usually obfuscated as the reflective
loading process depends on them. The obfuscate option does not affect these values. Set
magic_pe to two letters or bytes that mark the beginning of the PE header. Set magic_mz_x86
to change these magic bytes in the x86 Beacon DLL. Set magic_mz_x64 for the x64 Beacon
DLL. Follow instructions that change CPU state with instructions that undo the change. For
example, MZ is the easily recognizable header sequence, but it's also valid x86 and x64
instructions. The follow-on RE (x86) and AR (x64) are valid x86 and x64 instructions that undo
the MZ changes. These hints will change the magic values in Beacon's Reflective DLL package
and make the reflective loading process use the new values.
86
www.cobaltstrike.com
Set userwx to false to ask Beacon’s loader to avoid RWX permissions. Memory segments with
these permissions will attract extra attention from analysts and security products.
By default, Beacon’s loader allocates memory with VirtualAlloc. Use the allocator option to
change this. The HeapAlloc option allocates heap memory for Beacon with RWX permissions.
The MapViewOfFile allocator allocates memory for Beacon by creating an anonymous memory
mapped file region in the current process. Module stomping is an alternative to these options and
a way to have Beacon execute from coveted image memory. Set module_x86 to a DLL that is
about twice as large as the Beacon payload itself. Beacon’s x86 loader will load the specified
DLL, find its location in memory, and overwrite it. This is a way to situate Beacon in memory
that Windows associates with a file on disk. It’s important that the DLL you choose is not needed
by the applications you intend to reside in. The module_x64 option is the same story, but it
affects the x64 Beacon.
If you’re worried about the Beacon stage that initializes the Beacon DLL in memory, set cleanup
to true. This option will free the memory associated with the Beacon stage when it’s no longer
needed.
process-inject {
# set how memory is allocated in a remote process
set allocator "VirtualAllocEx";
transform-x86 {
prepend "\x90\x90";
}
transform-x64 {
# transform x64 injected content
}
87
www.cobaltstrike.com
}
}
The process-inject block accepts several options that control the process injection process in
Beacon:
Option Example Description
allocator VirtualAllocEx The preferred method to allocate memory in the remote process.
Specify VirtualAllocEx or NtMapViewOfSection. The
NtMapViewOfSection option is for same-architecture injection
only. VirtualAllocEx is always used for cross-arch memory
allocations.
min_alloc 4096 Minimum amount of memory to request for injected content
startrwx false Use RWX as initial permissions for injected content. Alternative
is RW.
userwx false Use RWX as final permissions for injected content.
Alternative is RX.
The transform-x86 and transform-x64 blocks pad content injected by Beacon. These blocks
support two commands: prepend and append. The prepend command inserts a string before the
injected content. The append command adds a string after the injected content. Make sure that
prepended data is valid code for the injected content’s architecture (x86, x64). The c2lint
program does not have a check for this.
The execute block controls the methods Beacon will use when it needs to inject code into a
process. Beacon examines each option in the execute block, determines if the option is usable for
the current context, tries the method when it is usable, and moves on to the next option if code
execution did not happen. The execute options include:
The CreateThread and CreateRemoteThread options have variants that spawn a suspended
thread with the address of another function, update the suspended thread to execute the injected
code, and resume that thread. Use [function] “module!function+0x##” to specify the start address
to spoof. For remote processes, ntdll and kernel32 are the only recommended modules to pull
88
www.cobaltstrike.com
from. The optional 0x## part is an offset added to the start address. These variants work x86 ->
x86 and x64 -> x64 only.
The execute options you choose must cover a variety of corner cases. These corner cases include
self injection, injection into suspended temporary processes, cross-session remote process
injection, x86 -> x64 injection, x64 -> x86 injection, and injection with or without passing an
argument. The c2lint tool will warn you about contexts that your execute block does not cover.
post-ex {
# control the temporary process we spawn to
set spawnto_x86 "%windir%\\syswow64\\rundll32.exe";
set spawnto_x64 "%windir%\\sysnative\\rundll32.exe";
The spawnto_x86 and spawnto_x64 options control the default temporary process Beacon will
spawn for its post-exploitation features. Here are a few tips for these values:
1. Always specify the full path to the program you want Beacon to spawn
4. For an x86 spawnto value, you must specify an x86 program. For an x64 spawnto
value, you must specify an x64 program.
89
www.cobaltstrike.com
5. The paths you specify (minus the automatic syswow64/sysnative adjustment) must
exist from both an x64 (native) and x86 (wow64) view of the file system.
The obfuscate option scrambles the content of the post-ex DLLs and settles the post-ex
capability into memory in a more OPSEC-safe way. It’s very similar to the obfuscate and userwx
options available for Beacon via the stage block. Some long-running post-ex DLLs will mask
and unmask their string table, as needed, when this option is set.
Use pipename to change the named pipe names used, by post-ex DLLs, to send output back to
Beacon. This option accepts a comma-separated list of pipenames. Cobalt Strike will select a
random pipe name from this option when it sets up a post-exploitation job. Each # in the
pipename is replaced with a valid hex character as well.
The smartinject option directs Beacon to embed key function pointers, like GetProcAddress and
LoadLibrary, into its same-architecture post-ex DLLs. This allows post-ex DLLs to bootstrap
themselves in a new process without shellcode-like behavior that is detected and mitigated by
watching memory accesses to the PEB and kernel32.dll.
The thread_hint option allows multi-threaded post-ex DLLs to spawn threads with a spoofed
start address. Specify the thread hint as “module!function+0x##” to specify the start address to
spoof. The optional 0x## part is an offset added to the start address.
The amsi_disable option directs powerpick, execute-assembly, and psinject to patch the
AmsiScanBuffer function before loading .NET or PowerShell code. This limits the Antimalware
Scan Interface visibility into these capabilities.
Set the keylogger option to configure Cobalt Strike's keystroke logger. The GetAsyncKeyState
option (default) uses the GetAsyncKeyState API to observe keystrokes. The
SetWindowsHookEx option uses SetWindowsHookEx to observe keystrokes.
90
www.cobaltstrike.com
13.2 Reports
Cobalt Strike has several report options to help make sense of your data and convey a story to
your clients. You may configure the title, description, and hosts displayed in most reports.
Go to the Reporting menu and choose one of the reports to generate. Cobalt Strike will export
your report as an MS Word or PDF document.
91
www.cobaltstrike.com
Activity Report
The activity report provides a timeline of red team activities. Each of your post-exploitation
activities are documented here.
Hosts Report
The hosts report summarizes information collected by Cobalt Strike on a host-by-host basis.
Services, credentials, and sessions are listed here as well.
92
www.cobaltstrike.com
Indicators of Compromise
This report resembles an Indicators of Compromise appendix from a threat intelligence report.
Content includes a generated analysis of your Malleable C2 profile, which domain you used, and
MD5 hashes for files you’ve uploaded.
93
www.cobaltstrike.com
Sessions Report
This report documents indicators and activity on a session-by-session basis. This report includes:
the communication path each session used to reach you, MD5 hashes of files put on disk during
that session, miscellaneous indicators (e.g., service names), and a timeline of post-exploitation
activity. This report is a fantastic tool to help a network defense team understand all of red’s
activity and match their sensors to your activity.
Social Engineering
The social engineering report documents each round of spear phishing emails, who clicked, and
what was collected from each user that clicked. This report also shows applications discovered
by the system profiler.
94
www.cobaltstrike.com
Your custom image should be 1192x257px set to 300dpi. The 300dpi setting is necessary for the
reporting engine to render your image at the right size.
You may also set an accent color. This accent color is the color of the thick line below your
image on the first page of the report. Links inside reports use the accent color too.
• https://www.cobaltstrike.com/aggressor-script
95
www.cobaltstrike.com
96