In this section

0.5 Command and Control, and the Configuration That Drives It

Module 0

Introduction

Almost every program in the last two lessons needed to talk to someone. A stealer sends its haul to a server, a loader fetches its next stage from one, and a remote access tool waits for an operator's commands.

Where that server is, how to reach it and what to say when it answers are not written into the code. They sit in a configuration block, and the configuration is the most useful thing an analyst can take out of a sample.

This lesson sets out how malware finds its servers, what a configuration block holds, why configuration beats almost every other output of analysis, and how one is extracted and turned into indicators. It then checks an assistant's extraction, field by field.

1

Command and Control

The conversation the sample depends on

Command and control, C2, is the channel between a piece of malware and the people operating it. For a stealer it may be one conversation, sending the log and ending.

For a remote access tool it is the whole point: the tool connects out, reports the host, and waits for instructions to run commands, move files or fetch other tools. For a loader it is the request for the next stage.

Each kind of program needs something different from that channel:

What each program needs from its server

Stealer

Somewhere to send the log, once

Loader

The next stage, and sometimes the key to decrypt it

Remote access tool

A standing session: report the host, then wait for commands

Every one of them

An address it can reach from inside the network

The last row is the one defenders can use. Whatever the program, the server has to be reachable from where the malware runs, so the channel crosses the network edge, and the edge is where it can be seen and stopped.

The direction matters to a defender. Malware almost always connects out from the infected host to its server, because outbound connections are what networks allow and what users' machines make all day. That is why C2 is found in the proxy, firewall and DNS records rather than in inbound alerts, and why the address the sample connects to is so valuable to know in advance.

The address cannot be left to chance, and it cannot be compiled into code that is expensive to change, because servers are taken down, blocked and replaced constantly.

Operators need to point the same sample at new servers without rebuilding it, and to give each customer or campaign its own. Both needs are met the same way: the sample reads its settings from a block of data, built or edited separately from the code. The panels from lesson 0.3, where affiliates build their own samples, are exactly that: a form that writes a configuration into a prebuilt program.

That design has a consequence analysts rely on. Because the code is shared and only the configuration changes, the same extraction method works on every sample a panel produces, and the configuration is where one customer's sample differs from another's. Two infections by the same family can be entirely unrelated operations, and the configuration is usually the only place that says so.

2

How Malware Finds Its Server

Fixed, fallback and computed

There are three broad ways a sample can know where to connect, and the configuration holds the input to each:

FixedHard-codedaddresses in the configSeveraltried in orderEasy to blockonce extractedFallbackDead dropa profile or channelHoldsthe current addressSurvivesblocking the main oneComputedAlgorithmand a seed in the configNew namesevery dayPredictablefrom the seed

Three ways malware finds its server. The configuration holds the input to each: the addresses, the place to look, or the seed.

The simplest is a fixed list of addresses or names, tried in order. Most commodity remote access tools and stealers work this way, and once the list is extracted every entry on it can be blocked and searched for.

The second adds a fallback. When the main servers cannot be reached, the sample looks somewhere public that an operator can edit, a profile page, a post or a channel, and reads the current address from it.

Microsoft describes Lumma's fallback addresses as hosted on Steam profiles and Telegram channels, with its main servers behind Cloudflare's proxies. Blocking the main server alone does not stop such a sample; the fallback location has to be known too.

Lumma's servers, as Microsoft describes them

Main servers

behind Cloudflare proxies

Fallbacks

Steam profiles, Telegram channels

Traffic

HTTPS, stolen data sent in chunks

Reported

21 May 2025

Blocking the main servers alone leaves the fallbacks working.

For an analyst, a fallback in a configuration is a second list of things to watch. The public page itself is usually legitimate and cannot be blocked outright, but a host reading a particular profile or channel at the moment its main server fails is a pattern a proxy log can show.

The third computes the address. MITRE ATT&CK describes dynamic resolution, where adversaries establish connections to command and control infrastructure dynamically, with domain generation algorithms as one sub-technique.

A domain generation algorithm produces a new set of domain names every day from a seed, and the operator registers one of them in advance. The configuration then holds the seed rather than the names, and with the seed and the algorithm a defender can compute the same names, including tomorrow's.

