TL;DR: AdaptixC2’s Go agent, “Gopher”, stores its C2 profile as an AES-128-GCM blob whose key is the blob’s own first 16 bytes. The GCM tag tells you when you’ve decrypted it correctly, so the blob is easy to find and decrypt without running the binary. Public tooling already does this. This post is an independent walkthrough of how it works, with a minimal extractor, a YARA starting point, and configs from two Linux builds seen this year.

Context and prior art

AdaptixC2 is an open-source red-team framework that criminal operators have been using more often since 2025. Its Windows beacon is well covered: Unit 42, Elastic and others have written it up, Censys has fingerprinted its servers, and Kaspersky published network and host detections in April 2026.

Gopher is AdaptixC2’s official, documented Go agent (docs), and its source is public. Nothing here is a secret of the framework, and config extraction isn’t new either: 0xThiebaut’s AdaptixC2-gopher tooling has brute-forced Gopher configs since late 2025. Use it. SOCRadar’s “Operation Master” report (Sept 2026) recovered Gopher Linux beacons from a mass GlobalProtect intrusion campaign.

This post is my own walkthrough of the format, worked out from the binary before I knew about that tool, plus what two in-the-wild builds tell you. If you only want configs, use 0xThiebaut’s tool.

The samples

SHA-256First seenBuild
7d6cc6cc5ed80dc4398e40b5cbdf3459fcda1a4eed5e1901a708060fb05c837f2026 (Nov build)go1.25.4, vcs.revision=e99535c9…, vcs.time=2026-09-24T22:01:37Z, vcs.modified=true
1835f744861e9aa6bf965ed9f21cc0109b3d01888d5b8f8c304c5cc297a9d9bd2026-08-16go1.25.4, no VCS stamp

Both are 6,430,904-byte static, stripped x86-64 ELFs: CGO_ENABLED=0, -trimpath, Go module path gopher. Every function sits at the same address in both, so they come from the same source tree and toolchain. Stripping doesn’t remove Go’s pclntab, so function names like main.taskExecBof and gopher/utils.EncryptData are still there, and that makes identifying them easy.

All analysis was static. Neither sample was executed.

Capabilities

main.TaskProcess dispatches 26 handlers:

  • Execution: shell commands, spawned programs with streamed output, an interactive PTY (creack/pty), and in-process BOF/COFF execution (taskExecBof, jobExecBofAsync). BOF loading is the AdaptixC2 tell.
  • Files: ls / cat / cp / mv / rm / mkdir / pwd / cd / zip, upload, and chunked download.
  • Processes: ps, kill, job list/kill.
  • Surveillance: X11 screenshots (kbinani/screenshot + jezek/xgb).
  • Pivoting: SOCKS-style tunnels with pause/resume/kill.

There’s no anti-analysis, no sandbox check, no sleep gate, and no self-persistence. It connects immediately and waits for an operator.

How the profile is stored

The profile is an array of byte slices in .data. Each blob is laid out like this:

[ 0:16 ]  AES-128 key
[16:28 ]  GCM nonce (12 bytes)
[28:-16]  ciphertext
[-16:  ]  GCM tag

There’s no KDF and no XOR, so the key ships right next to its ciphertext. Decrypt it and you get MessagePack with these keys:

type, addresses, banner_size, conn_timeout, conn_count, use_ssl, ssl_cert, ssl_key, ca_cert

The same 16-byte key also encrypts the agent’s C2 traffic, so extracting the profile gets you the wire key too.

The two configs

// 7d6cc6cc…  key 4f5e5d087810d0c9e6e0a4d13d7558c0
{"type":2421052563,"addresses":["0517fito.restler12[.]cfd:45741"],"banner_size":9,
 "conn_timeout":10,"conn_count":1000000000,"use_ssl":false,"ssl_cert":null,"ssl_key":null,"ca_cert":null}

// 1835f744…  key a1d63c9fbfc9dd5a7e7686e4507303c7
{"type":2421052563,"addresses":["202.73.4[.]82:42440"],"banner_size":22,
 "conn_timeout":10,"conn_count":1000000000,"use_ssl":false,"ssl_cert":null,"ssl_key":null,"ca_cert":null}

What stands out:

  • type is the same opaque constant in both builds. Transport is chosen by use_ssl, not by type.
  • conn_count of one billion with a 10-second conn_timeout means it reconnects for as long as the process lives.
  • The C2s are on different providers in different countries: 149.50.159[.]183 (AS27823, Argentina) and 202.73.4[.]82 (AS134677, Hong Kong). Same codebase, separate deployments. These binaries can’t tell you whether one operator runs both.
  • With use_ssl=true, the agent presents an mTLS client certificate from the profile and sets InsecureSkipVerify, so it never checks the server’s certificate. Neither of these samples uses TLS.

The wire

Every message is framed like this:

[4-byte big-endian length N][12-byte random nonce][AES-128-GCM ciphertext][16-byte tag]

N = 28 + plaintext length, and the plaintext is MessagePack.

