WEBVTT

00:00.000 --> 00:02.900
All righty y'all, I think we're going to go ahead and get started a little bit early.

00:03.280 --> 00:07.240
Sorry for any of the people that are coming in at the last minute, but we'll go ahead and get rolling.

00:07.460 --> 00:12.540
Also, I realized that I got super lucky because this is the last slot of the day.

00:13.260 --> 00:15.520
So we can go a little bit long, which is exciting.

00:16.060 --> 00:17.520
You guys can hear me all right on this one too, right?

00:17.520 --> 00:19.000
I kind of like to walk around a little bit.

00:19.000 --> 00:22.420
Okay , so I need to point it right at it.

00:22.420 --> 00:26.140
Okay, so for any of you the guys that don't know me, I'm Justin Gardner, a.k.a.

00:26.140 --> 00:26.900
Rhino Raider.

00:26.900 --> 00:29.880
I'm a professional live hacking event participant, a.k.a.

00:29.880 --> 00:32.240
full-time Bug Bounty, a.k.a.

00:32.440 --> 00:33.580
no job.

00:33.840 --> 00:43.460
And I hack web applications mostly, and IoT devices occasionally, and sometimes mobile devices when Joel is here to help me out.

00:44.300 --> 00:48.840
I'm the host of the Critical Thinking Bug Bounty podcast with my boy Joel right here as the co-host.

00:48.860 --> 00:50.940
And I'm also advisor for Kaido.

00:51.780 --> 00:54.200
So check those out if you're interested.

00:54.700 --> 00:57.480
All right, let's go ahead and talk about the roadmap for today's talk.

00:58.600 --> 01:02.780
We're going to hit 11 bugs, and I don't have to rush, which is great.

01:02.900 --> 01:05.480
I was going to give you a disclaimer that we're going to move pretty quickly.

01:05.780 --> 01:19.480
The whole concept behind this talk was to kind of bring to you all the experience that the hackers get at a live hacking event during the show and tell portion, which is at the end of the event when we all sit down and we compare notes.

01:19.480 --> 01:23.160
Some of the people go up on stage and present the bugs that they've found.

01:23.160 --> 01:29.700
So what I've done is I've compiled 11 vulnerabilities for you over the past two or three years of bug bounty hunting, all criticals.

01:29.760 --> 01:31.680
And I'm going to walk you through each one.

01:31.680 --> 01:36.880
And I'm going to do so at as much technical depth as I can without revealing the target.

01:37.900 --> 01:39.820
We have three easy bugs.

01:39.820 --> 01:42.860
We have two mediums, four hards, and two very hards.

01:42.860 --> 01:47.640
So we're going to start off easy and then we're going to go go a little bit deeper after that.

01:47.640 --> 01:48.660
So let's jump into it.

01:48.660 --> 01:52.880
First one is an NGINX 403 bypass to PII leak.

01:53.360 --> 01:56.080
So this is on a semi-private program.

01:56.080 --> 02:11.320
You'll see actually throughout the whole presentation that most of the targets that I'm hacking on are public programs or are semi-private programs, which is essentially a private program that everyone knows exists and they're very public about the fact that they exist.

02:11.320 --> 02:15.300
And you can easily get added to that program and paid for a bug if you have a bug.

02:16.320 --> 02:26.420
So when finding this bug, the first indicator that there might be a bug here was that the application or that the company was taking a piece of software that was meant for internal use.

02:26.440 --> 02:32.120
And then they've modified it to be publicly used so anybody can sign up and log into this app.

02:32.120 --> 02:32.260
Right .

02:32.260 --> 02:35.720
So when they do that, of course, the threat model changes for the application.

02:35.720 --> 02:36.360
Right.

02:36.380 --> 02:38.000
So I thought that was really sketchy.

02:38.000 --> 02:40.000
So I decided to look into it a little bit deeper.

02:40.780 --> 02:50.040
So what I was thinking is, OK, well, when this app was intended for private use only within an organization, then there was probably a lot of implicit trust between the users in the organization.

02:50.240 --> 02:57.300
You know, if I am in an organization with Joel, it's probably not a huge problem if I can go and look and see his last name or whatever.

02:57.300 --> 02:57.820
Right.

02:57.960 --> 03:01.900
However, in a public application, that information may be more sensitive.

03:01.900 --> 03:06.960
So I decided to look for those sort of endpoints, exploiting implicit trust and leak user data.

03:07.700 --> 03:13.760
So I identified a couple of those endpoints in the sort of internal use version of the software.

03:13.880 --> 03:18.640
And when I hit them on the API, I noticed that I got an NGINX 403.

03:18.640 --> 03:19.060
Right.

03:19.060 --> 03:20.820
Instead of the application level 403.

03:20.820 --> 03:22.600
You can see the differences over there.

03:22.660 --> 03:29.420
The NGINX 403 seems to imply that there is this sort of structure.

03:29.420 --> 03:29.740
OK.

03:29.740 --> 03:31.500
So we're on the network.

03:31.500 --> 03:34.440
We send a request over the Internet to the NGINX reverse proxy.

03:34.440 --> 03:37.380
That's standing in front of the backend server.

03:37.380 --> 03:42.900
And then the backend server processes that request, gives the response back to NGINX, which gives the response back to the user.

03:42.900 --> 03:47.060
Pretty standard NGINX structure or reverse proxy structure.

03:47.060 --> 03:54.420
However, when we request the API endpoint slash API slash internal slash get all users, that's not the API endpoint.

03:54.500 --> 03:56.180
That's obfuscated.

03:56.640 --> 03:59.600
It hits the reverse proxy.

03:59.600 --> 04:02.520
And then the reverse proxy says not allowed.

04:02.520 --> 04:03.120
Right.

04:03.120 --> 04:09.400
So I noticed the difference between those two 403 pages and I thought we should try to fuzz that a little bit.

04:09.400 --> 04:10.660
So what do we do?

04:10.660 --> 04:12.380
We try get all users.

04:12.380 --> 04:13.420
We hit the 403.

04:13.420 --> 04:26.140
We try get all users with a Z just to see if they had like blocked off that specific endpoint at the NGINX level or whether they are blocking out the path before that.

04:26.140 --> 04:26.560
Right .

04:26.560 --> 04:27.880
We get a 404 there.

04:27.880 --> 04:34.520
So not that whole path is slash API slash internal is not all blocked, just get all users.

04:34.580 --> 04:48.840
So then I tried some patch reversal stuff and eventually I started encoding various characters and found out that a WL encoded S would pass through the reverse proxy and not be perceived as a match for the block on get all users route.

04:48.840 --> 04:53.380
And it would be parsed on the backend as an S.

04:53.380 --> 04:57.160
So it would match that get all users route and dump back a ton of data.

04:58.200 --> 05:02.600
So the impact of that one was 4.5 million users PII leaked.

05:02.600 --> 05:04.540
The bounty was between 15 and 20K.

05:04.540 --> 05:10.960
I'm going to give you ranges because some of the ranges can, the actual numbers can disclose the programs.

05:11.180 --> 05:15.700
The severity was critical, critical, critical, which is what we say from the critical thinking podcast.

05:15.700 --> 05:17.020
Shout out to YT Cracker.

05:17.280 --> 05:20.600
And this program was semi-private as mentioned before.

05:20.600 --> 05:24.900
The takeaways for this one were obviously that change to threat model.

05:25.900 --> 05:28.420
Identify odd and out of place 403 pages.

05:28.420 --> 05:39.760
Those can always tell, can imply to you when a route is getting essentially blocked off by a reverse proxy and might be bypassable via some of these normalization tricks.

05:39.760 --> 05:49.120
And yeah, there was an amazing talk by one of the guys at Portswager earlier today on some of the amazing path reversal and path normalization stuff you can do.

05:49.200 --> 05:51.780
So I bet that would also be really helpful here.

05:52.380 --> 05:58.120
So the last takeaway is know your bypass tricks, URL encoding, double URL encoding, path reversal, et cetera.

05:58.120 --> 05:59.120
All right, let's move to the next one.