Each method changes what the network records show. A fixed list produces connections to the same few addresses, easy to match once known. A fallback produces a request to an ordinary public site followed by a connection somewhere new.

A computed domain produces a burst of lookups for names that mostly do not exist, because only one of each day's names is registered, and a run of failed lookups for random-looking names is one of the clearest network signs of an algorithm at work.

3

What a Configuration Holds

More than addresses

The server list is the headline, but configurations carry more, and each field answers a different response question:

What a configuration block holds

Configuration

Servers

addresses, names or URLs, often several

Port and protocol

how to connect

Keys

to decrypt traffic or the config itself

Campaign or build

whose operation this is

Mutex

a name that marks an infected host

Switches

install, persist, spread, delay

CAPE-parsers names the same things in its output fields: CNCs, campaign, botnet, dga_seed, mutex, cryptokey.

Keys decrypt the traffic or the configuration itself, and with them recorded network captures can be read. A campaign or build identifier names whose operation the sample belongs to, which groups samples that look different on disk. Switches decide what the sample does on a given host: whether it installs itself to survive a reboot, whether it spreads, how long it waits before calling out.

The mutex is the field most often overlooked. MITRE ATT&CK describes malware using a unique, malware-specific mutex to check whether a system is already compromised and prevent a second instance from running.

Black Basta checks for a hard-coded mutex before executing; LockBit 3.0 builds its mutex from a hash of the machine's GUID, and StrelaStealer from the victim's system name. A fixed mutex name is a host indicator that does not depend on the infrastructure at all: wherever the sample runs, the name appears.

CAPE-parsers, a collection of configuration extractors from the CAPE sandbox project, standardizes these fields in its output: CNCs for the servers, written as URLs with a scheme, host, port and path, then campaign, botnet, dga_seed, mutex and cryptokey. Using one vocabulary for every family is what lets extracted configurations be compared and searched.

Not every field is present in every family, and an empty field is not a finding. A configuration without a mutex may mean the family does not use one, or that it generates the name at run time, as LockBit 3.0 does from the machine's GUID.

In that case the record notes how the name is built, because a name derived from each victim cannot be searched for as one string.

4

Why the Configuration Matters Most

What it gives that nothing else does

Most outputs of malware analysis describe a sample. The configuration describes an operation, and that difference shows in what each output is good for:

What each output of analysis is good for

Hash

Finding this one build; changes with every build

Capability list

What the family can do; the same for every customer

Sandbox report

What happened in one run, on one machine, on one day

Configuration

Servers to block, host marks to hunt, the campaign, the keys

A hash finds one build of one sample and changes every time the panel produces a new one. A capability list says what the family can do, which is the same for every customer. A behavior report from a sandbox shows what happened in one run, on one machine, on one day.

The configuration, by contrast, gives the servers to block now, the host marks to search for on every endpoint, the campaign to group this sample with others, and the keys to read whatever traffic was recorded. Those are the outputs a response team acts on in its first hour, and they come from a static read of the file, so nothing has to run and nothing touches the network.

It also lasts. Families change their code slowly, so once one configuration has been extracted, the same method extracts the next sample's in minutes. That is why parsers exist for the families seen most often, and why an analyst's first question about a known family is whether a parser already handles it.

It is also the output that ages most usefully. A server list extracted today is still valid evidence in six months, when someone reviewing old proxy logs wants to know whether any other host ever called the same addresses. The configuration, stored with the sample's hash and the date it was extracted, answers that question without anyone reopening the sample.

5

Extracting a Configuration

Strings, a decode and a known-plaintext test

The lab pack's remote access tool is built the same way, inert: it carries a configuration, counts its bytes and prints a line, and connects to nothing. Its static strings show two things worth a second look:

$ floss -q --only static -n 5 mw05-rat-config.exe \
    | grep -E 'RIDGELINE|RCFG|^[A-Za-z0-9+/=]{40,}$' | cut -c1-56
RIDGELINE-SPECIMEN mw05: %s%u config bytes (sum %u), no
WqxJ4VL6Uqwb1QO8Eb0Pvg+/EL0PvxasDaxCvA/rWe9M/k3rD+1O4wPT  # ◄ base64, cut short
RCFG:  # ◄ a label for something

