Backdooring A Router
Backdooring A Router
Arttu Ylä-Sahra
The first step is determining the appropriate version to start with. As far
as I know, TP-Link devices have differences across regions, and it cannot be
said for sure what is appropriate for a given device without inspecting the
device itself.
This is accomplished by connecting the device to a special test setup, as
seen here. Personal networking configuration allows me to provide the rou-
ter with an isolated access, so that it cannot connect to the ”secure”/LAN
network out of the IoT/”Proxmox”network. It does provide an Internet con-
nection though, so it can be easily used for practical testing.
Ensuring the router is in 3G/4G mode, which makes it operate as a NATing
router, I log in using the default credentials (having factory reset the router
beforehand), and find the correct version details quickly.
I do not have the time or patience to start diagnosing uclibc issues. Let’s
try musl instead.
YES! This looks more like it. Let’s add that to the path.. and compile a
little test program
Good. This proves our compiler works - although, we will need to use a
statically compiled program as in the blogpost, due to the fact that MR3020
uses ulibc, and we use musl. These are almost certainly not binary compatible
with each other, so we need a program that runs independently without
reliance on system libc. My MIPS assembly skills are very weak, so we must
accept the trade-off of larger program size for now.
Due to, again, time constraints (I’m overdue for a vacation!), we are going
to settle for a simple TCP shell. Not the most refined method, but highly
effective in allowing further tampering. The full source of this shell (including
appropriate credits) will be included in the attached ZIP file.
After some hour of bodging, I have a functional TCP shell
And with a few more commands, also neatly cross-compiled in a way that
it does not depend on any dynamic libraries, stripped to reduce space needs
10
11
12
Nevertheless, we now have working root access at our disposal. And this
is one of the most dangerous tools a hacker can have in case of an embedded
device. Our job is done.
That’s about it. Last step is appropriately marking the state of the router,
so that it won’t accidentally get mixed up with benign devices.
14