Honeypot capture

mirai

C2 verifiedProtocol documented

A MIPS Mirai derivative captured by a honeypot sensor network transmits the key that obfuscates its C2 payloads in clear. C2 is the channel an infected machine uses to reach its operator for instructions. Static analysis of the 121,200-byte ELF recovered three C2 endpoints, a 16-byte binary frame, four message types, and two test vectors that replay through a dissector built from the sample’s own parse code.

The reproduction/ tools touch the network only when explicitly pointed at a --target or --listen, so run them only in an isolated lane.

The build targets two architectures, led by mips and mipsel, which aims the campaign at routers, cameras and other embedded devices rather than at servers, and devices of that kind are rarely patched, rarely monitored and permanently online. The sample copies itself to further machines with no user action, through the telnet scanner and the busybox dropper described below.

On start the sample RC4-decrypts an embedded string table, learns its LAN address through a UDP connect to 8.8.8.8:53 followed by getsockname (0x412ee4), takes a single-instance lock on TCP/39148, registers its flood handlers, then forks into the background. It resolves lkol.dyn (primary) or bigr.dyn (fallback) through a hand-rolled DNS client over eight hardcoded resolvers and beacons every 30 seconds on a TCP port drawn at random from 121 entries spanning 38242–46812. Execution needs only user privilege.

SHA-256  a91554620e9ca25fc024cf20768060da5ccaef1121d1e27230e55a9a1f7624e0
MD5      0bd77e851f22db25ab54d607b09860a4
SHA1     03131d47cddcde709ef1f198568e40eebb49b70b

The RC4 string table and its key schedule

The sample carries the C2 addresses as RC4 ciphertext and decrypts them at startup. table_init registers each blob by slot index, pointer and length:

sub_4126c8(0, 0x41ba30, 8)   ; table_init registers RC4 ciphertext for slot 0
sub_4126c8(1, 0x41ba24, 8)   ; table_init registers RC4 ciphertext for slot 1
; RC4(key@0x41ba70, XOR-swap KSA) -> 'lkol.dyn'

The sample hardcodes the 256-byte key at 0x41ba70, and the indicator rows record it in full. The decoder at 0x4126c8 differs from textbook RC4 in its S-box swap, which uses the three-XOR trick and therefore zeroes S[i] when i == j. With this key that happens at i = 17 and i = 112, so a decoder has to reproduce the deviation to decrypt correctly. The verifier re-implemented it independently and recovered the same domains.

The resolver reads the table entry for whatever slot index it is given, with that index bounded at three:

resolver: idx bound 'arg2 u< 3' at 0x40aba8; reads table[idx].val; DNS-resolves
via sub_40eb80; writes sin_addr at 0x40acb8 (random A record)

The third slot decrypts to The Peoples Bank of China. — a prose sentence with a trailing period, which cannot resolve as a hostname. The second decompiler backend agreed on this third value as well as on the other two. The pipeline assigns 0.60 to the reading of that third value as an endpoint, where the choice is between a deliberately dead slot and operator filler. The session loop rotates the endpoint index (i+1) % 3 with attempts at least 2 s apart.

The wire format

The header is 16 bytes and big-endian on a little-endian CPU, so the pipeline read the field layout from the byte stores — session tag (4), version 0x03 (1), type ^ key[0] (1), flags (1), a zero byte, sequence (4), length (2, capped at 0x400) and an additive checksum (2). The sample builds the header at 0x40e1b0 and parses and validates it at 0x40dd1c.

The sample obfuscates only the payload, applying the 4-byte key under a counter shared across both directions. The key is generated per session at 0x40dc1c and sent in clear in the bot’s 8-byte opening handshake, so an interceptor needs the first eight bytes of a session and nothing else. The key changes from session to session, which points to a signature keying on the invariants instead — version 0x03 in the fifth byte and a valid trailing checksum. The HTTP-looking strings on the wire come from the HTTP-template padding at 0x40d9ec and are camouflage for a casual observer.

Port selection reads straight out of the pool:

lhu $a3, 0($v0)  ; $v0 = ((rand()%0x79)<<1) + 0x41ad4c ; reads one of 121 u16
                 ; ports (38242-46812), byte-swapped into sin_port at 0x40bc38
return sub_416990($a0_4, 0x45cf40, 0x10, $a3_10)   ; connect() to the resolved
                                                   ; C2, port from the 0x41ad4c pool

Four message types, of which two are dispatch opcodes Recovered from the dispatcher at 0x40b70c and the outbound builders. “Second backend” marks claims an independent decompiler confirmed in the consensus round; the rest are single-tool Binary Ninja readings anchored to the file offset shown.

TypeHandlerDirectionBehaviourSecond backend
20x40b7c0C2 → botrequest an immediate status reportconfirmed
30x40045cC2 → botattack command into the 15-method registryconfirmed
10x40e1b0bot → C2status reportsingle-tool
40x40b800bot → C2ACK of a type-3 commandsingle-tool