05:59.120 --> 06:00.460
This one's really easy.

06:00.460 --> 06:04.100
It's an arbitrary count takeover via docs, essentially.

06:04.100 --> 06:12.620
So I open the docs, I look at these endpoints, and I notice that there is an API endpoint for slash OAuth slash token.

06:12.620 --> 06:16.160
And there's an authorization header required for that.

06:16.300 --> 06:18.180
And the body is really simple.

06:18.180 --> 06:20.860
It's just grant type equals password.

06:20.860 --> 06:25.400
And then user equals username, password equals password.

06:25.400 --> 06:26.860
That's exactly what you would expect.

06:27.300 --> 06:29.060
And it dumps back the access token.

06:29.060 --> 06:30.240
Very, very reasonable.

06:31.120 --> 06:32.120
But wait a second.

06:32.220 --> 06:33.060
A password?

06:33.060 --> 06:36.680
This application is a OTP login application.

06:37.100 --> 06:38.000
There's no password.

06:38.000 --> 06:41.620
You just put in your email, they send you a link to your email, you click on it, and you're logged in.

06:41.780 --> 06:42.940
So how does that work?

06:42.940 --> 06:44.400
So I started building it out.

06:44.400 --> 06:47.120
And when I sent the request, I got a 401 unauthorized.

06:47.120 --> 06:55.920
Of course, we need to authorize with the credentials mentioned in the doc for the authorization header.

06:56.440 --> 07:00.240
So I went and I needed that.

07:00.240 --> 07:01.500
So I was like, what do I do?

07:01.500 --> 07:04.020
Of course, to the JS files.

07:04.180 --> 07:05.940
So I search in the JS files.

07:05.940 --> 07:10.920
I'm looking for the part of the UI that uses this request.

07:10.920 --> 07:16.780
And I find sitting in the JS files these authorization credentials.

07:16.780 --> 07:19.080
And they're obviously Base64 encoded.

07:19.080 --> 07:20.440
And the values were kind of odd.

07:20.440 --> 07:24.680
I can't show them to you, but they weren't random.

07:24.680 --> 07:26.280
They were just a string.

07:26.280 --> 07:27.900
So it was a little bit of an odd setup.

07:28.900 --> 07:35.800
And so then using those authorization basic credentials, we could literally just submit any password for any user.

07:35.800 --> 07:42.620
And it would accept it and dump back the authorization token, giving us access to arbitrary account takeover on this target.

07:42.620 --> 07:44.280
This is a public program.

07:44.280 --> 07:46.980
This is a very high-paying public program.

07:46.980 --> 07:48.420
And this sort of stuff is out there.

07:49.360 --> 07:51.860
So this was... thank you, thank you.

07:52.000 --> 07:58.960
This was an arbitrary ATO on double-digit million accounts, 40 to 60K bounty, of course, critical.

07:58.960 --> 08:01.560
And like I mentioned, public, public program.

08:01.560 --> 08:07.940
So takeaways for this will be read the docs, think about the docs, and then check the JS.

08:08.340 --> 08:11.000
Because there's a lot of good stuff in there.

08:11.600 --> 08:13.340
All right, next, bug number three.

08:13.340 --> 08:15.460
This one's very similar to the last one.

08:15.500 --> 08:20.920
Essentially, you take the AuthBearer and you log into that API, that godforsaken API.

08:21.220 --> 08:30.500
And there's simply a numeric IDOR in that API that literally leaks password hashes and password reset tokens.

08:31.180 --> 08:36.620
And I see someone in the audience that is laughing because I think they know the target that I'm talking about.

08:36.900 --> 08:38.540
So that's interesting.

08:38.540 --> 08:40.760
But yeah, the password reset token is there.

08:40.760 --> 08:46.480
You can just password reset the account, hit the IDOR, and then you'll be able to log into the person's account.

08:46.480 --> 08:48.360
This was also 40 to 60K.

08:48.760 --> 08:54.240
And the takeaway from this one that's different from the other one is just get really deep into these apps.

08:54.760 --> 09:04.180
It probably took 40 hours of configuring stuff and getting to know the various parts of the application before I got to this point where I was needing to authenticate into this asset.

09:05.180 --> 09:07.400
So that's the behind the scenes.

09:07.400 --> 09:13.720
I want to make sure that it's not perceived as looking too easy because there is some work that goes into it.

09:14.440 --> 09:18.180
Okay, bug number four, we're moving into the medium difficulty section now.

09:18.260 --> 09:22.880
This was a blind XSS via SMS to arbitrary account takeover.

09:23.040 --> 09:28.480
So this was on an app that was a place where you could buy a car.

09:28.520 --> 09:36.240
And there was a sister app that would allow the dealers to deal with the... it's kind of like a CRM for the dealers, right?

09:36.240 --> 09:38.680
So you go ahead and find a car.

09:38.780 --> 09:41.380
I was interested in this DeLorean for $42 million.

09:42.080 --> 09:44.580
And so I went ahead and filled it out.

09:44.680 --> 09:51.600
And somebody named Christina from my local car place reached out to me and said, Hey, Justin, I saw that you filled out the request for this.

09:52.320 --> 09:53.960
When can we meet to see the car?

09:53.960 --> 09:54.960
I was like, okay, wow.

09:54.960 --> 09:55.820
How did they do that?

09:55.820 --> 10:01.260
Because I had access to the dealer panel as a part of this scope and I didn't see where they did that.

10:01.380 --> 10:06.180
So I said, okay, let me go ahead and log into the dealer software and get that perspective.

10:06.180 --> 10:07.140
So this is what I see.

10:07.140 --> 10:12.420
You can select the users that you want to view the details for on the left hand side.

10:12.420 --> 10:14.480
And there's like an info and a financing tab.

10:14.480 --> 10:18.480
And you can kind of inspect that lead that had come through the website.

10:19.340 --> 10:21.460
And so I started reading the code on that page.

10:21.460 --> 10:24.860
And there's like some super long window object that's kind of difficult to read.

10:24.860 --> 10:33.980
But if you scroll through it and do your due diligence, there's a section called feature flags, which is something that I just talked about at my talk earlier in Bug Bounty Village.

10:33.980 --> 10:36.880
And there was a messages feature flag.

10:36.880 --> 10:39.680
So we turned that from false to true.

10:39.960 --> 10:46.160
And you can see, yeah, from false to true with this easy Kaido match and replace rule.

10:46.680 --> 10:52.280
And voila, the messages tab appears in the application and we have the ability to use it.

10:52.460 --> 10:57.460
So as we go into that application, we can send messages to the various leads.

10:57.460 --> 10:59.320
It'll go to the phone number that they submitted.

10:59.680 --> 11:02.120
And then you can interact with them.

11:02.260 --> 11:03.140
Great.

11:03.140 --> 11:05.600
So I sent myself a message.

11:05.600 --> 11:06.880
I submitted a lead, sent myself a message.

11:06.880 --> 11:12.260
And I thought, okay, wow, wouldn't it be cool if I could SMS myself an XSS payload?

11:12.300 --> 11:23.860
So I went ahead and first typoed my XSS payload to something that would never work, proceeded to reaction down it instinctually, and then submitted the actual XSS payload.

11:23.860 --> 11:33.080
When the dealer came back to the screen, they would see that the XSS would pop and we were able to get a blind XSS of sorts in this environment.

11:34.720 --> 11:38.800
So we've got blind XSS, but what can we do with it to get more impact?

11:39.180 --> 11:45.640
Well, the authorization flow for this application happened in an invisible iframe right near this interface.

11:45.920 --> 11:52.060
And what it would do is it would go through the OAuth flow on a different domain and then it would call back with just a token.

11:52.560 --> 12:00.860
And so what I did using the XSS is I cookie bombed that callback location so that the code wouldn't get consumed.

12:00.860 --> 12:06.420
And then I stole the code out of the iframe and exfiltrated that to the attacker server.

12:06.580 --> 12:20.260
So whenever the dealer comes, their session token would be exfiltrated, the victim's token would be exfiltrated, and the attacker can simply click the link and they're logged into the victim's dealer account.