The order of a session:

  1. The agent connects over TCP, or TLS if use_ssl is set.
  2. The server speaks first. The agent reads exactly banner_size bytes (9 and 22 in these builds) and doesn’t check their content.
  3. The agent sends one encrypted registration message: a random 32-bit agent ID, plus the executable name, OS version (from /etc/os-release), username, hostname, first non-loopback IPv4, a 16-byte random session value, and whether it’s running as root.
  4. From then on, the agent only acts when the server sends it a task.

The only authenticator is the AES key baked into the binary. There’s no separate token and no registration step.

Static extractor

Because a correct key produces a valid GCM tag, you don’t need to locate the profile array precisely. Scan every writable segment for anything shaped like a Go slice header (ptr, len, cap with len == cap), try to decrypt what it points to, and keep whatever authenticates and unpacks to a dict containing addresses.

⚠️ Not yet run against the samples.

#!/usr/bin/env python3
"""Static config extractor for AdaptixC2 Gopher agents (64-bit LE ELF).
Reads bytes only; never executes the sample. Run inside your analysis sandbox.
    pip install cryptography msgpack
    python3 gopher_config.py sample.elf
"""
import json, struct, sys
import msgpack
from cryptography.exceptions import InvalidTag
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

PT_LOAD, PF_W = 1, 2


def load_segments(buf):
    if buf[:4] != b"\x7fELF" or buf[4] != 2 or buf[5] != 1:
        raise SystemExit("not a 64-bit little-endian ELF")
    phoff, = struct.unpack_from("<Q", buf, 0x20)
    phentsize, phnum = struct.unpack_from("<HH", buf, 0x36)
    segs = []
    for i in range(phnum):
        p_type, p_flags, p_off, p_vaddr, _, p_filesz, _, _ = struct.unpack_from(
            "<IIQQQQQQ", buf, phoff + i * phentsize)
        if p_type == PT_LOAD:
            segs.append((p_vaddr, p_off, p_filesz, p_flags))
    return segs


def vaddr_to_off(segs, va, n):
    for vaddr, off, size, _ in segs:
        if vaddr <= va and va + n <= vaddr + size:
            return off + (va - vaddr)
    return None


def candidate_blobs(buf, segs):
    for _, off, size, flags in segs:
        if not flags & PF_W:
            continue
        for i in range(off, off + size - 24 + 1, 8):
            ptr, ln, cap = struct.unpack_from("<QQQ", buf, i)
            if ln == cap and 44 <= ln <= 8192:
                o = vaddr_to_off(segs, ptr, ln)
                if o is not None:
                    yield bytes(buf[o:o + ln])


def try_profile(blob):
    key, nonce, ct = blob[:16], blob[16:28], blob[28:]
    try:
        pt = AESGCM(key).decrypt(nonce, ct, None)
        cfg = msgpack.unpackb(pt, raw=False)
    except (InvalidTag, ValueError, msgpack.exceptions.ExtraData,
            msgpack.exceptions.FormatError, msgpack.exceptions.StackError):
        return None
    if isinstance(cfg, dict) and "addresses" in cfg:
        return {"wire_key": key.hex(), "profile": cfg}
    return None


def main(path):
    buf = open(path, "rb").read()
    seen, found = set(), []
    for blob in candidate_blobs(buf, load_segments(buf)):
        if blob in seen:
            continue
        seen.add(blob)
        hit = try_profile(blob)
        if hit:
            found.append(hit)
    print(json.dumps(found, indent=2, default=lambda b: b.hex() if isinstance(b, bytes) else str(b)))
    return 0 if found else 1


if __name__ == "__main__":
    sys.exit(main(sys.argv[1]))

Detection

YARA (starting point, untested against a goodware corpus):

rule AdaptixC2_Gopher_Agent_ELF
{
    meta:
        description = "AdaptixC2 Gopher Go agent (Linux), via surviving Go symbol names"
        author = "Will"
        reference = "7d6cc6cc5ed80dc4398e40b5cbdf3459fcda1a4eed5e1901a708060fb05c837f"
    strings:
        $m1 = "gopher/utils.EncryptData"
        $m2 = "gopher/utils.DecryptData"
        $m3 = "gopher/functions.SendMsg"
        $t1 = "main.taskExecBof"
        $t2 = "main.jobExecBofAsync"
        $t3 = "main.jobTunnel"
        $e1 = "incorrected size: %d"
    condition:
        uint32(0) == 0x464c457f and 2 of ($m*) and 1 of ($t*) or
        uint32(0) == 0x464c457f and $e1 and 1 of ($t*)
}

The "incorrected size: %d" typo comes from the framing reader and makes a nice low-noise anchor.

Network: a server-first fixed-length banner, followed by a client message of [4-byte BE length][high-entropy body] where the length is 28 more than a small MessagePack payload, on an unusual high port in plain TCP. On its own that’s weak. Pair it with the host indicators.

Host: a static Go ELF making an immediate outbound TCP connection on launch, retrying every ~10 s indefinitely, with no persistence of its own.

IOCs

7d6cc6cc5ed80dc4398e40b5cbdf3459fcda1a4eed5e1901a708060fb05c837f
1835f744861e9aa6bf965ed9f21cc0109b3d01888d5b8f8c304c5cc297a9d9bd
0517fito.restler12[.]cfd:45741   (149.50.159[.]183, AS27823)
202.73.4[.]82:42440              (AS134677)