TRANSCRIPTEnglish

I Hacked This Temu Router. What I Found Should Be Illegal.

15m 47s3,409 words452 segmentsEnglish

FULL TRANSCRIPT

0:00

One of my favorite things to do is to

0:01

buy weird devices and see if I can find

0:03

vulnerabilities in them. You know,

0:04

typically embedded devices tend to have

0:06

the worst security. So, it's kind of a

0:07

fun exercise in bug hunting. Now, what I

0:10

want to show you today is the story of

0:11

how I found several egregious

0:14

vulnerabilities. And this device here on

0:16

Teimu, you know, it's kind of fun. Go on

0:17

T-Mo, you buy a $5 device and you see

0:19

what you can do. Now, I want to

0:21

highlight here uh that this not only was

0:23

$30 and now it's only $5. There's 84%

0:25

savings, but also it is the number one

0:28

bestselling item on Teimu in Wi-Fi and

0:31

networking with over a 100,000 sold. So,

0:34

from a general security of the world

0:36

perspective, not a great place to be. In

0:38

this video, we're going to go into how I

0:41

took the device apart, opened the

0:42

firmware, and found some pretty

0:43

egregious issues. And watch as my hair

0:46

grows and I change my shirt. So, when

0:48

you plug in this device and you navigate

0:50

to the IP address for that thing, you'll

0:52

see this interface. Now, a bad habit

0:54

that I typically have when I audit a new

0:57

uh weird embedded device is I typically

0:59

try to put this little oneliner in here.

1:01

And you'll see why this is bad. So, what

1:03

I'm attempting here is my assumption is

1:05

that it's a piece of trash embedded

1:08

device and they're just passing this

1:09

Wi-Fi password parameter to a system

1:11

call and they're not sanitizing the

1:13

input. A way that I can quickly validate

1:15

that without pulling any of the firmware

1:17

out of the device is by doing a reboot

1:20

command injection by putting the dollar

1:22

sign in these two brackets. It's a

1:24

command injection, which means that

1:25

it'll run an arbitrary system command if

1:27

it's vulnerable. And the system command

1:29

that I want to run is reboot. Now, what

1:31

you'll see here is I go to restart the

1:33

device, which is intentional, right?

1:34

I've set the properties of the device.

1:36

Uh, but we'll see here after a couple

1:38

refreshes that uh it does not come back

1:40

to life. What this means is I have

1:43

rebooted the device in NVRAM. I put the

1:47

password of the device in NV RAM and

1:49

then every time it tries to come back

1:51

up, it's pulling that password out from

1:53

NV RAM and triggering a vulnerability,

1:55

rebooting it. I have now soft bricked

1:57

the device. But what's good about this

1:59

actually led me to the next piece of the

2:01

puzzle, which helped me get the firmware

2:03

out of the device on accident. Now, when

2:05

I typically do this to a device, what I

2:07

like to do is go to the device and hold

2:08

the reset button. If you hold it for

2:10

long enough, what that typically does is

2:12

it tells the device, "Hey, I want to

2:14

reset to factory settings, and that will

2:16

typically erase the malicious and VRAM

2:18

that I put in there, and it should undo

2:20

the soft brick that I did." When I was

2:22

doing this myself, I held the reset

2:24

button for 60 seconds, and this popped

2:26

up. Now, you will notice that the IP

2:28

address here changed. I had to kind of

2:29

fight with it to get it to respond to

2:31

me. I had to look in Wireshark to see if

2:32

I was going to get any like random

2:33

broadcast from a new IP address. But

2:35

eventually I got to this breed web

2:38

interface that showed a fairly low-level

2:40

diagnostic of the board. It looks like

2:42

the build date and like the git commit

2:43

of the server or the software as well as

2:46

the CPU and like the firmware on the

2:48

thing. But if you do a quick little uh

2:50

Chinese to English uh translation here,

2:52

the one thing that caught my eye as a

2:54

vulnerability researcher is firmware

2:56