12:20.260 --> 12:25.500
And you don't have to bypass MFA or anything like that because the session token is there.

12:25.740 --> 12:26.220
Great.

12:26.220 --> 12:29.820
So now we've got, we can log in as the dealer, we've got ATO.

12:29.820 --> 12:31.400
How can we get even more impact?

12:31.400 --> 12:36.940
Well, that same request had three vulnerabilities in it, okay?

12:36.940 --> 12:46.940
The send SMS message API endpoint had a dealer ID that was vulnerable to IDOR, a client ID that was vulnerable to IDOR, and the message was vulnerable to XSS.

12:46.940 --> 12:52.320
So essentially what this means is that we can worm this XSS across all of the dealers.

12:52.320 --> 12:59.260
We can send a message to every client from every dealer with an XSS payload and then proceed to hijack their accounts.

12:59.260 --> 13:06.020
And when we get access to their accounts, then we get access to all of the PII of all of the customers that have ever used this application.

13:06.480 --> 13:08.580
So that was bad.

13:13.020 --> 13:21.680
And that was an arbitrary ATO of double-digit million users, PII leak, 20 to 40K.

13:21.680 --> 13:23.340
This was on a private program.

13:23.420 --> 13:26.520
However, this program will be going public soon, I'm aware.

13:26.840 --> 13:32.500
And the takeaway for this is look at all the, look at the application from all perspectives, right?

13:32.500 --> 13:37.180
We wouldn't have seen this if we just looked at it from the dealer perspective or just looked at it from the client perspective.

13:37.180 --> 13:40.160
Make sure you're turning on all the feature flags with match and replace.

13:40.160 --> 13:43.480
That can enable features that are essential.

13:44.020 --> 13:47.240
And look for alternative data input paths like SMS.

13:47.680 --> 13:51.460
And then lastly, of course, chain, chain, chain to get maximum impact.

13:52.740 --> 13:56.520
Okay, bug number five, snoop on other people's meetings.

13:56.520 --> 13:57.840
This was a really interesting one.

13:57.840 --> 13:59.400
It's going to be a little brief.

13:59.400 --> 14:04.620
But there was a target that I came across in a video chat and team collaboration app.

14:04.620 --> 14:16.320
And for this specific period, I decided to focus on a specific goal, which was I wanted to be able to do creepy shit in people's meetings, right?

14:16.580 --> 14:19.700
So I started investigating how exactly that worked.

14:19.700 --> 14:24.200
I read the developer's docs, the JavaScript code, the GitHub issues, everything.

14:24.380 --> 14:29.940
And when I was investigating the GitHub issues, this GitHub issue popped up.

14:29.940 --> 14:34.660
It says the participant list is wrong when XYZ audio device is used.

14:34.660 --> 14:36.260
And I was like, huh, that's weird.

14:36.260 --> 14:41.460
So the participant list didn't get updated when the user has a broken audio device.

14:41.460 --> 14:42.600
Why would that be happening?

14:42.600 --> 14:49.920
So I thought maybe I can make that happen and I would be able to enter meetings without people knowing I was there.

14:51.320 --> 14:54.760
So how does this joining meeting work?

14:54.760 --> 14:57.900
The user connects first over WebRTC.

14:57.940 --> 15:02.660
Then they get all of the information like the call, comms channels, etc.

15:02.840 --> 15:10.220
And then the JS code identifies an audio device that the user can use or it creates a fake audio device.

15:10.220 --> 15:15.360
And then the client-side JS sends the audio connect signal to join.

15:16.180 --> 15:17.280
Wait, what?

15:17.280 --> 15:19.880
It sends an audio connect signal to join.

15:19.880 --> 15:26.240
That little bloop that you hear when you join a meeting was the thing actually triggering the participant list update.

15:26.240 --> 15:28.620
Which I really could not believe.

15:28.640 --> 15:34.280
And so since this was happening on the client-side, we could just not send the signal.

15:34.420 --> 15:37.360
And that's exactly what we did with this match and replace rule.

15:37.780 --> 15:46.540
We just simply said, did a true false switch on whether the audio signal had already been sent or not and it didn't send the signal.

15:46.720 --> 15:49.860
And we became Snoop Dogg in that environment.

15:49.860 --> 15:51.200
Okay, so let's see how it worked.

15:51.200 --> 15:53.120
Here's my Snoop Dogg POC right here.

15:53.120 --> 15:53.980
That's what I named it.

15:53.980 --> 15:55.360
The triagers loved it.

15:55.820 --> 16:00.260
And essentially what you would do is paste in the meeting information.

16:00.380 --> 16:02.240
And then you would click Snoop.

16:02.240 --> 16:07.260
And it would actually exfiltrate the user's transcripts.

16:07.260 --> 16:11.280
And you would not see anything in the meeting participant list.

16:12.580 --> 16:16.680
So that one was a 20 to 25k bounty.

16:16.680 --> 16:19.260
It was technically high, but it was paid as a critical.

16:19.260 --> 16:22.340
Given the various bonuses that were occurring.

16:22.340 --> 16:23.820
This was on a public program as well.

16:24.320 --> 16:25.740
So takeaways from this one.

16:25.740 --> 16:31.180
Reading the GitHub issues can have massive dividends, especially anything related to security or privacy.

16:32.120 --> 16:35.720
Set goals for your target, like being able to Snoop on meetings.

16:35.840 --> 16:40.520
And then verify in the code base how this works, especially on the client side.

16:41.600 --> 16:43.860
Okay, we are 15 minutes in.

16:43.860 --> 16:45.180
Dude, we are doing good.

16:45.180 --> 16:46.940
I may not keep you here long.

16:46.940 --> 16:50.000
We will see though, because now things are getting a little bit trickier.

16:50.180 --> 16:52.260
So this one is going to be a long one.

16:52.440 --> 16:58.440
This one was a Perforce server to client RCE.

16:58.700 --> 17:00.520
And I will explain what that is in just a second.

17:00.520 --> 17:04.980
The target for this was a desktop application used for game development.

17:05.300 --> 17:08.340
The problem is, I suck at hacking desktop applications.

17:08.340 --> 17:12.540
Note that I did not add that in the list of things that I often hack in the intro slide.

17:12.880 --> 17:16.200
So I was thinking, how can I attack this?

17:16.200 --> 17:19.060
This is kind of a little bit outside of my comfort zone.

17:19.200 --> 17:23.440
I can't really do privilege escalation stuff, because this doesn't really run in a privileged environment.

17:23.540 --> 17:26.220
So I was thinking, okay, but local attacks are kind of dumb anyway.

17:26.400 --> 17:28.560
Let me try to focus on remote attacks.

17:28.560 --> 17:30.300
And these are some of the ideas that I came up with.

17:30.300 --> 17:34.080
I just want to walk you through the process, so all of this doesn't seem too easy.

17:34.080 --> 17:37.240
And you see how often we fail when attacking targets like this.

17:37.760 --> 17:39.860
So here are some of the attack factors I came up with.

17:39.860 --> 17:45.060
I was thinking, we could open a malicious file in the development thing, and something bad would happen.

17:45.060 --> 17:50.480
We could connect to a malicious server with the development environment, and then something bad would happen.

17:50.480 --> 17:56.900
We could attack the software development lifecycle, a la Lupin, a la Ronnie Carta right here.

17:57.060 --> 18:01.720
And try to inject something into the build of this application itself.

18:02.080 --> 18:10.120
We could take advantage of some sort of misconfiguration in the actual code itself.

18:10.120 --> 18:15.020
Like maybe it's reaching out to an unclaimed domain, or an unclaimed S3 bucket, and inject sort of there.

18:15.020 --> 18:21.460
Or we could take these reusable game component pieces that were being processed, and try to do something with those.

18:21.460 --> 18:26.720
So I started going down these paths, and I checked out open a malicious file.

18:27.100 --> 18:34.060
So I broke apart some of the file extensions associated with this, and looked at the structure.

18:34.140 --> 18:39.140
I was replacing paths with UNC paths to see if I could force it to reach out to a remote server.

