WEBVTT

00:00.720 --> 00:01.840
Woooo!

00:01.860 --> 00:03.540
Yeah, DEF CON!

00:06.600 --> 00:07.760
I'm Max.

00:07.760 --> 00:11.440
I go by Strikeout, as you can see by the backwards K on my hat.

00:11.660 --> 00:17.100
This is hacking the Zero NAS, or however you say that, from the perspective of a noob.

00:18.000 --> 00:20.660
Have you ever felt down?

00:20.720 --> 00:23.100
I mean, really down.

00:23.420 --> 00:24.540
Overwhelmed?

00:24.560 --> 00:25.440
Tired?

00:25.540 --> 00:26.900
Not enough?

00:28.660 --> 00:34.620
But, at realizing your defeat is a sense of calmness.

00:34.700 --> 00:36.780
I don't have to fake my greatness anymore.

00:36.820 --> 00:39.300
I can see myself for who I truly am.

00:39.580 --> 00:42.660
This is where growth happens.

00:43.120 --> 00:51.300
You see, my first DEF CON last year, I spent most of my time at IoT Village, and I was absolutely horrified of how much everyone knew compared to me.

00:51.660 --> 00:54.520
But, I saw a path that looked awesome.

00:54.520 --> 00:56.200
I saw directions I could go.

00:56.200 --> 01:01.080
I saw that IoT hacking didn't have to be some crazy hardware glitch kind of thing.

01:01.080 --> 01:03.840
This could just be a web interface, which is fairly common.

01:04.780 --> 01:07.620
I started watching the ISE live streams.

01:07.960 --> 01:10.420
And I went, huh, I can do this.

01:10.420 --> 01:12.460
This is something I could actually do.

01:12.540 --> 01:14.640
And that's why I named it from the perspective of a noob.

01:14.640 --> 01:20.360
I had virtually no idea what I was doing before I started this, besides some software dev background.

01:20.360 --> 01:23.760
But, I had virtually no experience hacking itself.

01:26.620 --> 01:35.440
I'm going to go into a lot of technical details, but one thing I really miss about most presentations is they talk about the exploit, but they don't talk about the methodology of how they found it.

01:35.520 --> 01:39.100
Finding the exploit is most of the time the hardest part.

01:39.100 --> 01:40.960
Exploiting tends to be the easier thing.

01:41.260 --> 01:45.440
To me, hacking is understanding and then manipulating.

01:45.740 --> 01:48.460
Take, for example, this classic SQL injection.

01:48.460 --> 01:49.600
Super common.

01:50.420 --> 01:54.400
Yeah, you can throw this into a login field, and it might work.

01:54.400 --> 01:57.700
But how does this actually work, is what we should actually be asking.

01:59.940 --> 02:03.800
I want to give an actual example of something I found on a site.

02:05.100 --> 02:06.700
I'm going to an interview.

02:06.700 --> 02:08.260
I am so excited.

02:08.260 --> 02:14.480
I'm blaring one of my favorite security podcasts, and all of a sudden, I rear-end a guy.

02:14.500 --> 02:16.140
And I am furious.

02:16.300 --> 02:17.960
My insurance rates go up.

02:17.960 --> 02:20.400
I have to pay for a bunch of stuff in the guy's car.

02:20.460 --> 02:21.740
I miss my interview.

02:21.980 --> 02:28.620
I then have to be taken home by a tow truck, which is another fee in itself.

02:28.620 --> 02:31.540
And then I get online, and I have to pay a freaking ticket.

02:33.080 --> 02:34.880
That really bothered me.

02:34.940 --> 02:36.060
Really did.

02:36.100 --> 02:38.080
So, what do you do when you're pissed off?

02:38.080 --> 02:41.520
As a hacker, you probably shouldn't do it, but you start looking at what you can find.

02:41.740 --> 02:47.020
On the site, there was a birthday field where you could find your ticket as well as your name.

02:47.020 --> 02:50.600
I just took out the birthday field and saw what happened.

02:50.600 --> 02:51.960
Nothing different happened.

02:51.960 --> 02:56.000
So then, I casually started taking more and more characters off my name.

02:56.000 --> 03:03.240
I went from Doolin, to Dooley, to Dool, all the way to Dee, until I had a full page of identifying information.

03:03.620 --> 03:07.140
And this is where the understanding really comes in here.

03:07.140 --> 03:11.280
Based upon the query, I thought it was going to be a like clause.

03:11.280 --> 03:22.120
For those who don't know, a like clause with a percent sign there will return X, like the letter X in this case, the input you give it, and then anything else.