Because types 1 and 4 are outbound builders and the dispatcher branches on inbound traffic only, the consensus round declined to confirm them as dispatch opcodes (09_consensus.md D2/D3). Decoding a session yields a victim’s bot id from a type-1 report. The sample takes that id at startup from the KERN_SECURELEVEL environment variable, falls back to argv[1], and watermarks it PBOC. Any inbound type-3 yields the full tasking — duration, method and the complete list of {target, prefix} victims.

The flood registry and the telnet scanner

The attack_init registry at 0x400908 holds fifteen volumetric methods, nine of them named here as UDP, SYN, ACK, STOMP, GRE, Valve Source Engine, HTTP, TLS-ClientHello and HTTP/2, and the Source Engine flood sends TSource Engine Query to port 27015.

The embedded TLS 1.3 ClientHello at 0x45ce28 and HTTP/2 preface at 0x41ac90 are flood payloads, registry ids 18 and 19, replayed verbatim at targets; the pipeline ruled both out as C2 transports. The ClientHello goes out truncated and with all-zero randoms, which is consistent with a flood packet.

The sample runs 1500 concurrent sockets against telnet, using a 96-pair default-credential dictionary that it assembles at 0x40f3e8 and aims at admin accounts. The strings /bin/busybox, assword and ncorrect are the diagnostic Mirai signature carried by its builds. On a successful login the sample builds busybox wget, tftp, ftpget and curl command lines and sends them to the victim to fetch an architecture-matched stage 2; TFTP is a minimal file-transfer protocol over UDP with no authentication, common on embedded devices and often reachable where HTTP is not. The sample makes no local execve, which points to the dropper running on the victim instead. A dropper writes another program to disk and runs it, and this one writes .d, .b or .k into a writable directory, sets the executable bit and runs it.

Host artifacts

Five host artifacts an infected device leaves Each anchored to the file offset where the value is read or written, with the pipeline’s per-claim confidence. All five are single-tool readings.

KindValueContextOffsetConf
mutexTCP/39148 + magic BOT\x01TAKEbind 0.0.0.0:39148; on conflict connect 127.0.0.1:39148 and send the magic to kill the prior instance0x40b56c0.90
processdvrHelperstage-2 payload name, invoked dvrHelper selfrep0x41b5c80.80
processPBOCvictim hostname watermark, set via busybox hostname PBOC0x41b4780.80
env varKERN_SECURELEVELread at startup as bot id, falling back to argv[1]0x40cf2c0.80
filepath.d / .b / .kdropped stage-2 names, chmod +x .d; ./.d0x41b5c80.70

The sample sets up no persistence: it writes no init script, no cron entry, no systemd unit and no ld.so.preload entry. The bot is memory-resident and depends on reinfection, and its eradication routine at 0x40be88 assumes the same of its rivals, because it walks /proc and sends kill -9 to any process whose /proc/[pid]/exe is marked (deleted), a marker that identifies memory-resident processes.

The family call at 0.75

The family is Mirai, derivative, at classification confidence 0.75. That confidence is held down because neither capa nor a YARA rule set was available to corroborate it, as noted in the method above. The call therefore rests on structure and strings — the RC4 {ptr,len} table driven by table_init/add_entry, the attack registry, the brute-forcer, the busybox dropper, the socket scanner. The pipeline classifies the sample as a derivative on the strength of five divergences from stock Mirai: RC4 in place of single-byte XOR, the checksummed frame and rolling XOR described above, the HTTP-template camouflage, the C2 port pool, and six added attack ids.

The nine capability claims

Only two of the nine capability claims were confirmed by a second decompiler Each row is anchored to a file offset, with the pipeline’s own confidence.

CapabilityATT&CKMBCOffsetConfSecond backend
Custom binary C2 over raw TCPT1071B00300x40b9b00.90confirmed
Config obfuscation (RC4 string table)T1027C00310x4126c80.95confirmed
Obfuscated channel (rolling XOR, key on the wire)T1573.001C0027, C00310x40e2700.90single-tool
Network denial of service (15 methods)T1498—0x4009080.90single-tool
Telnet brute-force propagationT1110.001—0x40f3e80.90single-tool
Local-IP discoveryT1016—0x412ee40.90single-tool
Remote payload fetch (busybox dropper)T1105—0x41168c0.85single-tool
Command dispatchT1059.004—0x40b70c0.85single-tool
Competitor-malware eradicationT1562—0x40be880.80single-tool

The PRNG seed and the flood packets

The seed source of the 4-word xorshift PRNG at 0x40e524 was not traced to a concrete value, and the quality of that PRNG bears on the predictability of the port pool and the per-session key. The per-method packet construction of the fifteen flood handlers, including the TLS-ClientHello internals at 0x404c24, is not fully reversed either; transports and ids are classified.

Family
mirai
First seen
November 25, 2026
Vector
Runs as a ddos-bot/worm; the entry vector is not established by static analysis
Format
118 KB mips ELF 32-bit LSB executable
VirusTotal
33/75 engines: trojan.mirai/r002c0djn26
Tags
ddos-bot · elf · mips · raw_tcp · worm
Sample
By request. Email [email protected]

SHA-256

  • a91554620e9ca25fc024cf20768060da5ccaef1121d1e27230e55a9a1f7624e0 as captured

Analysis performed using an automatic malware analysis pipeline using Binary Ninja

← All captures