backup. Now to me, this meant one of two

2:59

things. Either I was able to upload new

3:01

firmware, which is good, or I was able

3:04

to download the firmware, which is even

3:06

better. And luckily, if I press the

3:08

programmer firmware button, I can

3:10

download the entire system full.bin.

3:13

You'll see I've done this other times

3:14

for previous takes of the video. Uh, but

3:16

I'm able to download the firmware for

3:18

the device, which is great. A lot of the

3:19

times that you have to do is like

3:21

desolder a chip off the board, for

3:23

example, like maybe like a a flash chip

3:25

like one of these, and then put it into

3:27

a flash reader. Maybe there's some weird

3:28

like locking going on. The ability to

3:30

just download the firmware automatically

3:33

like this is super cool. So, what we can

3:36

actually do now is go into our downloads

3:38

here. Let's go to downloads and we can

3:40

do a little bin. Binwalk uh recursive

3:43

extraction of full 2.bin.

3:46

And what we should get at a certain

3:48

level is the file system for the device.

3:50

Typically, these things contain file

3:52

system. So, if I go into extractions

3:54

here and I go to the SquashFest route,

3:59

I now have the entire file system for

4:02

the device. This is great. Now, after

4:04

resetting the device, getting it back to

4:05

its normal configuration, doing a

4:06

factory reset, I'm back into the device.

4:09

So, now the question is like, where do

4:10

we go from here? We have the firmware

4:12

over here on this tab, and I have like

4:13

the web interface on this tab. What when

4:15

we're doing research on this thing, what

4:16

do we do? Well, what I'm interested in

4:18

is vulnerabilities that arise from a

4:21

user sending data to a server somewhere

4:23

and there being a vulnerability in that

4:24

server. The server we have access to

4:26

right now is the web server. So, let's

4:28

see if we can identify maybe some

4:30

methods that we can use to trace in the

4:32

firmware where this data is processed.

4:35

Typically, I like to go to the network

4:36

tab and when I reload a page, I see like

4:38

are there any strings that pop out as

4:41

something that may be uh custom or

4:44

something that may be interesting. The

4:46

first thing you may see very obviously

4:47

pretty quickly is this post request to

4:49

this protocol.csp

4:51

fname equals net option equals wizard

4:53

config. There's a bunch of it looks like

4:55

custom stuff going to this protocol.csp

4:58

function. So what I'm going to do now is

4:59

go into the root directory and just grap

5:02

around for protocol.csp. Maybe there's a

5:05

binary name to this. And pretty quickly

5:06

we see that we have an etsy

5:08

lightyroxy.com

5:10

and we could see what's going on in

5:12

here. So, what this means is that every

5:15

request that goes to this protocol that

5:17

CSP, we go to an internal port 81.

5:20

Interesting. That's not super

5:22

interesting, though, because I don't

5:23

really know right now what binary binds

5:25

to port 81. So, let's see if there are

5:26

any other strings near that are

5:27

interesting. What about wizard comp?

5:29

Let's see if we can copy that value and

5:31

do the same kind of thing. Again, we're

5:32

literally just doing searches for

5:34

strings because the strings, we see them

5:35

in the request, so they kind of have to

5:37

exist on the system. And pretty quickly,

5:39

we see they exist in two places. one the

5:42

router.js JS which gets served to us and

5:44

we use it to talk to the device. But

5:46

more importantly this user espin commuos

5:49

little little communism reference in

5:51

there kind of interesting. Uh so what we

5:52

can do now is use this comm binary. We

5:55

can put it into a decompilation and

5:57

analysis framework and maybe find some

6:00

weird vulnerabilities. Let's go try that

6:01

out right now. And what I've done is

6:02

I've opened this com binary. The binary

6:05

literally hosts the web server on our

6:07

device. I put it into gedra. GEDra is a

6:10

reverse engineering and decompilation

6:12

and disassembly framework. So we kind of

6:14

have two main columns here if you're new

6:15