03:22.120 --> 03:25.800
So this will return like xylophone, as far as anything else starts with X.

03:26.540 --> 03:29.820
So I said, well, what happens if I put another percent sign here?

03:29.820 --> 03:30.860
And boom!

03:31.120 --> 03:32.380
Well, nothing happened.

03:32.380 --> 03:33.500
Funny thing.

03:33.540 --> 03:34.800
You're supposed to laugh.

03:37.260 --> 03:46.220
I walked away, I came back a couple minutes later, and all of the ticket information for every digital ticket that had ever been given out by this county was now on the screen.

03:46.320 --> 03:53.240
The percent sign wasn't a very normal thing for this, but it was a classic SQL injection.

03:53.240 --> 03:58.280
By understanding how this worked, I was able to manipulate what I wanted to get out of it.

03:58.660 --> 04:11.800
And side note on the ticketing system, that information you could actually use to log in as someone, and then schedule court dates and send more documents towards you.

04:11.800 --> 04:14.280
It's a very subtle thing, but it worked out.

04:14.820 --> 04:20.180
So, going with my methodology, the first thing you have to do is understand how the device works.

04:20.180 --> 04:26.340
If you don't understand how something works, you can throw payloads at it, you may find stuff, but you're not going to find very cool things.

04:27.540 --> 04:32.080
The first thing I always do is, like, what the hell is a NAS in the first place?

04:32.320 --> 04:34.820
It stands for Network Attack Storage Device.

04:34.820 --> 04:38.920
I think of it as a USB drive that you can just connect to from the internet.

04:38.960 --> 04:39.600
That's all it really is.

04:39.600 --> 04:40.920
It helps you manage files.

04:41.020 --> 04:45.900
There's a bunch of other administrative features on it, but that's pretty much all there is to it.

04:46.720 --> 04:51.720
So, after you kind of research, like, what is the use case of this, I just start clicking around the site.

04:51.740 --> 04:52.640
What's on the site?

04:52.640 --> 04:54.020
What is the site meant to do?

04:54.180 --> 04:56.060
What kind of user privileges are there?

04:56.060 --> 04:58.000
I click through every link I can find.

04:58.000 --> 04:59.740
I start reading through user documentation.

04:59.980 --> 05:04.740
I start looking at firmware notes, because a lot of times they'll add new features or something.

05:07.180 --> 05:10.300
After that, I start looking at the tech stack.

05:10.620 --> 05:14.000
So, what kind of web server is this using?

05:14.000 --> 05:15.680
What kind of language are we using here?

05:15.680 --> 05:18.160
Just understanding how the device works.

05:18.720 --> 05:22.740
One thing I noticed that I thought was fairly interesting was there were two different APIs.

05:22.800 --> 05:30.080
One was for file upload, file download, and logging in, and then there was an entirely separate API for everything else.

05:30.080 --> 05:33.660
Understanding how they're accomplishing what they're doing is very important.

05:34.600 --> 05:44.920
At this point, I SSH onto the NAS, because you can do that, and I realized they were using Python, but they were in PYC files.

05:45.060 --> 05:59.780
So, I just grabbed all the PYC files, took them off the NAS, and, for those who don't know, it stands for Python Compiled, and there's actually a tool that will take PYC files back to Python files, and it includes comments and everything.

05:59.780 --> 06:00.720
It's incredible.

06:01.060 --> 06:03.260
Uncompile 6 is the name of that tool, if you're curious.

06:04.540 --> 06:06.660
So now, I have the source code.

06:06.660 --> 06:13.000
I'm looking through it, and I notice it's using Cherry PY, which is an older Python kind of thing.

06:13.900 --> 06:18.020
Now, well, there's information being stored on this.

06:18.160 --> 06:20.100
What can I see on here?

06:20.100 --> 06:25.800
So I start changing directories, want to know how the file system works, what's on it, and I see this file.

06:28.140 --> 06:29.920
Thank you for laughing this time.

06:31.940 --> 06:34.680
Clearly, there's going to be nothing secretive in here.

06:34.820 --> 06:39.000
So you look on it, and it's a base64 encoded admin password.

06:40.560 --> 06:41.660
Yeah, that's really bad.

06:41.660 --> 06:42.680
Don't do that at home.

06:42.700 --> 06:43.780
You shouldn't be doing that.

06:43.780 --> 06:44.800
It's kind of sad.

06:45.020 --> 06:47.200
But it was a nice find to find that.