A short label, RCFG:, and a long string made only of the base64 alphabet. Neither would mean much alone. Together, a label that reads like an abbreviation for configuration and a block of encoded data beside it are the most common shape a hand-built configuration takes, and they are where to look first in any sample that has to call home.

Base64 is how binary data is carried in text, so the long string is binary data in disguise, and decoding it is the first step:

$ floss -q --only static -n 5 mw05-rat-config.exe | grep -E '^[A-Za-z0-9+/=]{40,}$' \
    | base64 -d > blob.bin
$ file blob.bin
blob.bin: data
$ od -A d -t x1 -N 16 blob.bin
0000000 5a ac 49 e1 52 fa 52 ac 1b d5 03 bc 11 bd 0f be
0000016

The result is not text, and nothing in it says what it is. If it is an encrypted configuration, and if the configuration is JSON as it so often is, then its first two bytes should be an opening brace and a quote. Combining the two gives a candidate key:

$ printf '%x %x\n' $((0x5a ^ 0x7b)) $((0xac ^ 0x22))
21 8e  # ◄ the key, if it repeats

A two-byte key is short enough to repeat many times over the data, which is exactly how the stealer in lesson 0.3 was keyed. Decrypting the whole block with it produces the configuration:

$ python3 - <<'EOF'
data = open('blob.bin', 'rb').read()
key = bytes.fromhex('218e')
open('config.json', 'wb').write(bytes(c ^ key[i % 2] for i, c in enumerate(data)))
EOF
$ jq . config.json
{
  "hosts": [  # ◄ where it calls
    "203.0.113.17",
    "c2.example.com"
  ],
  "port": 8443,
  "mutex": "Global\\rd-7f3a-91c2",  # ◄ a mark on the host
  "campaign": "NOV-26-B",  # ◄ which operation
  "install": false,  # ◄ persistence off
  "version": "0.7.2"
}

The output is valid JSON, so the key is right, and every field in it is something to act on. Two servers, one an address and one a name, on port 8443. A mutex. A campaign identifier and a version. And an install switch, set to false, which says this build does not install itself.

Two checks keep the result honest. The decoded configuration is valid JSON, which a wrong key would almost never produce, and it matches the known answer recorded with the lab pack. In real work there is no answer file, so the first check carries the weight, along with plausibility: addresses that are well-formed, a port in range, field names that mean something.

6

Configurations Across Families

Parsers, and when there is none

Extracting a configuration by hand is the method; doing it for every sample of a common family is wasted effort, because someone has usually written a parser. CAPE-parsers groups its extractors into core and community parsers, and the installed package lists which families each set covers:

$ python3 - <<'EOF'
import os, cape_parsers
root = os.path.dirname(cape_parsers.__file__)
for kind in ('core', 'community'):
    names = sorted(f[:-3] for f in os.listdir(os.path.join(root, 'CAPE', kind))
                   if f.endswith('.py') and not f.startswith(('_', 'test')))
    want = ('AsyncRAT', 'XWorm', 'Remcos', 'QuasarRAT', 'Lumma', 'Vidar',
            'Stealc', 'RedLine', 'Latrodectus')
    print(kind, len(names), ' '.join(n for n in names if n in want))
EOF
core 35 Latrodectus RedLine Remcos
community 29 AsyncRAT Lumma QuasarRAT Stealc Vidar XWorm

The family names on those lines are the ones taught throughout this course from published reports, and each has a parser that knows its layout, its encoding and its key.

A parser works only when the family has been identified, usually from a YARA rule or a sandbox signature, so identification comes first and extraction second. When a new version of a family changes its layout, the parser fails until someone updates it, which is when the manual method in section 5 is needed again.

A failed parser is worth recording as a finding in its own right. It usually means the family has changed, and the changed layout is something the next analyst will meet too. The manual extraction, written up with the offsets, the encoding and the key, is the first draft of the updated parser.

Whatever produced the configuration, it is recorded in the same fields, so the lab pack's sample is written the same way:

$ jq '{CNCs: [.hosts[] as $h | "tcp://\($h):\(.port)"], mutex: .mutex,
    campaign: .campaign, version: .version}' config.json
{
  "CNCs": [
    "tcp://203.0.113.17:8443",
    "tcp://c2.example.com:8443"
  ],
  "mutex": "Global\\rd-7f3a-91c2",
  "campaign": "NOV-26-B",
  "version": "0.7.2"
}