18:39.140 --> 18:43.460
I found that you could include settings for a project in a file.

18:43.460 --> 18:47.680
That was kind of interesting, but couldn't really do anything malicious with it at the time.

18:48.000 --> 18:50.240
I noticed that there was lots of XML.

18:50.400 --> 18:55.240
So I started spraying around various XXE payloads in there, and seeing if they would trigger.

18:55.260 --> 18:56.240
No luck.

18:56.260 --> 18:59.280
Symbolic links, I was kind of playing around with those.

19:00.060 --> 19:01.880
And nothing's really working.

19:02.100 --> 19:05.720
Kind of meh, feeling kind of insufficient at this point to look at this target.

19:05.720 --> 19:08.980
So I move along to the next attack factor.

19:09.360 --> 19:11.500
So that was connect to a malicious server.

19:11.500 --> 19:13.140
So what do I mean by that?

19:13.140 --> 19:18.200
This software had the ability to connect to remote version control servers.

19:18.220 --> 19:24.140
So that you could store your code that you were developing in a remote version control.

19:24.440 --> 19:28.760
And there were multiple types, and Perforce was one of those types.

19:28.780 --> 19:32.560
And that was something that I hadn't really heard of before.

19:32.560 --> 19:44.400
And I know from a lot of the work of Alex Chapman and some of the other great Git version control hackers out there, that version control can be hella sketchy.

19:45.060 --> 19:47.880
And so I kind of went down this route.

19:48.540 --> 19:52.300
So I started looking up the Perforce protocol spec.

19:52.360 --> 19:55.940
And I found this awesome article that told me about that.

19:55.940 --> 20:03.380
Funny side note that I don't have in the slides, the guy I just mentioned, Alex Chapman, he was also working on this target at the same time.

20:03.440 --> 20:12.700
And he actually had a public blog on how to exploit this specific protocol that I didn't find until a little bit later.

20:12.940 --> 20:16.240
And then I realized, oh shit, he's going to find that same bug.

20:16.340 --> 20:19.640
And we did have a bug collision, but it still worked out great.

20:20.000 --> 20:21.700
So anyway, I clicked on this article.

20:21.940 --> 20:26.560
And it was a really great article describing how this protocol works.

20:26.720 --> 20:29.120
It broke down the RPC structure.

20:29.120 --> 20:32.700
It's a binary protocol, which I was a little bit uncomfortable with as a web guy.

20:32.840 --> 20:35.360
But I decided to try to continue working on it.

20:35.420 --> 20:42.280
And as I was reading through the article, I see this very convenient file synchronization flow on the right-hand side there.

20:42.340 --> 20:45.180
Now if you read that for a second, you'll see something a little bit odd.

20:45.980 --> 20:50.680
The server says, client open file, client write file.

20:51.420 --> 20:54.760
And I was like, hmm, that seems odd.

20:54.840 --> 20:57.240
That the server can just say, write files.

20:57.240 --> 20:58.900
But it is a version control system.

20:58.900 --> 21:02.400
I wonder if there's any path traversals or something nasty that I can do with that.

21:03.460 --> 21:08.480
So on a hunch, I started developing this malicious Perforce server.

21:08.900 --> 21:11.860
And this was, I'm not going to lie to you guys, this was really intimidating to me.

21:11.860 --> 21:13.740
Because I'm a web guy, like I said.

21:13.740 --> 21:15.740
And I don't really deal a lot with binary protocols.

21:15.740 --> 21:19.100
But I thought, now is probably the best chance I'll ever get.

21:19.100 --> 21:23.220
Because this article literally breaks everything out as clean as can possibly be.

21:23.280 --> 21:25.240
So I decided to go down that path.

21:25.240 --> 21:27.940
And in the end, the code was actually really simple.

21:28.040 --> 21:32.220
I just created a function that would pass in a JSON blob.

21:32.220 --> 21:37.120
And those names and values would then be encoded into the binary format that was described in the article.

21:37.120 --> 21:45.340
Which was essentially the parameter name, a null byte, the value length, and then the actual value itself.

21:45.340 --> 21:46.300
And then a null byte.

21:46.300 --> 21:53.340
And then that would be sort of packed into a bigger sort of call that would pass through the socket.

21:53.340 --> 22:01.320
So, man, working with struct.pack was really scary to me.

22:01.320 --> 22:07.320
Whenever I saw those exploits where it's like, alright, less than, and B, and I, and H.

22:07.680 --> 22:10.340
I was thinking like, wow, this is really complicated.

22:10.360 --> 22:14.040
But, one, ChatGPT is really helpful for that nowadays.

22:14.660 --> 22:19.320
And two, you just kind of put your head down and keep working at it.

22:19.320 --> 22:21.000
I think it comes pretty quickly.

22:21.600 --> 22:23.800
So, I was able to build the whole exploit.

22:23.800 --> 22:26.740
And essentially, this is a funny part that I wanted to highlight for you guys.

22:27.340 --> 22:30.400
When the client connects, of course, it's going to try to auth, right?

22:30.400 --> 22:33.740
And my server was just like, yes, yes, you've authed correctly.

22:33.740 --> 22:34.600
Let's go.

22:34.660 --> 22:36.480
And just ignored the whole auth part.

22:36.780 --> 22:37.880
Which was really funny.

22:37.880 --> 22:39.520
And then just said, write a file.

22:39.720 --> 22:44.840
And essentially what it would do is write a file to anywhere on the file system via path traversal.

22:45.140 --> 22:48.280
And so, how do we convert that to RCE?

22:48.280 --> 22:49.660
Well, it was really easy.

22:49.660 --> 22:53.020
There was an exe file that was getting run every two seconds.

22:53.020 --> 23:02.100
So, you just take your malicious exe file, overwrite that file, and then it gets run two seconds later and you pop a shell.

23:02.840 --> 23:07.340
And, yeah, how do we actually make this a plausible attack?

23:07.340 --> 23:13.460
Well, as I mentioned earlier, there was the ability to include malicious settings for the project.

23:13.460 --> 23:23.760
And one of those settings, which was not super present in the documentation, was the ability to provide a version control server to connect to.

23:23.760 --> 23:26.700
And when it opened the file, it would automatically connect to that server.

23:26.700 --> 23:28.680
So, I could provide a victim with a file.

23:29.020 --> 23:30.940
They'd open it, connect to my server.

23:30.940 --> 23:34.360
My server would push a file down and shell the device.

23:34.840 --> 23:37.260
So, that was an RCE via malicious file.

23:37.820 --> 23:40.460
And the bounty for that was 15 to 30k.

23:40.700 --> 23:42.780
Critical, critical, critical, of course.

23:42.780 --> 23:45.060
And that was, again, on a public program.

23:45.140 --> 23:45.980
Takeaways from this.

23:45.980 --> 23:47.100
Read the freaking docs.

23:47.100 --> 23:48.000
It really helps.

23:48.000 --> 23:48.980
And articles.

23:49.260 --> 23:51.380
Don't shy away from targets you're scared of.

23:51.380 --> 23:59.640
And use your super amazing hacker brain for any struct pack calls or chat GPT, whichever you're more comfortable with.

24:00.200 --> 24:00.580
Okay.

24:00.580 --> 24:03.880
Joel, I've got some Easter eggs for you in this one, man.

24:03.880 --> 24:05.160
You're going to like this, okay?

24:05.160 --> 24:09.460
So, the next bug that I wanted to talk about was shelling a public program router.

24:10.500 --> 24:14.680
Once again, I wasn't super familiar with IoT devices before this.

24:14.740 --> 24:20.980
And so, I leaned heavily on my boy Joel Margolis, my podcast co-host here.

24:20.980 --> 24:25.800
And as cute as we are together there in that picture, we are both independently married.

24:26.080 --> 24:27.680
Although, that would be great.

24:30.780 --> 24:34.920
So, let's get to the details, okay, guys?

24:35.820 --> 24:39.240
Essentially, what we did is we took this router that was in a public program.

24:39.240 --> 24:40.280
We broke it apart.