06:49.660 --> 06:50.960
Next talk, yeah.

06:51.080 --> 06:54.540
So, to build on this, I was just...

06:54.540 --> 07:00.960
So , from our constants, I just started taking strings that I saw in URLs and started sticking it into Google.

07:00.960 --> 07:04.520
And I found that this thing actually can host a website.

07:04.720 --> 07:06.660
And that part wasn't done very well.

07:06.660 --> 07:15.200
And you could actually direct request this file on the person's server and just log in as admin if you wanted to.

07:15.240 --> 07:22.600
So, looking over everything that's on the device, how it works, is the most important thing before you start hacking on something.

07:24.540 --> 07:27.480
At this point, we've talked for a while, there's been no actual hacking involved.

07:27.480 --> 07:29.580
We've just looked at how something works.

07:29.820 --> 07:33.640
And that's... I mean, I probably spent a week just understanding what was going on in the device.

07:34.840 --> 07:37.500
Now I'm going to do some actual hacking, which is fun.

07:41.670 --> 07:52.450
So, the first thing I thought was kind of odd was I was looking over the normal API calls, I noticed that they were using a file name and a function name for all their API calls.

07:52.450 --> 07:54.630
And I learned that just by grepping.

07:54.630 --> 07:55.450
It's a common theme.

07:55.450 --> 07:56.590
I use grep a lot.

07:56.590 --> 07:59.410
Just in the file system.

07:59.450 --> 08:00.990
So, I was like, why is it doing that?

08:00.990 --> 08:06.970
So, I went to the spot where these APIs were actually being called and I found this.

08:09.410 --> 08:15.650
So, anytime you see an eval in anything that doesn't validate user input, it's a pretty good attack factor.

08:16.290 --> 08:21.910
I'm not that smart, though, so I initially tried doing some really crazy directory traversal shit to call whatever I wanted.

08:22.390 --> 08:27.370
And it took me a while to realize this, but this will actually execute Python native code.

08:27.470 --> 08:32.530
It's going controller, which we had an MVC or a model view controller set up.

08:32.970 --> 08:35.510
The first parameter is going to be the file name.

08:35.510 --> 08:38.230
The second parameter is going to be the function name.

08:39.630 --> 08:44.770
So, with this knowledge, I said, okay, I understand how this request works.

08:44.770 --> 08:48.010
Now, is there a way I can manipulate this to do whatever I wanted?

08:49.610 --> 08:51.950
I came to this little sketch of mine.

08:51.950 --> 08:54.970
So, the eval is essentially calling a file name.

08:54.970 --> 08:59.350
There's a file name, a function name, and then it passes in JSON as parameters.

08:59.690 --> 09:03.750
This was my understanding of how this request worked.

09:03.970 --> 09:06.570
And this took me some time to fully figure out.

09:07.430 --> 09:09.570
So now, what can I do with this?

09:09.810 --> 09:15.890
First thing I tried doing is I noticed that there was a file that had everything imported from OS, just import star.

09:15.910 --> 09:18.430
So, I was curious if I could call the OS package.

09:18.630 --> 09:24.330
So, I called this really simple function and I got int object not callable.

09:25.470 --> 09:26.950
What the hell does that mean?

09:27.070 --> 09:30.350
So, I did a similar function and got a string returned.

09:30.890 --> 09:31.770
Cool.

09:31.770 --> 09:33.390
I still don't know what that means.

09:33.550 --> 09:35.030
And then it hit me like a brick.

09:35.070 --> 09:40.210
This is returning whatever I'm calling from the OS function and then executing it.

09:40.710 --> 09:42.570
So, I knew I had some sort of RCA.

09:42.570 --> 09:44.930
I just had to figure out how to actually weaponize this.

09:45.230 --> 09:49.910
Next thing I wanted to understand, I wanted to completely validate it.

09:49.910 --> 09:56.170
So, when it returned, it gave you the type, but it didn't actually give you any sort of feedback on what it actually looked like.

09:56.170 --> 09:58.690
So, I wanted to get some sort of timing issue.

09:58.690 --> 10:00.170
So, I turned on the yes command.

10:00.170 --> 10:02.470
I did os.system with yes.

10:02.470 --> 10:05.210
And this will just go on forever.

10:05.210 --> 10:07.550
Yes just prints yes forever.

10:08.330 --> 10:12.630
So, I make the request and burp just freezes.

10:13.430 --> 10:15.210
It just doesn't do anything.

10:15.210 --> 10:21.670
I log on to the NAS and I run ps, which shows all processes, and I see the yes command.