to this world. Basically here in the

6:17

middle we have the assembly, the machine

6:19

code that is being run on the device

6:21

when this binary operates. And then on

6:23

the right we have the decompilation. The

6:24

decompilation is Gedra's best guess at

6:27

what the C code looked like for the

6:29

device. I'm zoom in a little bit here to

6:31

see if I can make it bigger for you

6:32

guys. And so what we have to do now is

6:33

figure out, okay, where do these

6:36

parameters that are getting put into the

6:37

program get parsed? How do we know what

6:40

they do? And can we find maybe either

6:42

other hidden features like back doors or

6:44

vulnerabilities in this program that we

6:46

can exploit for this device? So we can

6:48

do now is go to the defined strings.

6:50

Let's just search for this wizard

6:52

string, right? And we can see pretty

6:53

quickly Gedra has found the wizard

6:55

config string right here. Now you'll

6:58

notice there is a cross reference to

6:59

this and it exists inside of what looks

7:01

like a table. This is a table because

7:04

there is a series of pointers to strings

7:07

and then after the pointer to string

7:09

there is a pointer to a function. Now it

7:11

may be the case that this is just a

7:12

lookup table. If I go to the wizard

7:14

string config right there, this wizard

7:16

config string, I'm going to run this

7:18

function. What we can do to kind of

7:20

validate this assumption is go into

7:22

Gedra's decompilation of it and then

7:24

maybe read what it does. we can read

7:26

some of the strings inside of this. We

7:28

have some function on this work mode

7:30

string, some function on this WAN mode

7:32

string, and then compare this to

7:34

reality, right? If we compare this to

7:37

the other, you know, like pieces of data

7:39

in this request, maybe we can see if

7:42

this is like what's actually going on.

7:44

So, as I was going through all of the

7:45

available options we have, all the

7:47

available commands that we have here,

7:48

this one caught my eye. So, you see this

7:51

is time config, right? This is likely

7:52

what we can use to configure the time of

7:54

the device. But if you go into here and

7:56

start to read some of the code, you may

7:59

uh if you have any experience in this

8:00

world, uh immediately see a variety of

8:03

issues. So first of all, we have this

8:06

statically defined user buffer. I'm

8:07

going to call this uh time buff for a

8:09

reason you'll see here in a second. We

8:11

take some data that likely comes out of

8:14

the time variable. You'll see we have

8:16

the time string here. We have to set

8:18

this data to be a string for it to

8:20

resolve properly. Right? we have some

8:22

function of time from param 2 which is

8:25

going to be likely our request. So if

8:27

this is the function that we use, if

8:29

this is us pulling all these little

8:31

extra pieces out of this request, right?

8:33

We have function equals get math all of

8:34

these parameters in the URL. If that is

8:37

how we assume that this is being ran, we

8:39

can assume that this is pulling the time

8:41

parameter out of the URL. And this makes

8:43

sense, right? Because the time parameter

8:44

is likely what we're going to need to

8:46

configure the time. This is the time

8:48

comp function. So I'm going to name this

8:49

time comp. And I'm going to call this

8:52

little function here uh get param.

8:54

Right? So we have get param from the

8:57

request s sprintf that into the time

8:59

buffer date s. So we're going to set the

9:01

date to our little input and then do

9:04

system command on that time buffer. Now

9:08

this is a wrapper for system. So what we

9:11

could assume is that this is going to

9:13

properly sanitize the input. But like

9:16

any good hacker, we're going to uh we're

9:18

going to test that assumption. Right? So

9:20

what we can do to test this is literally

9:21

just write the command ourselves. So

9:23

curl 192.16811.1

9:26

protocol.csp

9:28

it was um fname equals net from that

9:30

first request here and we want to do and

9:33

opt equals time comp and the time is

9:37

equal to let's just do garbage for right

9:39

now and there was some random math

9:42

variable that maybe like their bad

9:43

attempt at a CSRF or like a seed. So

9:47

we're just going to steal that for right