24:40.660 --> 24:53.700
And we used the FCC website and Google and our brain to identify that this chip was in, this is what it sounded like to me the first time, a BGA EMMC ABC1234G74XYZ.

24:53.700 --> 24:54.700
This is coming out of Joel's mouth.

24:54.700 --> 24:56.560
And I was like, oh my gosh, what the heck is that?

24:56.560 --> 24:59.080
Well, it's a lot easier than you would think.

24:59.080 --> 25:00.140
It's a ball grid array.

25:00.140 --> 25:06.220
Those are those little pieces of silver pieces there, the little pieces of solder, the connections.

25:06.220 --> 25:15.260
And then this is an EMMC, which is essentially a SD card, which is just attached to the firmware device or attached to the board.

25:15.580 --> 25:16.820
So, that was really cool.

25:16.860 --> 25:18.900
So, we wanted to get that chip off.

25:19.120 --> 25:22.680
So , and for some reason, Joel let me do it.

25:22.680 --> 25:25.660
So, what we did was we get a hot air.

25:25.660 --> 25:27.540
I ordered a bunch of stuff on Amazon.

25:27.540 --> 25:30.180
I got the hot air rework station and lots of flux.

25:30.180 --> 25:36.140
And I sat down on the device and started blasting it with 500 degrees Fahrenheit air.

25:36.140 --> 25:38.100
And Joel was like, don't do that, bro.

25:38.180 --> 25:45.120
And then I proceeded to pull the EMMC chip off before the solder was completely liquid.

25:45.120 --> 25:46.440
And Joel was like, don't do that.

25:46.440 --> 25:47.940
And just give it some time.

25:47.940 --> 25:59.260
And then finally, after bricking three of them, we were actually able to get a clean read of the EMMC chip in our BGA reader and pull off the firmware for that device.

26:00.180 --> 26:04.200
Here's Joel's super awesome hardware hacking setup, by the way, which I'm jealous of.

26:05.520 --> 26:06.840
Yeah, bricked three of them.

26:06.840 --> 26:07.680
Not a great feeling.

26:07.680 --> 26:09.700
But the company paid for it, so that was great.

26:10.120 --> 26:13.040
So, now we've got the firmware so we can start hunting reliably.

26:13.220 --> 26:15.080
And it's time to shell that.

26:15.200 --> 26:18.980
So, what we did then, we were hoping it was going to be a lot easier than it was.

26:18.980 --> 26:26.320
But it was several days of weeding through Python code to find the actual attack vector that we ended up getting RCU with.

26:27.280 --> 26:39.740
And so the attack chain that we ended up going with started with us using an HTTP request to the cloud provider for this specific device that sent a certificate up.

26:39.740 --> 26:49.540
And that certificate was then pushed to the device and controlled certificate-based access to the Google RPC service listening on a port on the device.

26:49.960 --> 27:00.320
So, once we pushed up that certificate, we were able to communicate with gRPC, which we thought was going to be super helpful, but there was still not a lot of vulnerable code in there.

27:00.320 --> 27:02.440
So, we spent a couple days continuing to look.

27:02.940 --> 27:09.140
Then, finally, we came across this specific piece of functionality, which is write reservations.

27:09.440 --> 27:14.920
And as you can see in there, there's a Jinja2 template being referenced, right?

27:14.920 --> 27:18.360
So, everyone's probably thinking template injection, but it's not.

27:18.360 --> 27:19.860
They're using it correctly.

27:19.900 --> 27:28.620
What it is, however, is configuration file injection, which is a much rarer and, I think, totally underrated vulnerability class.

27:29.840 --> 27:31.540
And it kind of looks like this.

27:31.540 --> 27:35.620
This functionality would... what was this functionality doing?

27:35.620 --> 27:39.500
Yeah, it was writing static IP reservations for the router, right?

27:39.500 --> 27:48.320
So, what it would do is dynamically generate this DHCPD file, config file, and it would put the IP address that we wanted to static into the fixed address attribute.

27:48.320 --> 27:53.760
However, it wasn't escaping the characters that would allow us to write other DHCPD commands.

27:53.760 --> 28:02.480
So, we were able to identify a command that would run a shell command when a new DHCP lease was issued.

28:02.480 --> 28:07.780
And we were able to code golf it so that it keeps the correct syntax and doesn't break anything.

28:08.380 --> 28:17.600
And so, then we, after we got that in place and the exploit went off successfully, we grabbed our phones, connected to the device, and we saw that beautiful shell connection come back.

28:17.760 --> 28:20.760
Which is one of my favorite moments I've ever had hacking.

28:20.840 --> 28:24.140
Joel knows that I, like, jumped up and screamed, and it was amazing.

28:24.220 --> 28:28.220
So, that one was 20 to 32K, once again, on a public program.

28:28.380 --> 28:30.220
And I'm pretty proud of this fact.

28:30.220 --> 28:36.240
It took us, like, from zero, from knowing nothing about this target, about 10 days to get that shell.

28:36.240 --> 28:40.260
And so, I think, and I thought it was going to be a lot harder than that.

28:40.300 --> 28:44.260
So, don't shy away from these sort of things if you're intimidated by it like I was.

28:44.780 --> 28:49.400
Takeaways from this one is hack with a collaborator, or Joel Margolis, one of those two.

28:49.800 --> 28:53.500
Don't be afraid of hacking different types of scope.

28:53.780 --> 28:56.880
Get your hands on source code as much as you possibly can.

28:57.340 --> 29:03.500
And, obviously, configuration file injection is a pretty underrated vuln class, I think, especially in the IoT world.

29:03.500 --> 29:06.880
Okay, we're just going to do it again, real quick.

29:06.980 --> 29:08.800
And then we'll move on to the next one.

29:08.940 --> 29:11.260
This one was really interesting, though, so I wanted to include it.

29:11.260 --> 29:16.260
Another vulnerable endpoint on that same target was doing the same thing for DNS mask.

29:16.360 --> 29:19.000
So, we're like, okay, let's see if we can do the same thing there.

29:19.020 --> 29:25.280
So, of course, we Google, how to execute code with DNS mask config, and nothing comes up.

29:25.300 --> 29:27.280
Unfortunately, there's not a great way to do that.

29:27.300 --> 29:32.960
However, what every good DNS caching software needs is a built-in TFTP server.

29:33.860 --> 29:34.740
Yeah.

29:34.880 --> 29:39.420
Uh, so, essentially, that can be turned on via a DHTPD configuration.

29:39.540 --> 29:45.280
Uh, and you are able, then you will just be able to have FTP on the whole file system.

29:45.280 --> 29:48.440
And we're able to grab another file that can have a lot of impact.

29:48.440 --> 29:53.400
The problem was, is that we had double injection points this time around in the template, okay?

29:53.600 --> 29:56.360
And we really got stuck here for a long time.

29:56.360 --> 30:06.780
Because the user root directive, which is required to open up this TFTP server, cannot be duplicated twice.

30:06.780 --> 30:07.740
Just that one directive.

30:07.740 --> 30:10.540
Everything else can be duplicated, but the user root cannot.

30:11.780 --> 30:17.120
And so, because of the double injection points, we were having a really hard time with that.

30:17.120 --> 30:26.040
So, the solution, of course, is to reach out to Sam Erb, a Googler and double-time black badge guy.

30:26.080 --> 30:28.480
And say, hey, we've got this problem.

30:28.480 --> 30:29.320
And what does Sam do?

30:29.320 --> 30:35.320
Of course, he just opens up the C code for DNS Mask and starts reviewing how lines are getting parsed.

30:35.340 --> 30:39.760
Um, which is very Sam Erb of him to do.

30:39.760 --> 30:46.580
Uh, and he comes back and he says, hey, there's a maximum character length on a config line for DNS Mask.

30:46.580 --> 30:49.000
And that's 1025.

30:49.060 --> 31:01.860
So you might be able to essentially align the directive that you need and essentially utilize that maximum length to create a discrepancy between your two injection points.

31:02.660 --> 31:04.800
Um, that's the code that's vulnerable.

31:04.960 --> 31:07.720
It's not really vulnerable, it's just useful in this scenario.