10:21.890 --> 10:25.410
So, now I figured out that I had a remote code execution.

10:25.410 --> 10:26.650
I was very confident.

10:26.810 --> 10:32.870
Now, I wanted to create a backdoor, which is kind of like the quintessential thing you have to do.

10:32.910 --> 10:34.110
I own this.

10:34.110 --> 10:35.270
I ran whoami.

10:35.270 --> 10:36.570
Otherwise, it's not real.

10:37.850 --> 10:41.370
So, I was going to show the code for that and then show the exploit.

10:45.320 --> 10:51.060
So, for this API call here, this is the backup main, which is just the name of the file.

10:51.300 --> 10:53.640
I'm calling it os.package with system.

10:54.720 --> 10:58.420
And then, I threw in this backdoor I found online.

10:58.420 --> 10:59.720
Like, I didn't write this.

10:59.720 --> 11:00.900
Some really smart guy did that.

11:00.900 --> 11:02.000
I just found it.

11:02.000 --> 11:03.020
Put it in there.

11:04.100 --> 11:04.760
Yeah.

11:05.140 --> 11:07.720
Now, I will show this off.

11:07.720 --> 11:08.920
Hopefully, it works.

11:09.360 --> 11:11.940
I set up a Netcat listener on a server I control.

11:12.500 --> 11:15.200
And then, hope this works.

11:15.200 --> 11:15.900
Cool.

11:16.300 --> 11:17.180
Who am I?

11:17.980 --> 11:19.400
This is when you're supposed to clap.

11:19.400 --> 11:20.100
It's an RC.

11:20.100 --> 11:20.880
Come on.

11:20.900 --> 11:21.780
Thank you.

11:21.780 --> 11:22.660
Thank you.

11:24.820 --> 11:25.540
Cool.

11:26.740 --> 11:31.640
So, the simple bug in the routing led to a very bad thing.

11:31.720 --> 11:34.180
But now, the next question we should ask that...

11:39.950 --> 11:40.310
Okay .

11:41.570 --> 11:44.770
One thing we don't do very well as hackers is we tell people when they've effed up.

11:44.770 --> 11:46.150
We don't tell them how to fix it.

11:46.150 --> 11:47.910
We just kind of assume people know what they're doing.

11:48.210 --> 11:50.130
So, I want to talk about mitigations, too.

11:50.130 --> 11:53.850
In this situation, running the eval command is a terrible idea.

11:54.130 --> 11:55.410
That's sort of user input.

11:55.410 --> 11:58.090
There should be virtually no scenario where you want to do that.

11:59.270 --> 12:05.110
However, telling them not to use eval is just completely unrealistic because they'd have to rewrite their entire API from scratch.

12:05.110 --> 12:12.990
So, what I recommended was whitelisting all of their file names and all of their function names so that they wouldn't have an issue.

12:13.570 --> 12:17.290
They don't want to be able to call anything malicious because it would just be thrown out.

12:20.490 --> 12:26.290
So, the next bug was in the package installer, which for some reason lower privileged users can run.

12:26.290 --> 12:29.230
I don't know why that's the case, but that's how it worked.

12:31.330 --> 12:37.530
So, I'm not sure if you guys know, but ISE runs this place here and they have a bunch of really good live streams and a lot of good blog posts.

12:37.690 --> 12:39.930
And I just started to turn on the live streams.

12:39.930 --> 12:47.050
And one thing they kept showing in the NAS devices was a bunch of command injection issues with stuff directly interfacing with the OS.

12:47.530 --> 12:49.590
So, I went searching for that.

12:49.590 --> 12:52.490
And I did it in a very sophisticated way.

12:52.490 --> 12:54.010
I just started grepping again.

12:55.590 --> 12:59.730
I started grepping for exec, OS.system.

12:59.730 --> 13:02.850
And I found lots of matches, but they were all dead code.

13:02.850 --> 13:10.710
After like 20 or 30 times of finding dead ends, I found one function which was at the very end of my grep list called execute script.

13:12.550 --> 13:14.110
So, I like analogies.

13:14.110 --> 13:17.690
I'm going to explain why I think this came about with an analogy.

13:17.690 --> 13:19.010
Have you guys ever played telephone?

13:20.290 --> 13:22.270
It always goes really well, right?

13:22.690 --> 13:23.550
No.

13:23.670 --> 13:25.710
Telephone never goes well.

13:25.870 --> 13:33.710
The premise of telephone is you're trying to get, like you talk in a circle, you're trying to get the message from the first person to the last person.

