HeadCrab is a custom Redis-targeting malware family used to compromise internet-exposed Redis servers and conscript them into a botnet primarily associated with illicit cryptocurrency mining. Activity attributed to HeadCrab has been observed since at least 2021, and the malware has been linked to large-scale server compromise campaigns affecting well over a thousand Redis instances.
The malware is implemented as a malicious Redis module and is notable for its emphasis on stealth, in-memory execution, and abuse of legitimate Redis functionality. Early variants compromised exposed Redis servers by abusing Redis replication, using master-replica synchronization to deliver and load a malicious module. Once active, HeadCrab operated largely filelessly, minimized disk artifacts, tampered with or truncated Redis logs, and used memory-backed execution mechanisms to hinder forensic recovery and signature-based detection.
HeadCrab exposes attacker-controlled functionality through malicious Redis command handling. Earlier variants introduced custom Redis commands to support remote command execution, encrypted command-and-control, configuration manipulation, and other post-compromise operations. The malware also overrode selected native Redis commands to obstruct inspection and interfere with defensive analysis. Reported capabilities include execution of shell commands, encrypted communications, persistence-oriented configuration changes, and memory-only loading of additional components.
A later evolution, commonly referred to as HeadCrab 2.0, increased stealth by replacing direct on-disk deployment of the main payload with a loader-based approach that receives malware content over the Redis communication channel and stores it in a fileless location on the host. It also abandoned easily detectable custom command names in favor of abusing the legitimate Redis MGET command for covert command-and-control, while preserving normal behavior for benign users. This version additionally manipulated lower-level Redis internals to redirect command processing, making detection more difficult.
HeadCrab is associated with a threat actor of the same name and is focused on Linux-based Redis server environments. Its operational objective has been characterized primarily as resource hijacking for cryptomining, but its command execution and remote-control features make it a broader post-exploitation platform for compromised Redis infrastructure.
12 distinct techniques documented for this family, organized by ATT&CK tactic.
“rdss Executes a command with popen… 0x4/0xD: execute a shell command with HISTFILE… /dev/null.”
“install systemd service or initd service to /etc/ice9j or /etc/init.d/ice9j respectively… masquerade as an sshd service”
“load a kernel module from memory using init_module syscall”
“adds an LD_PRELOAD entry for each new connection, allowing the threat actor to steal ssh keys.”
“install systemd service or initd service to /etc/ice9j or /etc/init.d/ice9j respectively… masquerade as an sshd service”
“load a kernel module from memory using init_module syscall”
“The dynamic loader can be used to execute process under its name… bypass security solution… Since the dynamic loader is a legitimate binary…”
“perform a timestomping attack, which modifies the last change time to that of a legitimate file.”
“Payloads are loaded through memfd, memory-only files… avoiding disk writes.”
“adds an LD_PRELOAD entry for each new connection, allowing the threat actor to steal ssh keys.”
“some of the Redis default commands… are being overridden… This is done to avoid the malware detection.”
“logs are deleted using the Redis module framework and API… deletes the Redis log file and empties it… truncating it to size 0.”
“adds an LD_PRELOAD entry for each new connection, allowing the threat actor to steal ssh keys.”
“rdsc… enables to establish an encrypted communication channel with a C2 server… [and] tunnel network to another IP address and port pair…”
“tunnel network to another IP address and port pair… listen to a new connection and tunnel communication back to C2 connection.”
“main impact… resource hijacking for cryptocurrency mining… XMRIG malware written and executed in-memory.”
5 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
3 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.