Honeypot capture

mirai (dvrhelper-rc4-framed-binary-c2)

C2 verifiedProtocol documented

A honeypot sensor network captured a 128,804-byte ARM ELF. Read statically, it yielded 8 command-and-control endpoints across 6 distinct hosts, the 16-byte binary frame the bot speaks, the ciphers that hide its configuration and its traffic, and all 5 commands its dispatcher accepts. The recovery gives defenders an IDS primitive from the frame format in protocol_spec.md, the indicator rows in iocs.csv, and five host indicators. All 8 endpoints carry an agreement verdict from a second decompiler backend, which resolved the same addresses independently.

The sample builds for three architectures — arm, armv5 and armv7 — the signature of a campaign aimed at routers, cameras and other embedded devices, not at servers. Owners patch such hardware infrequently, monitor it rarely, and keep it online permanently.

Sample identification

SHA-2563593f42cb9f63aa7a8bf1ffa54cfcc3fc9f5bc12d6e0a510b5c46ff14ca5b7c4
MD53c87c37efacadd41d2c35ca70adb2094
SHA-1b0c1b9e90a50fda8d5ae5c865095e3abc8e338eb
File typeELF 32-bit LSB executable, ARM, EABI4, statically linked, stripped
Size128,804 bytes
Packedno

Mirai structure and three deviations

The sample’s structure matches stock Mirai. It holds a table-based configuration with an id registrar at sub_1632c, a 15-entry attack-method registry at sub_85e8, a telnet brute-forcer driving a default-credential list, a busybox delivery chain, the string ./dvrHelper selfrep at 0x24de4, and an arm5/arm6/arm7/mips/mpsl loader suffix table. The sample is a worm, which means it spreads on its own and copies itself to further machines with no user action; in this build it spreads by brute-forcing exposed telnet. The string signature of the family is present too — /bin/busybox and ncorrect, both diagnostic of Mirai builds. The pipeline classifies the sample as Mirai lineage, dvrHelper variant, at confidence 0.85.

Three things deviate from stock Mirai. This build obfuscates the config table with a variant RC4, where stock builds XOR it. The C2 channel is a 16-byte-framed binary protocol with a session-key handshake, where stock Mirai opens with a 4-byte handshake. And the A records published for the C2 domains are themselves RC4 ciphertext.

The C2 wire protocol

C2 means the channel an infected machine uses to reach its operator for instructions. It runs here over a plain TCP socket with no TLS, to a destination port drawn at random from a 121-entry table spanning 38242-46812 at 0x2475e. Frames carry a 16-byte header: a 4-byte session-token echo, a constant 0x03, the message type XORed with key[0], a flags byte, a reserved byte, then big-endian u32 sequence, big-endian u16 length and big-endian u16 additive checksum. Frames are built at 0x12ac0 and parsed at 0x126c8. The bot re-sends a status frame whenever more than 29 seconds have elapsed, measured at 0x12320.

The body cipher is a 4-byte XOR key that the bot sends in the clear. sub_1264c generates the key per session and indexes it by a shared monotonic counter at 0x2f27c, and the bot transmits it in the 8-byte hello that opens the session. A defender whose capture includes the start of a session can therefore decrypt it without recovering the key.

OpcodeHandlerBehaviour
10x12ac0client status, registration and heartbeat
20x10e84server ping; the bot replies with a status frame
3sub_82cclaunch 1 of 15 DDoS methods against a target list
40x12ac0client ack for a type-3 command, when flags bit 0 is set
70x160bcstart or stop the telnet scanner

reproduction/c2_dissect.py decodes one session and recovers the bot’s marker, every attack tasking with method, duration, target list and CIDR prefixes, every scanner on/off command, and the token and key themselves. The per-method option TLVs inside a type-3 command are parsed generically by sub_82cc, and the semantics of each option are implemented inside the 15 individual handlers, so c2_emulator.py can task an attack by method id, duration and target list but cannot set method-specific options. Both test vectors replay through the dissector, and both were synthesised from the recovered codec rather than observed on the wire, since no real capture was available in this static lane.

The registry fixes what the operator can order: ids 0x00, 0x06 and 0x07 are plain UDP floods; 0x03, 0x04, 0x0d and 0x14 craft packets using the 16-entry TCP window/MSS fingerprint table at 0x2f0b8; 0x09, 0x0b and 0x0c are TCP floods; 0x01 is a Valve Source Engine query flood using config table id 5; 0x05 is a UDP/DNS-style flood; 0x0a exhausts connections; 0x12 replays the hardcoded TLS ClientHello at 0x2f14c; and 0x13 replays the HTTP/2 connection preface at 0x246a4.

How the bot finds a server it can reach