9:48

now. And then the function is equal to

9:52

it was get, right? I did some more

9:53

reading and there's actually it does a

9:56

compare on get or set and it's going to

9:59

return that. And we have to actually be

10:01

doing a set operation to get into this

10:03

function. Right? So what we can do is do

10:05

set for this. I'm going to wrap this in

10:07

a single quote because I want to do a

10:09

command injection at some point and I

10:10

don't want to command inject myself. And

10:12

you'll see that it says set error equal

10:15

to zero which means that we set them the

10:17

the date equal to asf asf. What we can

10:20

do now is actually test does our command

10:22

injection work? Do we have the ability

10:24

to run arbitrary commands through just

10:25

the use of a simple reboot? And you'll

10:27

see first it says error zero and the

10:30

second time the command hangs because

10:33

the device has rebooted. Right? We have

10:34

turned the device on and off and now we

10:37

can no longer connect to the device. So

10:38

we can run arbitrary commands on this

10:41

device. But but that's not cool. That's

10:42

not cool enough. We want to get a shell

10:44

on this device. I want to have access to

10:46

this device via the command line. So

10:48

what can we do? So going back to our um

10:51

our firmware image here, we can see all

10:53

of the binaries that are on the device.

10:55

And you'll see pretty quickly that we

10:56

have the lovely tnetd. So user espin tn

11:00

netd is a binary that we can use to

11:02

basically run any other binary on any

11:06

other port, right? Assuming there are no

11:07

firewall rules in place. And so what we

11:09

can do to uh mess with that guy is first

11:11

of all I got to reset my network

11:12

interface. And then now we can update

11:14

our our exploit to actually set up the

11:17

right thing. So what I want to do is

11:18

user sbin tn netd. So first of all we're

11:21

putting this IFS separator to to emulate

11:23

a space on the device cuz sometimes uh

11:25

in HTTP the spaces will get escaped

11:28

weirdly. We want to do -ps on port 444.

11:32

And then we want to set the um the login

11:35

binary to be uh bin ash I believe is the

11:39

the shell that we have. So now if I do

11:41

netcat 192168

11:44

uh 1114444

11:46

I don't have a shell. Okay, let's try

11:47

again. Hold on. Before we do that

11:49

though, I want to get a little more

11:50

insight into what's actually going on in

11:52

the device. Like what is what is the

11:53

process list? What does the environment

11:54

look like? Luckily, we have command

11:56

execution on the device and we can run

11:58

those commands. There's just nowhere to

11:59

really put that data. Well, sort of. If

12:02

we actually go to the uh the file system

12:04

here, we're going to go to the config

12:07

file for Etsy lighty and we're going to

12:09

cat the lighty config. You'll see that

12:11

we're actually serving data from the

12:15

webs directory for this device. Well,

12:16

there actually there are two instances

12:18

running of this. But you'll see that we

12:19

have one of them is a writable folder

12:21

that's called /webs. Let's see if I can

12:23

find it here. Do this and then grab

12:25

webs. So server document route for this

12:28

instance of lighty is called /webs. What

12:30

we can actually do now is run this cute

12:32

little thing where we do ps and we just

12:35

take the process list and write it to

12:37

web/he hehe and because that's the

12:39

document route for our server now we can

12:42

just curl he he and bada bing bada boom

12:44

we get the process list so we can see a

12:46

bunch of stuff going on we can see that

12:48

we have the lighty running with that

12:50

instance of the config that gives us

12:52

access to the webs folder we have a drop

12:54

bear server we have tnet running what I

12:57

want to run though is my own version of

12:59

the tnet server. I want to get in there

13:01

and I want to, you know, run my Tnet

13:03

server to give me a shell on device.

13:06

Now, after a while, I was messing with

13:07

this curl command that uses the command

13:09

injection to run TNETD. And with TNETD,

13:12

you can specify a port number and a

13:14

login program to use in place of bin

13:16

login. And if you can just set binsh,

13:18