31:07.880 --> 31:14.800
Um, and so what we did is one of those two double injection points was, the line was much longer than the other one.

31:14.800 --> 31:24.820
So, uh, on the shorter line, we created a, um, an injection that would not exceed the 1025 byte limit.

31:24.980 --> 31:33.640
And, uh, our user root directive would be, uh, placed inside of a comment at the end of that, uh, towards the end of that line, but not at the end.

31:33.640 --> 31:36.980
And then on the longer injection, let me see if I can show you.

31:36.980 --> 31:46.120
Yeah, at the longer injection, um, the line would overflow, the comments would be longer, and line up user root just on the, on the new line.

31:46.380 --> 31:49.620
Uh, that would be read, uh, when parsing the config file.

31:49.620 --> 31:59.400
So that was able to get one of our user root directives, um, in a commented out state, and the other one would get bumped to the next line of the DNS Mask config file.

31:59.660 --> 32:02.000
Um, so this is what the exploit looked like at the end.

32:02.000 --> 32:10.620
You can see the, uh, the top comment, uh, says, has user, uh, colon root at the end, and then all the other directives, which are fine to repeat.

32:10.620 --> 32:18.480
And then the IP set line, uh, has a bunch of A's, and then the A's are right up to that, uh, 1025 byte limit.

32:18.480 --> 32:24.480
And then user root gets dropped down into the next line, and, uh, gets parsed, uh, and executed.

32:24.480 --> 32:34.820
So using that, we were able to open up a TFTP server on port 69, and connect and exfiltrate, uh, data that we needed, uh, to get our C on the target again.

32:35.580 --> 32:36.720
That was another one.

32:36.720 --> 32:38.020
Uh, same program.

32:38.140 --> 32:41.000
Uh, I think maybe this was a little bit after the 10 days.

32:41.000 --> 32:44.340
It might have been 11 days or 12 days, but we found it pretty quickly afterwards.

32:45.700 --> 32:48.920
Uh, takeaway for this one is if it works, do it again.

32:48.920 --> 32:59.740
Uh, that's one of the big principles of bug bounty, is if you find a bug in one particular area, there's very likely to be bugs that are similar to it else, uh, in a similar, in a similar location.

32:59.740 --> 33:02.380
So definitely do your due diligence and go down that route.

33:03.260 --> 33:06.620
Okay, we're gonna do another one really quick, but I'm gonna get a drink of water first.

33:10.940 --> 33:12.400
Okay, bug number 9.

33:12.640 --> 33:13.540
We're doing really good.

33:13.540 --> 33:15.400
Actually, I'm moving a little fast.

33:15.700 --> 33:18.260
I may not use my full, uh, my full time block.

33:19.940 --> 33:21.160
Um, okay.

33:21.160 --> 33:24.460
So we, this time we've got a version control binary SQL injection.

33:24.460 --> 33:27.720
And I'm gonna make this one a little bit shorter because it's, it's kind of complicated.

33:28.120 --> 33:35.400
So we get this version control binary and I'm like, all right, let me see if I can do something out of my comfort zone and load it up into Ghidra.

33:35.800 --> 33:40.080
And then I get a bunch of errors relating to Microsoft and CLR and dot net.

33:40.380 --> 33:44.320
So I loaded up into dot peak and we were able to get the source code out.

33:44.320 --> 33:51.140
Uh, which was great because apparently you can, uh, like decompile those binaries and you get some really clean source code.

33:51.240 --> 33:59.940
So we were looking at the source code and essentially what was happening is, uh, we would be able to upload a file to a web version control interface.

33:59.940 --> 34:01.820
And that file could have a malicious name.

34:02.100 --> 34:04.840
Um, and then it would be stored in the version control environment.

34:04.840 --> 34:15.800
And the next time the user opened up, uh, and used that version control binary, it would, uh, pull the malicious file down and insert it into a, uh, SQLite database.

34:15.800 --> 34:29.120
So if you name a file, uh, an SQL injection payload, it would, uh, fire that and escape the, um, the string in the SQLite query and run arbitrary SQL on the victim's machine.

34:29.120 --> 34:32.360
This was found in collaboration with an amazing hacker named Odiotuk.

34:32.360 --> 34:35.360
And he reads C sharp code to fall asleep at night.

34:35.360 --> 34:38.980
So he was the original one who found this, uh, this sink.

34:38.980 --> 34:48.180
So how we exploited this was, uh, we were able to upload the file, sink it down, and then in the end, uh, we weren't able to get code execution.

34:48.180 --> 35:01.740
But what we were able to do was, uh, actually run code which would attach the user's, uh, Chrome cookies, which are stored in a SQLite database, uh, into and vacuum it into a B.DB file.

35:01.740 --> 35:06.500
And then recheck that file back into version control, which would push it back up to the web app.

35:06.500 --> 35:10.960
And then we could download and get ATO on that victim's web version control account.

35:11.480 --> 35:13.860
Um, and so that one, that was the end of the vuln.

35:13.860 --> 35:14.940
That was where we chained it to.

35:14.940 --> 35:16.500
That one was 30, 40K.

35:16.660 --> 35:20.820
And once again, wanted to reiterate, definitely hack with other hackers.

35:20.820 --> 35:24.640
It really expands your, your knowledge, especially in areas where you're uncomfortable.

35:24.940 --> 35:29.180
Um, I have to admit, I, I kind of underestimated SQLite.

35:29.180 --> 35:34.780
I kind of thought SQLite was a thing of the past, but they're out there and we see them pretty often in the live hacking events.

35:34.780 --> 35:36.380
Um, they're just a little bit deeper.

35:36.480 --> 35:38.420
And sometimes they're not even just a little bit deeper.

35:38.420 --> 35:39.620
They're, they're out there.

35:40.020 --> 35:46.960
Um, .peek is super helpful for those sort of decompilation scenarios when the base language is, I think like .net or C sharp.

35:46.960 --> 35:48.500
Um, so definitely check that out.

35:48.680 --> 36:00.480
Um, and yeah, I really, I really liked, uh, the exploitation scenario that we came up with there where we were able to vacuum the user's, uh, cookies into the version control and use that to exfiltrate the file as well.

36:01.900 --> 36:02.420
Yeah.

36:02.420 --> 36:04.180
And maybe don't roll your own version control.

36:04.180 --> 36:05.420
That's a nice takeaway as well.

36:05.720 --> 36:07.280
That never seems to end well.

36:07.900 --> 36:08.700
Okay.

36:08.700 --> 36:12.920
Now we are on to, uh, the very hard, uh, exploits.

36:12.920 --> 36:14.460
So buckle up.

36:14.460 --> 36:16.100
This one's going to take a hot second.

36:16.260 --> 36:17.860
I'm going to get water again.

36:23.670 --> 36:24.390
Okay.

36:24.390 --> 36:28.910
Target for this one was an in-home tabletop IOT device with camera and microphone.

36:28.910 --> 36:30.190
There's a couple out there.

36:30.190 --> 36:36.230
It's probably not the one you're thinking of, uh, but it is one of the top four or five you would be thinking of.

36:36.230 --> 36:47.670
Um, the end goal of this was, once again, I wanted to do creepy shit that people always say, okay, it's possible, but I haven't seen before and now I have.

36:47.670 --> 36:56.950
So I wanted to do no user interaction spying on, uh, some, in somebody's house and essentially just teleport myself into their house.

36:57.070 --> 37:01.650
Uh, and so I started going after that path and I started ideating on what the possibilities for this were.

37:01.650 --> 37:02.910
Here are a couple.

37:02.910 --> 37:04.790
We could get a no interaction shell on the device.

37:04.790 --> 37:06.310
That would be really challenging.

37:06.510 --> 37:14.090
We could gain some sort of, uh, insert company name here, admin functionality on the device and maybe that would allow us to do it.

37:14.090 --> 37:18.090
We could bypass auth specifically for the cam and mic related endpoints.

37:18.090 --> 37:22.710
We could compromise storage for video and audio feeds and maybe get access that way.