A variant RC4 decrypts the config strings in place at startup. sub_1615c is keyed with the 256 bytes at 0x2518d and decrypts 11 entries — the three C2 domains, the loader domain, two attack payloads and five /proc path fragments. The KSA and PRGA use three-XOR swaps, which zero the S-box cell whenever i == j, so a standard RC4 implementation decodes only the first 16 bytes of the longer entries. The registrar’s calls read directly out of the decompiler:

sub_1615c(0, 0x250f4, 0xe) sub_1615c(1, 0x25104, 8) sub_1615c(2, 0x25110, 0xd) sub_1615c(3, 0x25120, 0xa) sub_1615c(4, 0x2512c, 0x1a) sub_1615c(5, 0x25148, 0x14)

and the recovered table reads:

config_table = {"0": "slursbeback.ru", "1": "seris.gd", "2": "slursontel.ru", "3": "myrepis.gd", "4": "The Peoples Bank of China.", "5": "TSource Engine Query"}

extractor.py reimplements the cipher and reproduces every domain, the port table and the key from the raw file. Entry 4 has no consumer anywhere in the references to data_3297c, so which routine reads config table id 4 is an open question.

The sample implements name resolution from scratch. sub_13234 speaks DNS over UDP against 8[.]8[.]8[.]8 then 1[.]1[.]1[.]1 on port 53, with a random transaction id and a 1-second select timeout. There is no libc resolver and no /etc/resolv.conf read, so the sample does not use the host’s DNS configuration. Each 4-byte A-record rdata then passes through sub_110e4, a second RC4 keyed with the 8-byte literal GET/dlr. at 0x24850, before it is used as a connect address. A defender who resolves one of these domains gets a 4-byte value that only this key turns into an address.

The bot rotates through the three C2 domains. The resolver accepts only table ids 0 to 2 at 0x104f8, and the index advances by one modulo 3 at 0x10ff4.

if (r2 != 0 && *r2 != 0 && arg2 u<= 2) char* r6_1 = r2[arg2 * 2] int32_t* r0_1 = sub_13234(r6_1, 1)

int32_t r1_6 = (data_2f804 + 1) s% 3 int32_t r0_9 = data_2f260 data_2f804 = r1_6

The destination port is drawn at random from the 121-entry table. the shift-and-or written to data_2f266 reads as that drawn value being byte-swapped into network order before use:

uint32_t r3_13 = zx.d(*(((sub_12da0() u% 0x79) << 1) + 0x2475e)) int32_t r0_14 = data_2f260 data_2f266 = (r3_13 u>> 8).w | ((r3_13 & 0xff) << 8).w sub_193d4(r0_14, 0x2f264, 0x10)

The pipeline did not reverse sub_12da0, the PRNG this draw calls, so c2_client.py generates its session token and key with the Python standard library; the client still interoperates, because the bot negotiates the key by sending it, though the client is not byte-identical to the sample.

myrepis[.]gd is the loader host, serving architecture-specific second stages over HTTP. A second stage is the payload a loader fetches, and it carries the capability the operator wants. That host also appears in 5 other analysed captures. The same command-and-control host appears in this sample and in those five captures, which ties them to one operator’s infrastructure and places this sample inside a wider campaign.