Each server becomes a URL with a scheme, host and port, as CAPE-parsers asks, and the other fields keep their names. A record in that shape can be compared with configurations from other samples and other analysts, and searched by any field.

7

From Configuration to Indicators

Three kinds, three places to look

A configuration does not go to the SOC as one block. Each value is a different kind of indicator, searched in a different place and useful for a different length of time:

NetworkHosts203.0.113.17, c2.example.comPort8443Searchproxy, firewall, DNSHostMutexGlobal\rd-7f3a-91c2Installfalse: no persistenceSearchendpoint telemetryCampaignCampaignNOV-26-BVersion0.7.2Usegroup samples, track

One configuration, three kinds of indicator. Each kind is searched in a different place and lasts a different length of time.

The network indicators, the hosts and port, go to the proxy, firewall and DNS records, and to the blocking lists. They find infections that have already called out, and they stop new ones from succeeding, but they last only as long as the operator keeps those servers.

Port 8443 on its own finds nothing useful, because many legitimate services use it too; it matters only together with the hosts, as a pair.

The host indicator, the mutex, goes to endpoint telemetry. It finds the sample wherever it ran, whatever server it was pointed at, and it lasts as long as the family uses that name. The install switch is not an indicator but a scope decision: with persistence off, this build disappears at reboot, and the search for scheduled tasks and run keys can wait behind the search for other infected hosts.

The campaign indicators, the campaign name and version, do not find infections at all. They group samples, link this incident to others with the same campaign value, and tell threat intelligence which operation it is dealing with. Pulled out of the configuration one kind at a time, they are ready to hand to the team that owns each search:

$ jq -r '.hosts[] + ":" + (.port | tostring)' config.json
203.0.113.17:8443  # ◄ network
c2.example.com:8443
$ jq -r '.mutex' config.json
Global\rd-7f3a-91c2  # ◄ host
$ jq -r '.campaign + " " + .version' config.json
NOV-26-B 0.7.2  # ◄ campaign

The record keeps all three kinds, labeled, so nobody blocks a version number or searches the proxy for a mutex.

Each indicator also needs a date and an owner in the record. Network indicators are reviewed often, because operators move servers and an address reassigned to someone else becomes a false positive. Host indicators are reviewed when the family changes.

Campaign values are kept for as long as the organization tracks the operation. Without dates, an indicator list only grows, and the oldest entries quietly turn into noise that every search has to wade through.

8

Working With the Assistant

Prompt, session, record

Configuration extraction is quick work for an assistant, and the request decides whether the indicators come from the file or from the family. Asked for indicators, it gives a list that mixes the two:

OpenCode in REMnux, file namedPrepared example
Give me the IOCs for this RAT.
Here are the indicators:
  1. C2: 203.0.113.17 and c2.example.com on port 8443.
  2. Persistence: a Run key or scheduled task, as is typical for this kind of RAT.
  3. Block the C2 addresses at the firewall.
Numbered for checking against the tool output

The servers are right. The persistence line is what RATs usually do, not what this one is set to do, and the firewall block is advice nobody asked for yet. The prompt that works asks for the configuration, sorts the output for the people who will use it and sets the standard for switches:

PromptThe prompt that works
mw05-rat-config.exe, a remote access tool from a workstation, is in REMnux. Extract its configuration and turn it into indicators for the SOC, sorted by where each is searched: network, endpoint, or report only. Read the actual value of every field, switches included. One command at a time.
  1. Extract its configurationputs this sample's settings first, before any family's habits
  2. sorted by where each is searchedshapes the answer for the people who will act on it
  3. network, endpoint, or report onlygives each value a destination, including none
  4. Read the actual value of every field, switches includedthe standard that catches a feature switched off
  5. One command at a timekeeps every value on output you have seen

The session that follows decodes the configuration in four steps and needs one question:

From a configuration to indicatorsOpenCode in REMnux, mw05-rat-config.exePrepared example
  1. You
    mw05-rat-config.exe, a remote access tool from a workstation, is in REMnux. Extract its configuration and turn it into indicators for the SOC, sorted by where each is searched: network, endpoint, or report only. Read the actual value of every field, switches included. One command at a time.
  2. Assistant
    Start with the strings: configurations are often a long encoded line with a label near it.
  3. REMnux
    $ floss -q --only static -n 5 mw05-rat-config.exe > s.txt
    $ grep -c -E '^[A-Za-z0-9+/=]{40,}$' s.txt
    1
    $ grep RCFG s.txt
    RCFG:
  4. Assistant
    One long base64 line and an RCFG label. Decode the base64 and look at the first bytes.
  5. REMnux
    $ grep -E '^[A-Za-z0-9+/=]{40,}$' s.txt | base64 -d > b.bin
    $ od -A d -t x1 -N 8 b.bin
    0000000 5a ac 49 e1 52 fa 52 ac
    0000008
  6. Assistant
    Not text yet, so it is encrypted after the encoding. If it is JSON it starts with {", so XOR the first two bytes with those characters.
  7. REMnux
    $ printf '%x %x\n' $((0x5a ^ 0x7b)) $((0xac ^ 0x22))
    21 8e
  8. Assistant
    A two-byte key, 21 8e, if it repeats. Decrypt with it and print the fields in two groups.
  9. REMnux
    $ python3 -c "d = open('b.bin', 'rb').read(); k = bytes.fromhex('218e')
    open('c.json', 'wb').write(bytes(c ^ k[i % 2] for i, c in enumerate(d)))"
    $ jq -c '{hosts, port}' c.json
    {"hosts":["203.0.113.17","c2.example.com"],"port":8443}
    $ jq -c '{mutex, install}' c.json
    {"mutex":"Global\\rd-7f3a-91c2","install":false}
    $ jq -c '{campaign, version}' c.json
    {"campaign":"NOV-26-B","version":"0.7.2"}
  10. Assistant
    Network: 203.0.113.17 and c2.example.com on 8443. Endpoint: the mutex Global\rd-7f3a-91c2, plus the Run keys and scheduled tasks RATs like this install for persistence. Report only: campaign NOV-26-B, version 0.7.2.
  11. You
    What does the install field say?
  12. Assistant
    false. Persistence is switched off in this build, so a persistence search is not the first endpoint job; the mutex is. I have kept the setting in the report so nobody assumes the opposite.
REMnux turns are the commands as run, with their output

The question was short because the prompt had already set the standard: every field's actual value. The assistant had the install field in front of it and still reached for what RATs usually do, which is the most common slip in configuration work.

A question that names the field brings the value forward, and the answer improved beyond the correction: the mutex moved to first place in the endpoint search, and the setting went into the report so the next reader does not assume persistence either.

The time saved is in the decode. Recognizing that the base64 output was still encrypted, proposing the known-plaintext test and writing a one-line decryptor are each small, and together they turn a strings dump into a configuration in minutes. The sorting at the end is the other gain: an extraction becomes three lists, each addressed to the team that searches it.

The indicators go to the SOC on four lines, each from a field of the decoded configuration or from the records that settle what it cannot:

What the indicators rest on

Network search

the hosts and port fields: 203.0.113.17 and c2.example.com, 8443

Endpoint search

the mutex field, the value an infected host carries

Persistence

the install field, false in this build

What stays open

whether anything answers at those addresses now: threat intelligence and network records

Nothing in the session tried to answer the last line from the file, because the prompt asked for indicators sorted by where they are searched, and liveness is not searched for in a configuration.

Do

Practice

From a configuration to indicators
prepared evidence

The scenario below holds the working session and the decoded configuration from this lesson, in its raw and CAPE-style forms. Decide how to steer the assistant, then sort the values into the searches they belong to.

In the lab, run the same commands on mw05-rat-config.exe in your REMnux machine, then extract it in OpenCode, started in the pack's lab folder, using the prompt above, and ask for the value of every switch it reasons from. The pack's answers.json holds the configuration, the encoding and the key.

Malware's settings live in a configuration block because servers change faster than code, and the block holds more than servers: keys, campaign identifiers, mutexes and switches that decide what the sample does. Extracting it, by a parser for a known family or by hand with a decode and a known-plaintext test, gives the outputs a response acts on first.

Sorted into network, host and campaign indicators, each value goes to the search where it can find something, and what the file cannot show, such as whether a server is live today, stays an open question in the record.

Resources

Vendors and projects revise these pages; where a page and this lesson disagree, the page is newer.