Diamorphine
- Type
- Rootkit
- Capabilities
- Defense evasionPrivilege escalation
- Platforms
- LinuxCloud
Diamorphine is a publicly available, open-source Linux loadable-kernel-module rootkit used to conceal malicious activity and manipulate process privileges. Its capabilities include hiding processes, concealing its own kernel module, hiding files and directories with a designated name prefix, and granting root privileges to a process. It intercepts directory-enumeration system calls such as getdents and getdents64 to filter visible entries and uses special signals passed through the kill system call to control hiding and privilege changes.
Diamorphine implements system-call interception by replacing handler pointers in the kernel syscall table. Updated versions use a kprobe-based technique to resolve otherwise unexported kernel symbols. Its traditional syscall-table interception is constrained by kernel compatibility: on x86-64 Linux 6.9 and later, syscall dispatch no longer uses that table. Deployment commonly involves compiling the source against the victim's kernel and loading the resulting module, requiring existing kernel-module-loading privileges.
TeamTNT has repeatedly deployed Diamorphine in Linux cryptojacking campaigns to hide cryptocurrency-mining processes, including XMRig. Observed environments include cloud-hosted Linux servers and Docker infrastructure. Campaigns deploying the rootkit have gained access through exposed or misconfigured container services and SSH brute-force attacks, after which shell scripts download or unpack its source, compile it locally, and load it. Diamorphine serves as a post-compromise stealth and privilege-manipulation component rather than the cryptocurrency miner itself.
Associated threat actors
1 distinct threat actor Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
The group started using a Linux Kernel Module (LKM) rootkit named Diamorphine to hide their activities on infected machines.
Techniques & procedures
10 distinct techniques documented for this family, organized by ATT&CK tactic.
Execution
1 technique
Execution
The threat actor uploaded a malicious script... After the execution, the script implements several changes affecting the security configuration of the system...
Persistence
1 technique
Persistence
Reptile’s loader directly invokes the init_module syscall with an in-memory decrypted kernel blob... Effective detection should therefore focus on tracing these syscalls directly.
Privilege Escalation
3 techniques
Privilege Escalation
The signal SIGSUPER = 64 obtains root privileges by committing new credentials with uids = 0.
Reptile’s loader directly invokes the init_module syscall with an in-memory decrypted kernel blob... Effective detection should therefore focus on tracing these syscalls directly.
For instance, a rootkit might intercept a specific high-numbered kill signal (e.g., kill -64 <pid>). Upon receiving this signal, the rootkit's payload could be configured to elevate privileges, execute commands, toggle hiding capabilities, or establish a backdoor.
Stealth
5 techniques
Stealth
MITRE ATT&CK catalogs the technique as T1014 under defense evasion.
Stripping binaries and appending a single null byte significantly degraded static detections; limited XOR string/configuration encoding and lightweight packing were also used.
This empowers a rootkit to filter the output of the ls command to hide malicious files or prevent a specific process from being terminated.
The demonstration hooks getdents/getdents64 so that a file named “malicious_file” is hidden from ls output. The content notes that getdents is commonly hooked by LKM rootkits.
exec_f : Hides the malicious processes of masscan and md service executed.
Command and Control
1 technique
Command and Control
the threat actor uploaded a malicious script... it downloads a bash script from update.aegis.aliyun.com... the script adds a cron job that downloads a copy of the patload every 30 minutes from the command-and-control (C2) server with IP address 65.108.48.150
Observables
3 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
Recent activity
19 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.