ValuePortRoleSourceOffsetConf
slursbeback[.]ru38242-46812primary C2decrypted0x163400.95
seris[.]gd38242-46812fallback C2decrypted0x163400.92
slursontel[.]ru38242-46812fallback C2decrypted0x163400.92
myrepis[.]gd80primary loaderdecrypted0x163400.85
hxxp[://]myrepis[.]gd/dlr.arm780loaderdecrypted0x24a800.80
hxxp[://]myrepis[.]gd/b280loaderdecrypted0x13c340.70
8[.]8[.]8[.]853public resolverconfig0x133280.90
1[.]1[.]1[.]153public resolverconfig0x133280.90

Addresses and URLs as recovered statically. “Decrypted” marks values obtained by running the reimplemented config RC4 over the .rodata ciphertext; “config” marks the two public resolvers, which appear in the DNS client at 0x13328 and are queried by the bot rather than tasking it.

What the bot leaves on a device

The bot needs only user privilege, because it takes over on a port above 1024, it persists by dropping a file into a writable directory, and it makes no setuid or module-loading syscall; it also needs four outbound network paths, tcp/38242-46812 for C2, udp/53 to the two public resolvers, tcp/23 for telnet scanning, and tcp/80 for the second-stage fetch. Denying any one of those four paths blocks the bot.

On the host, five artifacts are observable. None was part of the claim set sent to the verifier, so none carries a second-tool verdict, and the emitted Sigma rule at detections/3593f42cb9f6.sigma.yml ships commented out as documentation only, with that reason stated in its own header. main reads KERN_SECURELEVEL with getenv at its top; the value, capped at 0x1f bytes, or argv[1] when the variable is unset, is copied to 0x2fa20 and becomes the identifier sent in every status frame. Presence of this variable in a process environment is a high-fidelity host indicator. The bot binds 0.0.0.0:39148/tcp with SO_REUSEADDR and a listen backlog of 1; a newly started copy that fails to bind connects to 127.0.0.1:39148 and sends the 8-byte magic BOT\x01TAKE, at which point the incumbent closes its C2 socket and SIGKILLs its own process group, handing over the device. Nothing else is read from the accepted socket. A device with an unexplained listener on 39148/tcp answering only that exchange is infected.

The bot walks 27 candidate drop directories in order, probing each with /bin/busybox sh -c 'test -w %s && echo writable || echo not_writable'. The flash-mount entries in that list — /jffs/, /mnt/jffs2/, /overlay/, /nvram/, /mnt/mtd/ — fingerprint the targeted device class. The delivery chain writes .d and .b on the victim and fetches wget.sh, tftp.sh, ftpget.sh, curl.sh and dlr.[arch] from the loader host, so those four script names double as server-side hunting indicators. TFTP, one of the four, is a minimal UDP file-transfer protocol with no authentication, common on embedded devices and often reachable where HTTP is not. Finally, main calls sub_1304c(argv, argc) at 0x11e84, which rewrites the process name via prctl (sub_16fa0); the scanner’s child does the same at 0x1613c. The literal replacement name was not recovered, so no fixed value is asserted.

The forked scanner and killer

The scanner and the killer each run in a forked child. The scanner generates IPv4 targets, connects non-blocking to tcp/23, and authenticates from the 44-entry dictionary at 0x24b1c, which includes vendor-specific pairs for ZTE, GPON/ONT and IP-camera gear; it reads the string usage: busybox in the response as the sign that a login succeeded. On a successful login it types one shell command into the victim’s session, trying wget, tftp, ftpget and curl in turn against the loader host, then chmods and runs the dropped file and invokes ./dvrHelper selfrep. The sample has no execve of its own, so those commands only ever run on the victim. The killer at 0x116cc walks /proc, resolves each pid’s exe via readlink, reads /proc/[pid]/status and /proc/net/tcp, and SIGKILLs rival bots along with management services — telnetd, wget, tftp, curl, login, rlogin, /bin/login — and whatever already holds port 39148.

Strings ruled out as C2 indicators

The pipeline examined two strings in the binary and ruled both out as C2 indicators. The hardcoded TLS ClientHello at 0x2f14c is the payload of DDoS method 0x12 at 0xbbf8; phase-5 hypothesis H1, which read it as the C2 transport, is refuted. The HTTP and JSON templates — GET /api/v1/status, Host: api.svc.local, POST /api/sync — are padding: sub_12454 copies one of four template strings chosen at random from the pointer array at 0x24a10 into each status body, then fills the remainder to a random length between 0x40 and 0x200 bytes with characters from the alphabet at 0x24a20, so a decrypted beacon body carries fragments like GET /api/v1/status HTTP/1.1 / Host: api.svc.local as cover text. api.svc.local is deliberately absent from the IOC set.

Where the artifacts are

protocol_spec.md holds the byte-offset field tables, the offline-decryption recipe and the recommended IDS primitive; the indicators are rows in iocs.csv; and the reproduction/ tools are live-C2 code, touching the network when pointed at a --target or --listen, so run them only in an isolated environment.

Where the obfuscation holds

The config-table cipher and the RC4 over the A records both defeat off-the-shelf tooling: a textbook RC4 implementation decodes only the first 16 bytes of the longer config entries, and a defender resolving a C2 domain learns nothing without the GET/dlr. key. The channel cipher does not hold, given the cleartext key described above. The destination port is drawn at random from 121 entries spanning 38242-46812, so outbound TCP into that range from an embedded or IoT subnet remains a workable alert condition.

Which signature to hunt on

This build is commodity Mirai in its propagation, its credential list and its attack registry. A signature written for Mirai’s 4-byte handshake, although it matches stock builds, does not match this sample’s traffic. protocol_spec.md carries the recommended IDS primitive for that frame format.

The live session that was never captured

The static lane did not establish whether a real C2 ever completes the handshake, what it sends as a type-3 or type-7 command, or the sample’s runtime timing, retry and post-execution behaviour. Resolving the C2 host would show which addresses it currently returns and whether it still answers on the recovered port.

Family
mirai
First seen
November 12, 2026
Vector
Runs as a ddos-bot/worm; the entry vector is not established by static analysis
Format
126 KB arm ELF 32-bit LSB executable
VirusTotal
42/75 engines: trojan.mirai/usblje26
Tags
arm · ddos-bot · elf · raw_tcp · scanner · worm
Sample
By request. Email security@kinryu.sh

SHA-256

  • 3593f42cb9f63aa7a8bf1ffa54cfcc3fc9f5bc12d6e0a510b5c46ff14ca5b7c4 as captured

Analysis performed using an automatic malware analysis pipeline using Binary Ninja

← All captures