13:34.150 --> 13:35.990
It never gets to the last person.

13:36.150 --> 13:37.450
And in the correct form.

13:37.450 --> 13:39.010
This was similar to this vulnerability.

13:39.270 --> 13:43.310
The execute script function was probably written a long time ago by a developer.

13:43.310 --> 13:47.730
And then it was six function calls below the API call that was being called.

13:47.970 --> 13:52.810
That sort of indirection can create a lot of issues.

13:52.810 --> 13:57.070
Because the original developer probably thought, we don't need to escape shell meta characters.

13:57.070 --> 13:58.010
Why do I need to do that?

13:58.010 --> 13:59.310
Someone else can do that for me.

13:59.370 --> 14:05.930
By the time it gets to the person who wrote the API, they just had no idea that was the assumption that they had made.

14:08.390 --> 14:10.630
So this was what the command looked like.

14:10.630 --> 14:12.210
I'll show the exploit in a second.

14:12.210 --> 14:15.490
It was a package installer binary.

14:15.890 --> 14:18.350
And there was a package name that had to be called.

14:18.870 --> 14:21.230
And then there was a command that had to be passed into it.

14:21.230 --> 14:24.130
The package name had to be an actual package.

14:24.130 --> 14:26.850
Otherwise, it was a whitelist thing, so it couldn't do anything else.

14:26.850 --> 14:31.510
But the command had no filtration whatsoever.

14:32.230 --> 14:35.190
And that's where I put the payload at.

14:35.710 --> 14:37.150
So I'll go back to the code.

14:43.480 --> 14:46.480
So again, we have the portal main file.

14:46.480 --> 14:48.720
We have the package init command.

14:48.820 --> 14:50.380
This is the function name.

14:50.380 --> 14:52.800
We throw in the package, which is a valid package.

14:52.800 --> 14:56.080
And then we have the actual command here.

14:56.080 --> 14:57.420
Sorry, this is the package name.

14:58.820 --> 15:01.680
I again just put a shell I found online.

15:01.680 --> 15:08.180
The one little trickier thing about this is I had to put ticks right here, so it would execute slightly out of band.

15:08.380 --> 15:11.960
I could have put a command and then a semicolon or something.

15:11.960 --> 15:13.840
This is just the way I chose to do it.

15:13.840 --> 15:16.460
And I put an ampersand so it would run in the background.

15:17.720 --> 15:20.540
So it didn't screw up what I was doing in my code.

15:22.020 --> 15:23.480
So now I'll show this off.

15:31.510 --> 15:33.890
I have all the functions at the bottom here.

15:46.550 --> 15:48.170
We have root again.

15:57.450 --> 15:59.830
Talking makes my mouth really dry, so...

15:59.830 --> 16:00.630
Give me a sec.

16:07.600 --> 16:10.180
So the next thing I started looking at...

16:10.180 --> 16:11.600
Oh, sorry, mitigations.

16:11.600 --> 16:16.740
In order to mitigate this, you really should just whitelist those commands for the package installer.

16:16.780 --> 16:19.660
There was only like four or five commands to do with this.

16:19.680 --> 16:24.620
Even if you couldn't whitelist the commands itself, you could whitelist characters.

16:24.620 --> 16:28.140
I doubt you're going to need backticks or semicolons and a command name.

16:28.320 --> 16:30.620
So that's something that was pretty easy to do.

16:34.990 --> 16:37.250
So this is probably my favorite of the vulnerabilities.

16:37.250 --> 16:42.510
Not because it has the most impact, but it was the most interesting, and it took me the longest time to figure out.

16:42.510 --> 16:44.490
So we see arbitrary file share.

16:44.490 --> 16:46.850
The first thing is, like, what the hell is a file share?

16:46.890 --> 16:48.610
In this sort of situation.

16:51.110 --> 16:52.190
Here we go.

16:52.270 --> 16:59.150
So you can view all of your files, and a file share essentially is a folder that is abstracted with privileges.

16:59.510 --> 17:03.650
So the music, photo, and video are shares, essentially.

17:03.650 --> 17:09.690
And you don't see this right now, but there's an admin user who has access to other things that you can't see here.

17:09.850 --> 17:13.410
So there's some sort of boundary between what you control compared to other users.

17:20.120 --> 17:20.760
Yeah.

17:20.940 --> 17:22.040
All right, so I was...

17:22.040 --> 17:26.580
I wanted to find a direct address or cross-site scripting in this page.

17:26.580 --> 17:29.260
So I was looking through, and they did a very good job, actually.

