A 45 MB SSH drop, nine layers deep: taking apart a Diicot kit that breaks UPX, GoReSym and the garble decryptors
Caught by tarpit.pro
A Go SSH client logged into one of our honeypots as root on 26 November at 23:59 UTC, ran five sessions of host profiling and then dropped a single 45,989,484 byte ELF. Static Go binaries are big, so the size meant nothing on its own. What made us stop was that every tool we pointed at it failed in a different way: upx -d said NotPacked, GoReSym found no pclntab, readelf printed garbage section headers and Mandiant's GoStringUngarbler recovered zero strings.
Nothing below was executed natively. Every layer was read from bytes on an isolated analysis box. The encrypted Go strings were recovered with a restricted emulator that runs only the decode routines.
Layer map
The file is a dropper carrying an installer that carries seven payloads. Every layer is packed again.
| Layer | Role | Packed / unpacked | Strings decrypted |
|---|---|---|---|
| L0 to L1 | UPX, magic tampered | 46.0 MB / 49.4 MB | 595 |
| L2 to L3 | installer (Go, garble) | 44.4 MB / 58.1 MB | 3,282 |
| L4 | stealth launcher | 3.0 MB / 6.6 MB | 796 |
| L5 | LAN and SSH worm | 3.7 MB / 12.6 MB | 1,636 |
| L6 | passwd alias hijack | 5.1 MB / 7.9 MB | 521 |
| L7 | fake passwd and chpasswd | 3.8 MB / 13.1 MB | 1,802 |
| L8 | brute spreader and C2 client, embeds masscan | 8.1 MB / 26.8 MB | 4,225 |
| L9 | miner launcher | 18.3 MB / 27.5 MB | 1,847 |
| L10 | WildRig-ng GPU miner (C++) | 14.3 MB / 84.4 MB | plain |
Trick 1: UPX with a different magic
UPX marks its files with UPX! in the packheader and in the EOF record. upx -d refuses anything without it. The author rewrote every UPX! as UKR!. The decompression stub inside the file never checks the magic, only the upx tool does, so the binary runs and the standard unpacker is blind. Patching the four bytes back is enough for the stock layers.
Trick 2: forged section headers
The packed layers claim e_shoff = 344 and e_shnum = 14, which puts the section header table in the middle of the program headers. The kernel loads from program headers only and never reads sections, so the process starts fine. Disassemblers, readelf and GoReSym trust the section table and read junk. Ignoring the section table and working from segments gets the tools going again.
Trick 3: garble, newer than the public tools
Every Go layer is built with garble, the open source obfuscator. It hashes every package and symbol name (the standard library included) and replaces each string literal with a small decode closure. It also patches the Go linker to write a random magic into the pclntab header and patches the runtime to expect it. We found eight different magics across eight Go binaries:
L1 08427f5d L3 64573f5c L11 19cd65b4 L12 5a82b77a L13 6e9721a0 L14 5ce86efc L15 7ecf456e L16 e5649c93
The runtime check is easy to find once you know it's there. In L15, runtime.moduledataverify1 at 0x488fc0 does cmp edx, 0x7ecf456e. textStart in moduledata is zeroed too. Tools that locate the pclntab by the standard 0xfffffff1 magic find nothing.
The build is garble 0.14 or later with Go 1.24 or later (the Go 1.26 mallocgc size class variants are present) and predates garble's runtime name obfuscation, so runtime function names are still readable. GoStringUngarbler supports Go 1.21 to 1.23 and garble up to 0.13, which is why it returned nothing.
So we wrote our own. A garble literal decoder is a short function that builds a byte array from immediates, runs a few rounds of XOR, add and rotate over it, then calls runtime.slicebytetostring. Our emulator is a small x86-64 interpreter that runs every function able to reach that call, from its entry and from each block start inside it. It tracks for every register and memory byte whether the value follows from the binary alone. A branch on unknown flags or a load through an unknown address ends the run (it never guesses), runtime calls are answered by hooks instead of real syscalls and only strings whose every byte is known are kept. It decrypted 14,000+ strings across the seven Go layers. Author code (package main) decodes almost completely. In the biggest layer 1,465 of 5,689 casters stayed encrypted, almost all in third party packages.
Trick 4: a self-built UPX for the miner
The GPU miner gets more care. It is packed with a UPX 5.30 the author compiled themselves. The second stage loader (NRV2B, 6,141 bytes at 0xd9d5bc) still checks for UKR!, then unmasks each block header when b_extra == 0xe1:
sz_unc ^= 0xb4739a21 sz_cpr ^= 0x6d2e8f45 method ^= 0x3b ftid ^= 0x51 cto8 ^= 0xc7
Every compressed block is preceded by a 0x74 byte decoy header carrying the marker 7d31a6c9e25b840f, so a parser that walks blocks in order trips on junk. The blocks are LZMA (0x1f0 headers of 680 bytes, then 78,365,948, 104,200 and 5,938,432 bytes). The loader maps the result through memfd_create("upX"), which is stock UPX 5 behaviour. Reversing the mask gives back an 84 MB WildRig-ng binary with CUDA and OpenCL backends, a 5.9 MB RWX segment (a code virtualiser) and a build path that says it was compiled under WSL: /mnt/d/wildrig/wildrig-ng-claude/_deps/virtualizer/lib/linux.
The installer
The installer profiles the host: /etc/os-release, uptime, CPU model, RAM, the GPU through nvidia-smi --query-gpu=name and rocm-smi --showproductname, its public IP from ten IP echo services and geo and ISP from ipinfo.io and ip-api.com. It reports to 103.160.59[.]94 on three ports (10519, 56609 over HTTPS and 57917), each with its own path and bearer token.
Payloads go into /usr/local/bin with systemd units like this one, plus an @reboot cron line in case the unit is removed:
[Unit] Description=System Service for %s [Service] Nice=-20 Restart=always RestartSec=3 KillMode=process
Service names come from two pools. One holds real names (systemd-logind, systemd-resolved, NetworkManager, wpa_supplicant, rsyslogd), the other invented names that survive a quick systemctl list-units (systemd-logclean, systemd-netflush, hostguardd, arpguardd, pamhelperd, auditrotated).
The seven payloads
L4, launcher. Runs an embedded binary from a memfd under the name [kworker/u8:2] and restarts it on exit until "max consecutive retries reached".
L5, worm. Carries a password list (11111111, admin123, p@ssw0rd, qwe123!@#, testserver and more), finds neighbours from the neighbour table (REACHABLE entries) and IPv6 multicast to ff02::1 and keeps host lists in .publish_hosts under /var/tmp, /tmp or /dev/shm. The deploy line tries curl, then wget, then a raw HTTP GET over bash's /dev/tcp to 103.160.59[.]94:28816, writes ~/.sysmonitor, runs it and finishes with history -c && history -w. Its error for a non local address is in Romanian: "nu e ip local".
L6, alias hijack. Plants alias passwd='<path>' in .profile and hides its file as .X11-unix, icon-theme.cache or .gvfs-metadata.
L7, credential capture. Byte for byte clones of passwd and chpasswd from shadow 4.13, help text and error messages included. When an admin changes a password the clone writes a valid SHA-512 crypt to /etc/shadow (through Python's crypt or mkpasswd) so nothing looks wrong, keeps passwd.orig and posts the new password with its own HTTP client using a curl/7.68.0 user agent.
L8, brute spreader. The engine of the botnet. It opens a WebSocket to an "IP distributor", reports a hardware badge (CPU and RAM) and receives target waves sized to it. The server commands are role_change (dedicated_scanner or brute_only), masscan_toggle, masscan_settings, reject_ips, stop, restart and an arbitrary shell command. An embedded masscan is installed to /usr/bin/masscan and run as exec -a kworker/u8:0 masscan -p<ports> --rate=<n>. Hits stream back every 5 seconds and successful logins (user, password, port, nproc, uname) go to 45.10.20[.]53 on ports 8000 and 47 at /save-data. A tuner watches CPU and RAM and scales the brute force load. Self update comes from the C2's /version and /download/brute with a HACHIRU_SECRET_KEY header and a hash check.
L9, miner launcher. Checks who already uses the GPU (nvidia-smi --query-compute-apps, rocm-smi --showpids, DRM VRAM from /proc/<pid>/fdinfo) and starts the miner against 108.165.65[.]126 and 2400:8d60:3::1:afab:ca00 over stratum TCP or SSL, algorithm pearlhash, wallet prl1p234hw29dk6ncj8y0lp0j8m5dwpy9puykjajwn0xr8uwlcldgaqhsnyft4a. Service names for GPU boxes come from their own pool (gpu-monitord, cuda-helperd, vram-watchd, tensor-bridged) or real ones (nvidia-persistenced, containerd, kube-proxy, node_exporter, fail2ban-server).
L10, the miner described above.
Persistence and cleanup
The spreader installs crontab entries at @daily, @reboot, every minute and @monthly, two scripts .b and .c (every 30 minutes), a cache watchdog and a fetch-and-run from 195.24.237[.]240/.x/black3 with a fallback at digital.digitaldatainsights[.]org/.x/black3. Helper scripts History and Update live in /var/tmp/.update-logs. On arrival it removes the competition: crontab -r, chattr -iae ~/.ssh/authorized_keys and deletion of /dev/shm/.x, rete*, /tmp/.diicot and /tmp/kuak, then clears shell history.
How it decides you're a honeypot
After a successful login L8 runs a checklist and drops the target if any check fails:
- it tries
totallywrongpassword123first, because a server that accepts a wrong password must be a honeypot nprocreturns nothing or "command not found"unamelooks locked, empty or like a fake PTY- the shell shows a busybox or stock Debian signature
- the
sysmonitorit just launched is missing fromps -x
Honeypots are reported to the C2 as honeypot_report so the whole botnet skips them. And when three scan rounds in a row yield too few new victims the bot reports "low fenta" and sends miner_request: a machine that's no longer useful for spreading becomes a miner.
Attribution
The code names itself. Variables are operaName and diicotName, the cleanup removes /tmp/.diicot, the client ID lives in /tmp/.gogu_cid, the timezone is Europe/Bucharest and the debug output is Romanian ("Scriptul History va fi creat in", "Apelam setupCronJobs cu", "INAINTE/DUPA rename"). That matches the Romanian cryptojacking crew public research has tracked as Diicot (also Mexals).
We had met this botnet before without knowing its name. One source, 109.160.32[.]45, ran L8's deploy recon against our sensors 1,284 times in 30 days, character for character: uname -m | awk '{printf $1}', uptime | grep -ohe 'up .*', nproc, lspci | egrep VGA && lspci | grep 3D. That's an infected machine doing the spreading. None of the kit's own infrastructure ever touched us.
Indicators
Dropper sha256 b00d0c00296be5f7052a8dc5168947bdde1b96e5601c51aded32cd88c42c1429 (45,989,484 bytes)
Delivery 77.239.124[.]42, SSH root password login, Go SSH client
Spreader 109.160.32[.]45 (infected host)
C2 103.160.59[.]94 tcp/10519 tcp/28816 tcp/56609 tcp/57917
Loot 45.10.20[.]53 tcp/8000 tcp/47 /save-data
Fetch 195.24.237[.]240/.x/black3 digital.digitaldatainsights[.]org/.x/black3
Pool 108.165.65[.]126 2400:8d60:3::1:afab:ca00 (pearlhash)
Wallet prl1p234hw29dk6ncj8y0lp0j8m5dwpy9puykjajwn0xr8uwlcldgaqhsnyft4a
Files ~/.sysmonitor /var/tmp/.update-logs/{History,Update} /var/tmp/Documents/.diicot
/tmp/cache /tmp/.gogu_cid /tmp/.ipd_worker.lock {/var/tmp,/tmp,/dev/shm}/.publish_hosts
/usr/bin/masscan (not from a package)
Processes kworker/u8:0 and [kworker/u8:2] with a real /proc/<pid>/exe, Update, cache, sysmonitor
Units Description=System Service for ... with Nice=-20 and KillMode=process
Shell alias passwd=... in .profile or .bashrc; dpkg -V passwd / rpm -V shadow-utils failsrule diicot_upx_ukr_magic
{
meta:
description = "Diicot SSH kit: UPX packed ELF with the UPX! magic replaced by UKR!"
author = "TarPit.pro"
reference = "b00d0c00296be5f7052a8dc5168947bdde1b96e5601c51aded32cd88c42c1429"
strings:
$ukr = "UKR!"
$info = "$Info: This file is packed with the UPX"
condition:
uint32(0) == 0x464c457f and $info and #ukr >= 2
}
rule diicot_upx_masked_blocks
{
meta:
description = "Diicot SSH kit: self-built UPX 5.30 with masked b_info and a 0x74 byte decoy header per block"
author = "TarPit.pro"
strings:
$decoy = { 7d 31 a6 c9 e2 5b 84 0f }
condition:
uint32(0) == 0x464c457f and #decoy >= 2
}Every infection path in this kit starts with a password from a list. Turn off SSH password logins and the whole thing has no way in.
We caught it because the root password it guessed belonged to a TarPit.pro honeypot. Every login, command and upload on those decoys is recorded, which is how a 45 MB file ends up on an analysis box instead of a production server.