37:22.710 --> 37:32.350
Or we could access the built in functionality to access the cam and, uh, and mic stuff via a full authentication bypass on that person's account.

37:32.810 --> 37:34.450
So which one are we feeling guys?

37:34.450 --> 37:36.170
Raise your hands, put them up.

37:36.170 --> 37:40.050
I'm going to give a critical thinking t-shirt to anybody who gets it right.

37:43.150 --> 37:46.750
It was number three and the first person I see with number three is this guy right here.

37:46.750 --> 37:48.130
So I'll get you a t-shirt right after.

37:48.130 --> 37:49.070
Come up and get it.

37:49.070 --> 37:53.210
So it was bypass auth specifically for the cam and mic related endpoints.

37:53.210 --> 37:56.390
That's how we got it, so let's go ahead and go down that path.

37:57.130 --> 38:00.350
Okay, this IoT device has a Android app.

38:00.350 --> 38:05.930
And you can use that Android app, um, to video chat with this tabletop device, okay?

38:06.230 --> 38:16.330
And when you call yourself from the mobile app, there's an automatic answer on the IoT device just allowing you sort of pop into your house and say like, hey cat, how's it going?

38:16.330 --> 38:23.090
So I thought that was really sus and was a prime feature for accomplishing the goal that I mentioned before.

38:24.030 --> 38:30.190
So I started, I took the mobile app and I threw it into JADX and decompiled it and got the source code.

38:30.710 --> 38:33.230
And then the never ending story began, okay?

38:33.230 --> 38:36.170
So this app was kind of locked down.

38:36.270 --> 38:41.810
So the first thing was it had root detection and there was some weird stuff with Google Play.

38:41.810 --> 38:48.610
So essentially what I had to do was patch the APK to run Frida and I did that with objection.

38:48.770 --> 38:56.390
And then I would overwrite all of the root detection on the app so that it would think that I'm not, I wasn't in an environment.

38:56.750 --> 39:00.850
And then, and there was some emulator detection as well in there.

39:01.430 --> 39:06.810
And so then the next one was bypassing TLS, pinning for HTTP.

39:06.810 --> 39:09.510
Of course they had that in place, most apps do nowadays.

39:09.510 --> 39:15.950
And so I had to come up and they had, unfortunately, a custom SIRT pinning solution.

39:15.950 --> 39:26.150
Most of the time, Joel, my boy here, has a public TLS SIRT pinning script that will just unpin most of the apps, which is super helpful.

39:26.150 --> 39:33.030
But this one was not so easy, so I had to break, you know, go into the code and find exactly where the SIRT pinning was occurring.

39:33.030 --> 39:38.350
And overwrite those functions with the JavaScript in the Frida code.

39:38.350 --> 39:39.970
I'm gonna check my time really quickly.

39:40.190 --> 39:42.310
Nope, my phone died, so I'm not.

39:43.530 --> 39:44.470
What you got?

39:45.270 --> 39:46.750
536, alright, thanks guys.

39:46.750 --> 39:51.250
I was running my hotspot off of it for the last workshop and then I looked down and it was dead.

39:51.470 --> 39:57.930
Okay, so at that point, cool, we bypassed SIRT pinning and we've got HTTP introspection.

39:58.030 --> 39:58.770
Great.

39:58.770 --> 40:01.190
Now let's see how this whole calling thing works, right?

40:01.550 --> 40:04.810
Nope, because the calling thing is behind SIP.

40:04.810 --> 40:10.590
And more specifically SIPs, which is the secure version of the SIP protocol.

40:10.590 --> 40:11.370
Okay, what is SIP?

40:11.370 --> 40:12.470
Well, let me tell you.

40:12.950 --> 40:23.390
The Session Initiation Protocol, SIP, is a signaling protocol to initiate, maintain, and terminate real-time sessions that involve video, voice, messaging, and other communication applications and services.

40:23.870 --> 40:26.750
SIP is widely used for voice and video calls.

40:27.090 --> 40:27.770
Great.

40:27.770 --> 40:29.890
Now I've got to deal with another protocol.

40:29.890 --> 40:34.570
And it is also TLS-wrapped, so a bunch of stuff going on there.

40:35.070 --> 40:42.270
So I start working on that and find a custom SIRT pinning solution for SIPs and kind of am able to disable that.

40:42.790 --> 40:52.130
But BURP, while it is SIPs-friendly, is not SIPs-compatible and will break the application if you try to proxy it.

40:52.130 --> 40:56.450
So what I realized I needed is... and this is kind of how it looks right there.

40:56.450 --> 41:03.650
It will issue the register request with the SIP HTTP verb, or the register HTTP verb that is associated with the SIP protocol.

41:03.650 --> 41:06.230
But then it will just break the response.

41:06.870 --> 41:09.850
So I had to find a transparent proxy.

41:10.090 --> 41:11.970
And for this I used PolarProxy.

41:11.970 --> 41:16.090
It is a transparent TLS and SSL inspection proxy.

41:16.090 --> 41:22.650
So I took that and I took the SIRT for that and I inserted it into the trust store for that specific mobile app.

41:22.730 --> 41:28.690
And then I proxied all the stuff through PolarProxy and that would output a PCAP file.

41:29.090 --> 41:37.350
And then finally we had access to reading what was going on and I was able to get introspection on SIPs without breaking the whole app.

41:37.350 --> 41:43.370
We are probably a week or two into looking at this target at this point.

41:43.370 --> 41:48.610
With no leads, no potential loans, no gadgets, nothing.

41:48.610 --> 41:50.490
Just setup at this point.

41:50.490 --> 41:57.930
Which is amazing to me as a bug hunter because normally I spend a lot of time looking to find gadgets and I feel sort of accomplished going along the way.

41:57.930 --> 42:06.210
But this was a big up front investment and I think people that do this sort of thing, mobile hacking or IoT device hacking, have a lot more up front.

42:06.210 --> 42:07.330
Which is really tricky.

42:07.510 --> 42:13.110
That's something from a bug bounty perspective that the programs really need to help and minimize as much as possible.

42:13.110 --> 42:21.910
If you want your mobile apps and your IoT devices and your desktop applications to get as much interest as your web applications do.

42:23.030 --> 42:25.450
Okay, so now we finally get to see how all this works.

42:25.490 --> 42:27.470
So let's talk through that flow a little bit.

42:27.470 --> 42:31.710
So step one is, let's talk about getting a call, receiving a call.

42:31.710 --> 42:37.830
So you open up the app and it right away does a call to slash API slash get SIP auth token.

42:37.830 --> 42:40.970
With your auth token associated with your account.

42:41.250 --> 42:44.310
And then it will return a token that sort of looks like this.

42:44.310 --> 42:49.750
It's sort of like a JWT but it's not actually Base64 encoded.

42:49.750 --> 42:52.630
And it has these various delimiters in them.

42:52.630 --> 42:55.770
The ones that's most interesting to us is the payload delimiter.

42:55.770 --> 43:04.070
And in that payload delimiter there is a from field and a to field and a bunch of other fields.

43:04.070 --> 43:06.890
But the ones that are most interesting are the from and to fields.

43:08.010 --> 43:12.510
So then what would happen then is they would take that auth token that they got from the API request.

43:12.510 --> 43:16.470
They would put that as a header in SIP protocol which is very similar to HTTP in a lot of ways.

43:16.470 --> 43:18.470
The concepts are very similar.

43:18.570 --> 43:20.830
There's headers and stuff like that and they look similar.

43:20.830 --> 43:27.850
And then it would put that auth token into the request with its own SIP level from to and contact headers.

43:27.890 --> 43:35.870
And that would essentially allow you to register the address of record that is in the to header.

43:37.310 --> 43:46.010
And when it does this registration it validates that the from and to fields from the auth token match the from and to fields in the SIP request.

43:46.010 --> 43:51.730
And then somehow through black magic when somebody calls your phone will ring.

43:51.730 --> 43:52.410
It's kind of nut.

43:52.410 --> 43:56.010
I don't know how all that transport stuff happens in the background.

43:56.650 --> 44:00.370
But I thought that was interesting so I went ahead and moved along.