17:29.300 --> 17:33.760
While I was looking through the source code, they were checking for the absolute path and see if it was owned by the right person.

17:33.800 --> 17:37.660
I was very impressed with how good of a job they did locking this down.

17:38.880 --> 17:45.140
So when this gray box kind of approach failed, I decided to take a white box approach and see if I can find anything in this file.

17:46.260 --> 17:50.660
And I started looking around, and I started seeing functions I had never seen before.

17:50.660 --> 17:52.520
They were very odd to me.

17:52.800 --> 17:56.580
And what ended up happening was there was a file that had...

17:56.580 --> 18:01.220
or an API that had no usage in the entire UI.

18:02.500 --> 18:04.200
This is where my...

18:04.200 --> 18:05.520
another analogy comes in.

18:05.520 --> 18:07.520
I'm the king of analogies when I talk.

18:08.460 --> 18:14.280
So when you're on a diet, and you are really focusing on protein, you're going to get a lot of protein.

18:14.280 --> 18:17.500
But you may not get enough vitamin C or something.

18:17.920 --> 18:19.060
That's an issue.

18:19.140 --> 18:19.560
Because...

18:20.800 --> 18:28.740
in the actual code here, these people focus on securing the APIs they actually meant to be public, but not the ones they weren't looking at.

18:28.740 --> 18:37.240
So as soon as I saw this API that wasn't used at all, I kind of started drooling a little bit because I knew something was going to be wrong with this.

18:42.920 --> 18:46.240
The issue, though, is because this wasn't used, I had to reverse the API.

18:46.360 --> 18:49.100
This is the actual source code trimmed down a little bit.

18:50.540 --> 18:53.300
So the first thing is there's an action parameter that I saw.

18:53.300 --> 18:57.500
This action parameter dictates if you're going to create a folder or rename a file.

18:57.680 --> 19:10.960
The create folder didn't seem super interesting to me, so I went on the rename file path, and I followed this down, reversed the API, added all the proper parameters, and eventually I was able to rename files using this.

19:11.660 --> 19:18.140
I noticed there was no absolute path check, which meant this was likely going to be vulnerable to some sort of a directory traversal.

19:21.050 --> 19:23.270
So now I have a directory traversal.

19:23.270 --> 19:25.030
I can move file from any share.

19:25.030 --> 19:28.090
You're probably thinking, you're done, right?

19:29.150 --> 19:30.290
Nowhere near done.

19:30.290 --> 19:34.570
This is where I felt like Alice and I just went way down the rabbit hole.

19:37.450 --> 19:39.710
I want to make this a really deadly sort of thing.

19:39.710 --> 19:47.730
What if I can move the admin password I just found into one of my shares and so then I can just take over everything I want to.

19:47.890 --> 19:49.290
That was my thought.

19:49.290 --> 19:53.330
However, whenever I tried moving outside of the shares, it didn't work.

19:53.330 --> 19:54.830
And that was the most infuriating thing.

19:54.830 --> 19:56.470
I wanted to understand that.

19:56.470 --> 19:58.950
So I decided I was going to turn on logging.

19:58.990 --> 20:05.130
The issue was that it was a read-only partition on this part of the drive where the code was at.

20:05.470 --> 20:06.650
I want to bypass that.

20:06.950 --> 20:08.610
I couldn't figure it out.

20:08.610 --> 20:11.330
I tried remounting partitions.

20:11.330 --> 20:17.270
I tried altering the bash RC I tried altering the boot scripts.

20:17.270 --> 20:19.730
No matter what I did, I couldn't get any of it to work.

20:19.870 --> 20:21.750
If anyone has any ideas, I'd love to talk to.

20:21.750 --> 20:23.290
It would be something fun to know.

20:23.490 --> 20:38.850
The whole point, though, of this was just get the logging working and then after like four days of banging my head against this, I eventually decided I can just put a Python file in the root directory and just call the function I needed to call.

20:38.870 --> 20:39.970
Because I can write there.

20:39.970 --> 20:44.010
It was a really simple fix, but it just wasn't something I really thought of.

20:44.190 --> 20:49.270
So I did that, and I got erno18 invalid Christ device link.

20:50.110 --> 20:51.650
You guys know what that is, right?

20:52.590 --> 20:53.390
No.

20:53.550 --> 20:55.210
You're not really supposed to know what that is.

20:55.210 --> 20:55.770
I had no idea.

20:55.770 --> 20:56.610
I googled it.