you can use that as basically a bind

13:20

shell. Now, the problem is I had a

13:22

couple issues where it would run, but it

13:24

didn't actually run the command. And I

13:25

think something is either wrong with

13:27

TNETD where it doesn't allow for IFS or

13:29

there's some issue with this. But what I

13:31

did find after a little bit of searching

13:33

is a nice little program on the device

13:35

that's called /webs/cgibin/upload.cgi,

13:41

which is what you're using to actually

13:43

upload a temporary piece of firmware

13:45

before you do a firmware update on the

13:47

device. The reason I know this is by

13:49

doing a simple strings on the device or

13:50

on the upload.ci, CGI. You'll see that

13:52

it writes the file out to temp temp

13:54

firmware. And so you can actually use uh

13:57

curl to do a file upload using the exact

14:00

process they use this multi-art form

14:02

data by doing file equals at and then

14:04

the name of the file. Right? So you can

14:06

literally do that and point it to that

14:08

URL. And in doing that you will get

14:10

upload.cgi to ingest the script and put

14:13

it on temp firmware. And what you can

14:15

actually see here is if we do a uh ls of

14:19

um of temp and we get hehei, you will

14:23

see that this temp firmware file

14:25

actually exists now. It's now on the

14:27

device, which is crazy. So now all we

14:29

have to do is do a little bit of a a

14:31

commod plus x to make the file

14:33

executable. We will commod plus exit and

14:36

we'll do just the temp firmware run.

14:38

We're going to run the temp firmware

14:40

file which has a script. Oh, I didn't

14:43

show you the script. Uh yeah, the script

14:44

that I wrote uh by the way is uh

14:47

scripts.sh, which literally just enables

14:50

a telnet D server as I want it to run,

14:52

right? So it runs a script as bin ash

14:54

and it runs user spin tnet d b b b b b b

14:55

b b b b b b b b b b b b b b b b b b b b

14:55

b b b b b b b b b b b b b bin aash port

14:56

4444. And you can see this all works

14:58

together. If we simply just go here and

15:00

do a little netcat 192.16811 4444, bada

15:04

bing, bada boom, we're root, baby. This

15:06

is VR, guys. This is the world of

15:08

acquiring weird little devices off of

15:11

Teimu, taking them apart and seeing what

15:13

issues we can find. Let's talk

15:15

responsible disclosure, right? I have

15:17

tried very hard to identify what company

15:20

makes this device. I cannot ID one. So,

15:22

this is a bug that I could not find

15:24

anyone to tell about. So, now I'm

15:26

telling you guys. Okay, awesome. All

15:28

right, guys. If you enjoyed this, do me

15:29

a favor. Go check out Stack Smash. It's

15:31

my community where I teach people how to

15:33

do stuff like this to not only figure

15:34

out how to hack, how to make the world a

15:36

safer place, but software security. And

15:38

if you like this channel, then hit hit

15:39

that sub button over there. It's right

15:40

it's down there somewhere. Uh we'll see

15:42

you in the next one. Take care. Goodbye.

UNLOCK MORE

Sign up free to access premium features

INTERACTIVE VIEWER

Watch the video with synced subtitles, adjustable overlay, and full playback control.

SIGN UP FREE TO UNLOCK

AI SUMMARY

Get an instant AI-generated summary of the video content, key points, and takeaways.

SIGN UP FREE TO UNLOCK

TRANSLATE

Translate the transcript to 100+ languages with one click. Download in any format.

SIGN UP FREE TO UNLOCK

MIND MAP

Visualize the transcript as an interactive mind map. Understand structure at a glance.

SIGN UP FREE TO UNLOCK

CHAT WITH TRANSCRIPT

Ask questions about the video content. Get answers powered by AI directly from the transcript.

SIGN UP FREE TO UNLOCK

GET MORE FROM YOUR TRANSCRIPTS

Sign up for free and unlock interactive viewer, AI summaries, translations, mind maps, and more. No credit card required.