Mosquitto
Hacking
Remote Code Execution in Smart
Router
@smrx86
WHoami
WHoami
Father of one son
Security consultant @xynexis
Int’l since 2015
Independent security
researcher.
Speaker @Idsecconf 2013,
2014, 2015, 2019,
2020.2022,2023, 2024
Agenda
Defining MQTT
Agenda
The targets Analysis Exploitation
Agenda
Relevant research
Defining MQTT
~ Wikipedia: MQTT
(originally an initialism of MQ Telemetry Transport[a]) is a lightweight, publish-subscribe, machine to
machine network protocol for message queue/message queuing service. It is designed for connections
with remote locations that have devices with resource constraints or limited network bandwidth, such as
in the Internet of Things (IoT). It must run over a transport protocol that provides ordered, lossless, bi-
directional connections—typically, TCP/IP.[1] It is an open OASIS standard and an ISO recommendation
(ISO/IEC 20922).
MQTT publisher
33%
MQTT
Topology
MQTT Broker
33%
MQTT Subscriber
33%
Smarrouter ruijie EW-300N.
The Targets
The Targets
The Targets
The Targets
The Targets
The Targets
system type : MT7628
machine : EW300N
cpu model : MIPS 24KEc V5.5
MemTotal : 59720 kB
WAN port : 1
LAN port : 4
Voltage : 12V 1Ampere
Flashrom : SOIC NOR FLASH 16 MB MD AY2329 25Q128S18
ReyeeOS 1.300.1422
Firmware
analysis
o
p
Firmware Ekstraction
Via flashrom (failed)
Firmware Decryption
Firmware Decryption
http://www.hzhcontrols.com/new-2062820.html.
Firmware Decryption
Sniif mobile app with Burpsuite
Dynamic Analysis
debug web cloud
Dynamic Analysis
TApp WAN port with WIRESHARK
Dynamic Analysis
TApp WAN port with Non-HTTP Proxy Extension for
Burp Suite (NoPE) https://github.com/summitt/Nope-
Proxy
Dynamic Analysis
Mapping
MQTT message from
broker
message from router
(mqtt_pub) to MQTT
broker
Vulnerable router service
(/usr/sbin/mqlink.elf ~ CVE-2024-42936)
Vulnerable router service
(/usr/sbin/mqlink.elf ~ CVE-2024-42936)
Exploitation
Exploitation
Exploitation
Exploitation (POC)
https://gist.github.com/
smrx86/2008111b12ab47882b3928d0cbc9e415
Exploitation
Exploitation (POC)
Solutions
Solutions
. - wait for fixed firmware
. - Don’t buy this product
FIN

IDSECCONF2024 - Rama Tri Nanda - MQTT hacking, RCE in Smart Router.pdf