20:56.610 --> 21:01.150
You can't rename files in Python 2.7 across partitions.

21:01.710 --> 21:03.250
It's just something that happened.

21:03.930 --> 21:07.230
I think you can actually do it in 3 for some reason, but not 2.7.

21:08.330 --> 21:14.110
So even though I didn't actually get all I wanted out of this vulnerability, I learned a lot.

21:14.390 --> 21:18.090
I actually encourage people to go down the rabbit hole if you're just trying to learn.

21:18.090 --> 21:20.930
Because now I understand how BusyBox works a lot more.

21:20.930 --> 21:25.810
I learned a lot about how BusyBox boots.

21:26.210 --> 21:28.090
A lot about how partitioning works.

21:28.090 --> 21:29.050
I had no idea how that worked.

21:29.050 --> 21:31.530
And that rabbit hole was really beneficial for me.

21:32.410 --> 21:35.810
So now I'll show off my vulnerability.

21:35.810 --> 21:38.470
I'll explain the parameters first.

21:39.890 --> 21:42.010
The first thing you see is the URL.

21:42.010 --> 21:46.550
And the URL is just the command you're calling.

21:46.550 --> 21:50.690
The JSON is where the interesting black magic starts to happen.

21:50.690 --> 21:54.930
The share in this situation is just photo.

21:55.450 --> 21:59.630
The photo share is something that the test user has access to.

22:00.930 --> 22:04.570
The action is the rename action, which is what we were talking about.

22:04.570 --> 22:08.610
The user is the test user, because that's the user we're logged in as in this account.

22:08.610 --> 22:17.510
The target path is the file location, but it's actually just the photo, like the share, with the file name.

22:17.510 --> 22:20.770
In the example I'm going to show, I use nonce.txt.

22:21.690 --> 22:24.810
And the interesting thing is the path.

22:24.810 --> 22:27.610
So it's a very classic directory traversal.

22:27.610 --> 22:30.270
I move outside of my photo share.

22:30.370 --> 22:36.570
I go into the admin share and I move the nonce.txt file into my share.

22:38.330 --> 22:40.050
I'll show that now.

22:40.330 --> 22:44.250
This one can be really finicky, so this is the one I've been worried about.

22:44.270 --> 22:46.370
Don't make fun of me too much if it doesn't work.

22:50.450 --> 22:53.130
All right, just got to comment this out.

22:54.030 --> 22:54.950
Turn that on.

22:59.110 --> 22:59.650
Cool.

22:59.650 --> 23:02.130
So I think that worked then, if it gave you the okay message.

23:02.770 --> 23:06.450
I guess I didn't really show you what was... So this is the admin one.

23:06.450 --> 23:17.090
If we reset this, we'll... assuming they're still logged in, then you should notice that the nonce.txt file is now gone.

23:17.170 --> 23:24.550
And if we go to the regular test user, which is what I've been using for everything else, we go to the photo share, the nonce.txt is now there.

23:24.870 --> 23:26.190
Thank you.

23:31.710 --> 23:32.750
Cool.

23:33.370 --> 23:37.610
So again, we should probably talk about mitigations because this is important.

23:37.610 --> 23:44.570
If you're at my job, that's mostly what I do, is I find something that's remotely considered vulnerability, I write it up, I tell them how to fix it.

23:44.570 --> 23:46.190
That's the important thing the client needs.

23:47.170 --> 23:54.250
So as far as mitigations go, if they were just doing an absolute path check, checking for privileges, like they were doing initially, that would have worked wonderfully.

23:54.630 --> 23:56.510
But they just forgot to add that on there.

23:56.510 --> 23:58.730
So that would have been a really easy fix for them.

24:00.450 --> 24:06.230
There were a couple other things I wanted to talk about that weren't really worthy of their own sections.

24:07.330 --> 24:10.070
So, the company won't fix this.

24:10.170 --> 24:14.850
I emailed them, and they got back pretty quickly but they're like, yeah, we don't really care, these are all authenticated.

24:15.370 --> 24:18.010
And I wanted to bring to light an actual attack scenario.

24:18.010 --> 24:20.430
So this site also had no Csurf protection.

24:20.850 --> 24:24.230
For those who don't know, it stands for cross-site request forgery.

24:25.110 --> 24:34.190
An example of this would be if you have facebook.com, your cookies, when you make some sort of action on Facebook, are automatically sent with the request.

24:34.190 --> 24:36.850
Which you assume, and it's really nice.

24:36.910 --> 24:47.530
But, if you make it from a malicious website, that's also in your browser that you visit, it will actually use those cookies even though it's not the same site you're running on.