44:00.370 --> 44:02.630
And so now let's look at making a call.

44:02.630 --> 44:04.590
So say we want to call somebody else.

44:04.590 --> 44:09.610
So we go ahead and send a request to slash API slash init call auth.

44:09.610 --> 44:14.430
And we provide as a post parameter to that a target.

44:14.430 --> 44:22.570
And this target will be reflected in the payload in the from field.

44:22.570 --> 44:24.930
Or I'm sorry the to field because we're making a call.

44:25.890 --> 44:27.190
And that was great.

44:27.190 --> 44:37.770
And then you use that in an invite SIP request with the from and to headers matching the values in the auth token.

44:37.770 --> 44:42.710
And then somehow through black magic the other person's device starts ringing.

44:42.710 --> 44:49.010
And you go through all these networks and you send the TCP data through or the UDP data depending on the flow.

44:49.410 --> 44:50.050
Okay.

44:50.050 --> 44:58.170
And once again I'm going to reiterate for that to happen the from and to headers in the SIP request have to match the auth token.

44:58.170 --> 44:58.790
Right?

44:59.330 --> 45:03.930
So let's talk a little bit about how we could fake a call.

45:03.930 --> 45:13.730
So in the API slash init call request or call auth request the target that we would specify was actually accepted arbitrary data.

45:13.730 --> 45:19.510
And so what that would allow us to do is then inject arbitrary data into that auth token that is used at the SIP level.

45:19.510 --> 45:30.150
And so then what we proceeded to do was close the little delimiter there or put the person in for the to header so it doesn't fail.

45:30.150 --> 45:31.250
Semi colon out.

45:31.430 --> 45:33.510
And then provide another header.

45:33.510 --> 45:34.070
Five minutes?

45:34.070 --> 45:34.630
Oh wow.

45:34.630 --> 45:35.630
Okay I gotta move.

45:35.630 --> 45:41.050
Um then provide another from header uh as uh person two.

45:41.090 --> 45:49.910
Um so this was this would look like the call was coming from person two the person receiving the call and to person two.

45:49.910 --> 45:58.330
Which right we we discussed earlier was how you automatically auth into the device and check on your cat or whatever if you're calling from the mobile device.

45:58.330 --> 46:05.470
So we were able to uh smuggle in that from field and uh we would generate the the token with request number one.

46:05.470 --> 46:08.690
Put it into the invite uh SIP request.

46:08.770 --> 46:17.330
And since the from and to fields matched and the um auth token validated those two things.

46:17.330 --> 46:20.070
Uh the call would happen and it would auto answer.

46:20.070 --> 46:24.950
However there was no contact field in the auth token so that wasn't validated.

46:24.950 --> 46:30.390
And the contact thing is actually where the contact header is where the call gets actually routed to.

46:30.410 --> 46:35.630
Um so then you could see it on your device and you would be looking through that person's uh IOT device.

46:35.870 --> 46:38.890
Um which was nuts and I cannot believe it worked.

46:39.610 --> 46:44.030
Um but wait you might ask what is up with the from header there?

46:44.030 --> 46:44.830
Right?

46:44.870 --> 46:48.790
Um well the from header uh was an interesting situation.

46:48.790 --> 46:55.150
Because uh as much as we thought we had source code there was one more challenge that awaited for us at that point.

46:55.330 --> 47:04.050
Um which was we're using polar proxy so how do we do repeater or intercept on these things to modify the requests as they were going through?

47:04.050 --> 47:09.750
Well the answer to that is a shit ton of Frida or Frida uh calls.

47:09.750 --> 47:16.110
To overwrite and actually use the mobile client as our own you know proxy to send stuff through.

47:16.110 --> 47:18.310
Um which was really painful.

47:18.310 --> 47:24.050
And unfortunately the section that set that from header was automatically done inside of a dot so file.

47:24.050 --> 47:27.250
A binary file within the uh app.

47:27.610 --> 47:31.470
So it couldn't be hooked very easily with Frida because of the situation.

47:31.470 --> 47:34.270
So I was kind of lost at this point what do I do?

47:35.070 --> 47:38.470
And I was talking to another awesome hacker named Space Raccoon.

47:38.710 --> 47:43.210
And uh he advised hey man it's a you know why don't you just patch the binary?

47:43.710 --> 47:46.370
And I was like that's scary as hell.

47:46.370 --> 47:47.530
I don't know how to do that.

47:47.530 --> 47:51.110
And then he realized or he told me that it's just a string.

47:51.130 --> 47:57.510
So just search the binary for that string and replace the O with an A and it will automatically put in a different header.

47:57.510 --> 48:00.150
So I did that in a hex editor and it worked.

48:00.150 --> 48:06.030
And then I was able to add another from header via the Java bindings which matched the auth token.

48:06.030 --> 48:11.630
And allowed me to bypass auth and peer through anybody's desktop IOT device.

48:12.290 --> 48:13.470
Whew okay.

48:13.550 --> 48:16.610
And that was a 20 to 50k bug.

48:16.830 --> 48:21.550
Um and takeaways for that were set a goal and go after it really hard.

48:21.550 --> 48:26.390
Because some of this crazy stuff that they talk about in the horror stories is really possible.

48:26.390 --> 48:30.830
Um and I've become a believer in that since this happened.

48:30.930 --> 48:33.010
Last bug is really quick.

48:33.130 --> 48:37.850
Um and I should be able to go through pretty quickly because it's in the same stack.

48:38.030 --> 48:43.790
Um this was a bug where you could hijack calls going to other people.

48:43.790 --> 48:49.650
And the way that you did that was using that token the call auth token.

48:49.650 --> 48:53.090
Um so let me uh yeah.

48:53.090 --> 48:56.650
So you can see here right that the register token as a reminder.

48:56.870 --> 49:01.370
Uh the register token where you register your name has a to and from field that match.

49:01.370 --> 49:05.910
The call token has a from and to field that are different from each other.

49:05.910 --> 49:07.810
Because you're calling somebody else right.

49:08.030 --> 49:11.210
Um when we look at the register SIP request that occurs.

49:11.210 --> 49:13.850
Um there's this caveat in the from section.

49:14.070 --> 49:17.990
Which essentially allows for this feature called third party registration.

49:17.990 --> 49:20.550
Where you are registering for somebody else.

49:20.690 --> 49:26.590
Now when we use the init call um HDP request to generate the token.

49:26.630 --> 49:32.770
Uh we can specify a different from or a different to header in that auth token right.

49:32.770 --> 49:34.850
Because that's the person we're calling to.

49:34.850 --> 49:37.990
So then we can take that token which has the same signature.

49:38.250 --> 49:40.690
And apply it to the register header.

49:40.690 --> 49:43.910
And it will have a from header that is different from the to header.

49:43.910 --> 49:46.830
And the to header can be any one that we specify.

49:46.830 --> 49:49.370
So then we could register.

49:49.370 --> 49:52.510
Essentially do a third party register for any other user.

49:52.630 --> 49:54.950
And map their address of record right.

49:54.950 --> 49:56.730
The thing that routes the call to them.

49:56.730 --> 49:59.650
To our contact location.

49:59.710 --> 50:02.790
Uh and then when somebody calls that user.

50:02.790 --> 50:04.830
Our device would start ringing.

50:05.330 --> 50:08.130
And that one was another 20 to 50k.

50:08.130 --> 50:10.610
Critical, critical, critical on a public program.

50:10.610 --> 50:13.390
And uh takeaways are pretty much the same.

50:13.390 --> 50:15.710
Uh but don't be afraid of new protocols.

50:15.710 --> 50:20.190
Uh and that is one of the biggest takeaways I've found in my many, many years of bug bounty.

50:20.730 --> 50:22.210
Alright, that was the recap.

50:22.210 --> 50:23.990
11 bugs, all paid as critical.

50:23.990 --> 50:28.370
The grand total for this was somewhere between 225 and 400k.

50:28.370 --> 50:29.650
For all those bugs.

50:29.990 --> 50:31.110
And that's it.

50:31.110 --> 50:32.250
Thank you guys.