24:47.530 --> 24:52.730
So an example would be on my bad website, I make a call to Facebook to delete your profile.

24:52.730 --> 24:54.530
If it's a git request or something.

24:54.770 --> 24:56.490
Which, this is bad.

24:56.490 --> 25:08.970
So in theory, someone in a targeted attack could have a Csurf-based website that would then call this API with any sort of user and it could completely take control over it.

25:11.090 --> 25:22.170
Another interesting note is that there was a cross-site scripting bug, but it was I didn't really feel like showing it off because I literally just put script alert script in a description and it worked.

25:23.270 --> 25:24.870
Wasn't really that cool.

25:25.630 --> 25:28.290
This was over HTTP for some reason.

25:28.670 --> 25:33.110
Don't know why, but the web server you could host it with was over HTTPS.

25:33.190 --> 25:38.390
I don't know why, they clearly knew how, they just chose not to make this over HTTPS.

25:38.830 --> 25:39.830
It's kind of odd.

25:39.990 --> 25:47.070
The other, also kind of fun thing, was when you turned it on, it had the default password, admin1234.

25:47.610 --> 25:56.250
And it forced you to reset it as soon as you got on there, but if you knew someone was going to set this up, you could potentially just log on there, reset the password for the person.

25:56.770 --> 26:01.670
It's kind of hypothetical, but at the same time, you could really screw with people doing this.

26:09.860 --> 26:12.140
Cybersecurity does not have to be horrifying.

26:12.940 --> 26:14.920
Everything I did here was with known tools.

26:14.920 --> 26:16.960
I even used Notepad++ people.

26:16.960 --> 26:17.760
Come on.

26:18.440 --> 26:27.320
I used Python, Burp, Grep, Google, and uncompile 6 tool to decompile the source code.

26:27.320 --> 26:30.480
Other than that though, I used everything that was super basic.

26:30.480 --> 26:34.000
Everything I found were very known vulnerabilities.

26:34.000 --> 26:35.740
A lot of them are in the OS top 10.

26:38.140 --> 26:40.100
This is not block magic.

26:40.200 --> 26:46.520
The key to all this stuff is understanding how stuff works and then manipulating it.

26:47.000 --> 26:47.920
That's hacking.

26:47.920 --> 26:49.440
Thank you.

26:56.080 --> 26:58.460
Also, I work at Security Innovation.

26:58.520 --> 27:00.540
We do web app pen testing.

27:00.540 --> 27:02.400
We do a fair amount of IoT stuff too.

27:02.420 --> 27:03.360
Amazing company.

27:03.360 --> 27:04.700
Just started working there pretty recently.

27:04.700 --> 27:06.080
I just graduated from college.

27:06.080 --> 27:08.760
If you're interested, come talk to me.

27:09.680 --> 27:11.480
Anybody have any questions?

27:11.960 --> 27:13.960
I'd love to talk about stuff.

27:18.900 --> 27:20.300
I could.

27:20.820 --> 27:23.280
All these exploits are on my github.

27:23.280 --> 27:24.480
It's mdoolin2.

27:24.480 --> 27:25.660
I didn't put it up there.

27:26.260 --> 27:28.100
All the exploits are on github.

27:29.080 --> 27:32.940
If you want to look at this, my github account is mdoolin2.

27:33.180 --> 27:34.680
Go crazy, folks.

27:39.750 --> 27:46.410
I listen to Dark Knight Diaries, Malicious Life, and I also listen to Security Now.

27:46.690 --> 27:52.350
I've really only been doing this security thing for a year and a half, maybe two years at the most.

27:52.350 --> 27:55.110
Security Now is how I learned to talk the game.

27:56.310 --> 27:57.790
It's like a two-hour podcast.

27:57.790 --> 28:00.890
I'd just listen to it walking from my house to school.

28:01.270 --> 28:04.030
That was really helpful for me for talking the lingo.

28:05.590 --> 28:07.050
Any other questions?

28:12.710 --> 28:16.250
If there's no other questions, I would love to talk afterwards.

28:16.470 --> 28:19.230
There's a lot of other things you can find on this device if you're interested.

28:19.470 --> 28:25.250
If you want to talk about how to get a job, or you're depressed or something, come talk to me.

28:25.390 --> 28:27.250
I'm a pretty happy and chill guy to talk to.

28:27.250 --> 28:29.430
If you have any other questions, feel free to come up and talk.

28:29.430 --> 28:30.150
Thank you.

