1 00:00:00,000 --> 00:00:02,900 All righty y'all, I think we're going to go ahead and get started a little bit early. 2 00:00:03,280 --> 00: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. 3 00:00:07,460 --> 00:00:12,540 Also, I realized that I got super lucky because this is the last slot of the day. 4 00:00:13,260 --> 00:00:15,520 So we can go a little bit long, which is exciting. 5 00:00:16,060 --> 00:00:17,520 You guys can hear me all right on this one too, right? 6 00:00:17,520 --> 00:00:19,000 I kind of like to walk around a little bit. 7 00:00:19,000 --> 00:00:22,420 Okay , so I need to point it right at it. 8 00:00:22,420 --> 00:00:26,140 Okay, so for any of you the guys that don't know me, I'm Justin Gardner, a.k.a. 9 00:00:26,140 --> 00:00:26,900 Rhino Raider. 10 00:00:26,900 --> 00:00:29,880 I'm a professional live hacking event participant, a.k.a. 11 00:00:29,880 --> 00:00:32,240 full-time Bug Bounty, a.k.a. 12 00:00:32,440 --> 00:00:33,580 no job. 13 00:00:33,840 --> 00: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. 14 00:00:44,300 --> 00:00:48,840 I'm the host of the Critical Thinking Bug Bounty podcast with my boy Joel right here as the co-host. 15 00:00:48,860 --> 00:00:50,940 And I'm also advisor for Kaido. 16 00:00:51,780 --> 00:00:54,200 So check those out if you're interested. 17 00:00:54,700 --> 00:00:57,480 All right, let's go ahead and talk about the roadmap for today's talk. 18 00:00:58,600 --> 00:01:02,780 We're going to hit 11 bugs, and I don't have to rush, which is great. 19 00:01:02,900 --> 00:01:05,480 I was going to give you a disclaimer that we're going to move pretty quickly. 20 00:01:05,780 --> 00: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. 21 00:01:19,480 --> 00:01:23,160 Some of the people go up on stage and present the bugs that they've found. 22 00:01:23,160 --> 00: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. 23 00:01:29,760 --> 00:01:31,680 And I'm going to walk you through each one. 24 00:01:31,680 --> 00:01:36,880 And I'm going to do so at as much technical depth as I can without revealing the target. 25 00:01:37,900 --> 00:01:39,820 We have three easy bugs. 26 00:01:39,820 --> 00:01:42,860 We have two mediums, four hards, and two very hards. 27 00:01:42,860 --> 00: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. 28 00:01:47,640 --> 00:01:48,660 So let's jump into it. 29 00:01:48,660 --> 00:01:52,880 First one is an NGINX 403 bypass to PII leak. 30 00:01:53,360 --> 00:01:56,080 So this is on a semi-private program. 31 00:01:56,080 --> 00: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. 32 00:02:11,320 --> 00:02:15,300 And you can easily get added to that program and paid for a bug if you have a bug. 33 00:02:16,320 --> 00: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. 34 00:02:26,440 --> 00:02:32,120 And then they've modified it to be publicly used so anybody can sign up and log into this app. 35 00:02:32,120 --> 00:02:32,260 Right . 36 00:02:32,260 --> 00:02:35,720 So when they do that, of course, the threat model changes for the application. 37 00:02:35,720 --> 00:02:36,360 Right. 38 00:02:36,380 --> 00:02:38,000 So I thought that was really sketchy. 39 00:02:38,000 --> 00:02:40,000 So I decided to look into it a little bit deeper. 40 00:02:40,780 --> 00: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. 41 00:02:50,240 --> 00: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. 42 00:02:57,300 --> 00:02:57,820 Right. 43 00:02:57,960 --> 00:03:01,900 However, in a public application, that information may be more sensitive. 44 00:03:01,900 --> 00:03:06,960 So I decided to look for those sort of endpoints, exploiting implicit trust and leak user data. 45 00:03:07,700 --> 00:03:13,760 So I identified a couple of those endpoints in the sort of internal use version of the software. 46 00:03:13,880 --> 00:03:18,640 And when I hit them on the API, I noticed that I got an NGINX 403. 47 00:03:18,640 --> 00:03:19,060 Right. 48 00:03:19,060 --> 00:03:20,820 Instead of the application level 403. 49 00:03:20,820 --> 00:03:22,600 You can see the differences over there. 50 00:03:22,660 --> 00:03:29,420 The NGINX 403 seems to imply that there is this sort of structure. 51 00:03:29,420 --> 00:03:29,740 OK. 52 00:03:29,740 --> 00:03:31,500 So we're on the network. 53 00:03:31,500 --> 00:03:34,440 We send a request over the Internet to the NGINX reverse proxy. 54 00:03:34,440 --> 00:03:37,380 That's standing in front of the backend server. 55 00:03:37,380 --> 00: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. 56 00:03:42,900 --> 00:03:47,060 Pretty standard NGINX structure or reverse proxy structure. 57 00:03:47,060 --> 00:03:54,420 However, when we request the API endpoint slash API slash internal slash get all users, that's not the API endpoint. 58 00:03:54,500 --> 00:03:56,180 That's obfuscated. 59 00:03:56,640 --> 00:03:59,600 It hits the reverse proxy. 60 00:03:59,600 --> 00:04:02,520 And then the reverse proxy says not allowed. 61 00:04:02,520 --> 00:04:03,120 Right. 62 00:04:03,120 --> 00: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. 63 00:04:09,400 --> 00:04:10,660 So what do we do? 64 00:04:10,660 --> 00:04:12,380 We try get all users. 65 00:04:12,380 --> 00:04:13,420 We hit the 403. 66 00:04:13,420 --> 00: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. 67 00:04:26,140 --> 00:04:26,560 Right . 68 00:04:26,560 --> 00:04:27,880 We get a 404 there. 69 00:04:27,880 --> 00:04:34,520 So not that whole path is slash API slash internal is not all blocked, just get all users. 70 00:04:34,580 --> 00: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. 71 00:04:48,840 --> 00:04:53,380 And it would be parsed on the backend as an S. 72 00:04:53,380 --> 00:04:57,160 So it would match that get all users route and dump back a ton of data. 73 00:04:58,200 --> 00:05:02,600 So the impact of that one was 4.5 million users PII leaked. 74 00:05:02,600 --> 00:05:04,540 The bounty was between 15 and 20K. 75 00:05:04,540 --> 00:05:10,960 I'm going to give you ranges because some of the ranges can, the actual numbers can disclose the programs. 76 00:05:11,180 --> 00:05:15,700 The severity was critical, critical, critical, which is what we say from the critical thinking podcast. 77 00:05:15,700 --> 00:05:17,020 Shout out to YT Cracker. 78 00:05:17,280 --> 00:05:20,600 And this program was semi-private as mentioned before. 79 00:05:20,600 --> 00:05:24,900 The takeaways for this one were obviously that change to threat model. 80 00:05:25,900 --> 00:05:28,420 Identify odd and out of place 403 pages. 81 00:05:28,420 --> 00: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. 82 00:05:39,760 --> 00: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. 83 00:05:49,200 --> 00:05:51,780 So I bet that would also be really helpful here. 84 00:05:52,380 --> 00:05:58,120 So the last takeaway is know your bypass tricks, URL encoding, double URL encoding, path reversal, et cetera. 85 00:05:58,120 --> 00:05:59,120 All right, let's move to the next one. 86 00:05:59,120 --> 00:06:00,460 This one's really easy. 87 00:06:00,460 --> 00:06:04,100 It's an arbitrary count takeover via docs, essentially. 88 00:06:04,100 --> 00: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. 89 00:06:12,620 --> 00:06:16,160 And there's an authorization header required for that. 90 00:06:16,300 --> 00:06:18,180 And the body is really simple. 91 00:06:18,180 --> 00:06:20,860 It's just grant type equals password. 92 00:06:20,860 --> 00:06:25,400 And then user equals username, password equals password. 93 00:06:25,400 --> 00:06:26,860 That's exactly what you would expect. 94 00:06:27,300 --> 00:06:29,060 And it dumps back the access token. 95 00:06:29,060 --> 00:06:30,240 Very, very reasonable. 96 00:06:31,120 --> 00:06:32,120 But wait a second. 97 00:06:32,220 --> 00:06:33,060 A password? 98 00:06:33,060 --> 00:06:36,680 This application is a OTP login application. 99 00:06:37,100 --> 00:06:38,000 There's no password. 100 00:06:38,000 --> 00: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. 101 00:06:41,780 --> 00:06:42,940 So how does that work? 102 00:06:42,940 --> 00:06:44,400 So I started building it out. 103 00:06:44,400 --> 00:06:47,120 And when I sent the request, I got a 401 unauthorized. 104 00:06:47,120 --> 00:06:55,920 Of course, we need to authorize with the credentials mentioned in the doc for the authorization header. 105 00:06:56,440 --> 00:07:00,240 So I went and I needed that. 106 00:07:00,240 --> 00:07:01,500 So I was like, what do I do? 107 00:07:01,500 --> 00:07:04,020 Of course, to the JS files. 108 00:07:04,180 --> 00:07:05,940 So I search in the JS files. 109 00:07:05,940 --> 00:07:10,920 I'm looking for the part of the UI that uses this request. 110 00:07:10,920 --> 00:07:16,780 And I find sitting in the JS files these authorization credentials. 111 00:07:16,780 --> 00:07:19,080 And they're obviously Base64 encoded. 112 00:07:19,080 --> 00:07:20,440 And the values were kind of odd. 113 00:07:20,440 --> 00:07:24,680 I can't show them to you, but they weren't random. 114 00:07:24,680 --> 00:07:26,280 They were just a string. 115 00:07:26,280 --> 00:07:27,900 So it was a little bit of an odd setup. 116 00:07:28,900 --> 00:07:35,800 And so then using those authorization basic credentials, we could literally just submit any password for any user. 117 00:07:35,800 --> 00:07:42,620 And it would accept it and dump back the authorization token, giving us access to arbitrary account takeover on this target. 118 00:07:42,620 --> 00:07:44,280 This is a public program. 119 00:07:44,280 --> 00:07:46,980 This is a very high-paying public program. 120 00:07:46,980 --> 00:07:48,420 And this sort of stuff is out there. 121 00:07:49,360 --> 00:07:51,860 So this was... thank you, thank you. 122 00:07:52,000 --> 00:07:58,960 This was an arbitrary ATO on double-digit million accounts, 40 to 60K bounty, of course, critical. 123 00:07:58,960 --> 00:08:01,560 And like I mentioned, public, public program. 124 00:08:01,560 --> 00:08:07,940 So takeaways for this will be read the docs, think about the docs, and then check the JS. 125 00:08:08,340 --> 00:08:11,000 Because there's a lot of good stuff in there. 126 00:08:11,600 --> 00:08:13,340 All right, next, bug number three. 127 00:08:13,340 --> 00:08:15,460 This one's very similar to the last one. 128 00:08:15,500 --> 00:08:20,920 Essentially, you take the AuthBearer and you log into that API, that godforsaken API. 129 00:08:21,220 --> 00:08:30,500 And there's simply a numeric IDOR in that API that literally leaks password hashes and password reset tokens. 130 00:08:31,180 --> 00: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. 131 00:08:36,900 --> 00:08:38,540 So that's interesting. 132 00:08:38,540 --> 00:08:40,760 But yeah, the password reset token is there. 133 00:08:40,760 --> 00: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. 134 00:08:46,480 --> 00:08:48,360 This was also 40 to 60K. 135 00:08:48,760 --> 00:08:54,240 And the takeaway from this one that's different from the other one is just get really deep into these apps. 136 00:08:54,760 --> 00: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. 137 00:09:05,180 --> 00:09:07,400 So that's the behind the scenes. 138 00:09:07,400 --> 00: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. 139 00:09:14,440 --> 00:09:18,180 Okay, bug number four, we're moving into the medium difficulty section now. 140 00:09:18,260 --> 00:09:22,880 This was a blind XSS via SMS to arbitrary account takeover. 141 00:09:23,040 --> 00:09:28,480 So this was on an app that was a place where you could buy a car. 142 00:09:28,520 --> 00: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? 143 00:09:36,240 --> 00:09:38,680 So you go ahead and find a car. 144 00:09:38,780 --> 00:09:41,380 I was interested in this DeLorean for $42 million. 145 00:09:42,080 --> 00:09:44,580 And so I went ahead and filled it out. 146 00:09:44,680 --> 00: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. 147 00:09:52,320 --> 00:09:53,960 When can we meet to see the car? 148 00:09:53,960 --> 00:09:54,960 I was like, okay, wow. 149 00:09:54,960 --> 00:09:55,820 How did they do that? 150 00:09:55,820 --> 00: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. 151 00:10:01,380 --> 00:10:06,180 So I said, okay, let me go ahead and log into the dealer software and get that perspective. 152 00:10:06,180 --> 00:10:07,140 So this is what I see. 153 00:10:07,140 --> 00:10:12,420 You can select the users that you want to view the details for on the left hand side. 154 00:10:12,420 --> 00:10:14,480 And there's like an info and a financing tab. 155 00:10:14,480 --> 00:10:18,480 And you can kind of inspect that lead that had come through the website. 156 00:10:19,340 --> 00:10:21,460 And so I started reading the code on that page. 157 00:10:21,460 --> 00:10:24,860 And there's like some super long window object that's kind of difficult to read. 158 00:10:24,860 --> 00: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. 159 00:10:33,980 --> 00:10:36,880 And there was a messages feature flag. 160 00:10:36,880 --> 00:10:39,680 So we turned that from false to true. 161 00:10:39,960 --> 00:10:46,160 And you can see, yeah, from false to true with this easy Kaido match and replace rule. 162 00:10:46,680 --> 00:10:52,280 And voila, the messages tab appears in the application and we have the ability to use it. 163 00:10:52,460 --> 00:10:57,460 So as we go into that application, we can send messages to the various leads. 164 00:10:57,460 --> 00:10:59,320 It'll go to the phone number that they submitted. 165 00:10:59,680 --> 00:11:02,120 And then you can interact with them. 166 00:11:02,260 --> 00:11:03,140 Great. 167 00:11:03,140 --> 00:11:05,600 So I sent myself a message. 168 00:11:05,600 --> 00:11:06,880 I submitted a lead, sent myself a message. 169 00:11:06,880 --> 00:11:12,260 And I thought, okay, wow, wouldn't it be cool if I could SMS myself an XSS payload? 170 00:11:12,300 --> 00: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. 171 00:11:23,860 --> 00: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. 172 00:11:34,720 --> 00:11:38,800 So we've got blind XSS, but what can we do with it to get more impact? 173 00:11:39,180 --> 00:11:45,640 Well, the authorization flow for this application happened in an invisible iframe right near this interface. 174 00:11:45,920 --> 00: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. 175 00:11:52,560 --> 00: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. 176 00:12:00,860 --> 00:12:06,420 And then I stole the code out of the iframe and exfiltrated that to the attacker server. 177 00:12:06,580 --> 00: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. 178 00:12:20,260 --> 00:12:25,500 And you don't have to bypass MFA or anything like that because the session token is there. 179 00:12:25,740 --> 00:12:26,220 Great. 180 00:12:26,220 --> 00:12:29,820 So now we've got, we can log in as the dealer, we've got ATO. 181 00:12:29,820 --> 00:12:31,400 How can we get even more impact? 182 00:12:31,400 --> 00:12:36,940 Well, that same request had three vulnerabilities in it, okay? 183 00:12:36,940 --> 00: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. 184 00:12:46,940 --> 00:12:52,320 So essentially what this means is that we can worm this XSS across all of the dealers. 185 00:12:52,320 --> 00: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. 186 00:12:59,260 --> 00: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. 187 00:13:06,480 --> 00:13:08,580 So that was bad. 188 00:13:13,020 --> 00:13:21,680 And that was an arbitrary ATO of double-digit million users, PII leak, 20 to 40K. 189 00:13:21,680 --> 00:13:23,340 This was on a private program. 190 00:13:23,420 --> 00:13:26,520 However, this program will be going public soon, I'm aware. 191 00:13:26,840 --> 00:13:32,500 And the takeaway for this is look at all the, look at the application from all perspectives, right? 192 00:13:32,500 --> 00: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. 193 00:13:37,180 --> 00:13:40,160 Make sure you're turning on all the feature flags with match and replace. 194 00:13:40,160 --> 00:13:43,480 That can enable features that are essential. 195 00:13:44,020 --> 00:13:47,240 And look for alternative data input paths like SMS. 196 00:13:47,680 --> 00:13:51,460 And then lastly, of course, chain, chain, chain to get maximum impact. 197 00:13:52,740 --> 00:13:56,520 Okay, bug number five, snoop on other people's meetings. 198 00:13:56,520 --> 00:13:57,840 This was a really interesting one. 199 00:13:57,840 --> 00:13:59,400 It's going to be a little brief. 200 00:13:59,400 --> 00:14:04,620 But there was a target that I came across in a video chat and team collaboration app. 201 00:14:04,620 --> 00: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? 202 00:14:16,580 --> 00:14:19,700 So I started investigating how exactly that worked. 203 00:14:19,700 --> 00:14:24,200 I read the developer's docs, the JavaScript code, the GitHub issues, everything. 204 00:14:24,380 --> 00:14:29,940 And when I was investigating the GitHub issues, this GitHub issue popped up. 205 00:14:29,940 --> 00:14:34,660 It says the participant list is wrong when XYZ audio device is used. 206 00:14:34,660 --> 00:14:36,260 And I was like, huh, that's weird. 207 00:14:36,260 --> 00:14:41,460 So the participant list didn't get updated when the user has a broken audio device. 208 00:14:41,460 --> 00:14:42,600 Why would that be happening? 209 00:14:42,600 --> 00: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. 210 00:14:51,320 --> 00:14:54,760 So how does this joining meeting work? 211 00:14:54,760 --> 00:14:57,900 The user connects first over WebRTC. 212 00:14:57,940 --> 00:15:02,660 Then they get all of the information like the call, comms channels, etc. 213 00:15:02,840 --> 00:15:10,220 And then the JS code identifies an audio device that the user can use or it creates a fake audio device. 214 00:15:10,220 --> 00:15:15,360 And then the client-side JS sends the audio connect signal to join. 215 00:15:16,180 --> 00:15:17,280 Wait, what? 216 00:15:17,280 --> 00:15:19,880 It sends an audio connect signal to join. 217 00:15:19,880 --> 00:15:26,240 That little bloop that you hear when you join a meeting was the thing actually triggering the participant list update. 218 00:15:26,240 --> 00:15:28,620 Which I really could not believe. 219 00:15:28,640 --> 00:15:34,280 And so since this was happening on the client-side, we could just not send the signal. 220 00:15:34,420 --> 00:15:37,360 And that's exactly what we did with this match and replace rule. 221 00:15:37,780 --> 00: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. 222 00:15:46,720 --> 00:15:49,860 And we became Snoop Dogg in that environment. 223 00:15:49,860 --> 00:15:51,200 Okay, so let's see how it worked. 224 00:15:51,200 --> 00:15:53,120 Here's my Snoop Dogg POC right here. 225 00:15:53,120 --> 00:15:53,980 That's what I named it. 226 00:15:53,980 --> 00:15:55,360 The triagers loved it. 227 00:15:55,820 --> 00:16:00,260 And essentially what you would do is paste in the meeting information. 228 00:16:00,380 --> 00:16:02,240 And then you would click Snoop. 229 00:16:02,240 --> 00:16:07,260 And it would actually exfiltrate the user's transcripts. 230 00:16:07,260 --> 00:16:11,280 And you would not see anything in the meeting participant list. 231 00:16:12,580 --> 00:16:16,680 So that one was a 20 to 25k bounty. 232 00:16:16,680 --> 00:16:19,260 It was technically high, but it was paid as a critical. 233 00:16:19,260 --> 00:16:22,340 Given the various bonuses that were occurring. 234 00:16:22,340 --> 00:16:23,820 This was on a public program as well. 235 00:16:24,320 --> 00:16:25,740 So takeaways from this one. 236 00:16:25,740 --> 00:16:31,180 Reading the GitHub issues can have massive dividends, especially anything related to security or privacy. 237 00:16:32,120 --> 00:16:35,720 Set goals for your target, like being able to Snoop on meetings. 238 00:16:35,840 --> 00:16:40,520 And then verify in the code base how this works, especially on the client side. 239 00:16:41,600 --> 00:16:43,860 Okay, we are 15 minutes in. 240 00:16:43,860 --> 00:16:45,180 Dude, we are doing good. 241 00:16:45,180 --> 00:16:46,940 I may not keep you here long. 242 00:16:46,940 --> 00:16:50,000 We will see though, because now things are getting a little bit trickier. 243 00:16:50,180 --> 00:16:52,260 So this one is going to be a long one. 244 00:16:52,440 --> 00:16:58,440 This one was a Perforce server to client RCE. 245 00:16:58,700 --> 00:17:00,520 And I will explain what that is in just a second. 246 00:17:00,520 --> 00:17:04,980 The target for this was a desktop application used for game development. 247 00:17:05,300 --> 00:17:08,340 The problem is, I suck at hacking desktop applications. 248 00:17:08,340 --> 00:17:12,540 Note that I did not add that in the list of things that I often hack in the intro slide. 249 00:17:12,880 --> 00:17:16,200 So I was thinking, how can I attack this? 250 00:17:16,200 --> 00:17:19,060 This is kind of a little bit outside of my comfort zone. 251 00:17:19,200 --> 00:17:23,440 I can't really do privilege escalation stuff, because this doesn't really run in a privileged environment. 252 00:17:23,540 --> 00:17:26,220 So I was thinking, okay, but local attacks are kind of dumb anyway. 253 00:17:26,400 --> 00:17:28,560 Let me try to focus on remote attacks. 254 00:17:28,560 --> 00:17:30,300 And these are some of the ideas that I came up with. 255 00:17:30,300 --> 00:17:34,080 I just want to walk you through the process, so all of this doesn't seem too easy. 256 00:17:34,080 --> 00:17:37,240 And you see how often we fail when attacking targets like this. 257 00:17:37,760 --> 00:17:39,860 So here are some of the attack factors I came up with. 258 00:17:39,860 --> 00:17:45,060 I was thinking, we could open a malicious file in the development thing, and something bad would happen. 259 00:17:45,060 --> 00:17:50,480 We could connect to a malicious server with the development environment, and then something bad would happen. 260 00:17:50,480 --> 00:17:56,900 We could attack the software development lifecycle, a la Lupin, a la Ronnie Carta right here. 261 00:17:57,060 --> 00:18:01,720 And try to inject something into the build of this application itself. 262 00:18:02,080 --> 00:18:10,120 We could take advantage of some sort of misconfiguration in the actual code itself. 263 00:18:10,120 --> 00:18:15,020 Like maybe it's reaching out to an unclaimed domain, or an unclaimed S3 bucket, and inject sort of there. 264 00:18:15,020 --> 00:18:21,460 Or we could take these reusable game component pieces that were being processed, and try to do something with those. 265 00:18:21,460 --> 00:18:26,720 So I started going down these paths, and I checked out open a malicious file. 266 00:18:27,100 --> 00:18:34,060 So I broke apart some of the file extensions associated with this, and looked at the structure. 267 00:18:34,140 --> 00:18:39,140 I was replacing paths with UNC paths to see if I could force it to reach out to a remote server. 268 00:18:39,140 --> 00:18:43,460 I found that you could include settings for a project in a file. 269 00:18:43,460 --> 00:18:47,680 That was kind of interesting, but couldn't really do anything malicious with it at the time. 270 00:18:48,000 --> 00:18:50,240 I noticed that there was lots of XML. 271 00:18:50,400 --> 00:18:55,240 So I started spraying around various XXE payloads in there, and seeing if they would trigger. 272 00:18:55,260 --> 00:18:56,240 No luck. 273 00:18:56,260 --> 00:18:59,280 Symbolic links, I was kind of playing around with those. 274 00:19:00,060 --> 00:19:01,880 And nothing's really working. 275 00:19:02,100 --> 00:19:05,720 Kind of meh, feeling kind of insufficient at this point to look at this target. 276 00:19:05,720 --> 00:19:08,980 So I move along to the next attack factor. 277 00:19:09,360 --> 00:19:11,500 So that was connect to a malicious server. 278 00:19:11,500 --> 00:19:13,140 So what do I mean by that? 279 00:19:13,140 --> 00:19:18,200 This software had the ability to connect to remote version control servers. 280 00:19:18,220 --> 00:19:24,140 So that you could store your code that you were developing in a remote version control. 281 00:19:24,440 --> 00:19:28,760 And there were multiple types, and Perforce was one of those types. 282 00:19:28,780 --> 00:19:32,560 And that was something that I hadn't really heard of before. 283 00:19:32,560 --> 00: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. 284 00:19:45,060 --> 00:19:47,880 And so I kind of went down this route. 285 00:19:48,540 --> 00:19:52,300 So I started looking up the Perforce protocol spec. 286 00:19:52,360 --> 00:19:55,940 And I found this awesome article that told me about that. 287 00:19:55,940 --> 00: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. 288 00:20:03,440 --> 00: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. 289 00:20:12,940 --> 00:20:16,240 And then I realized, oh shit, he's going to find that same bug. 290 00:20:16,340 --> 00:20:19,640 And we did have a bug collision, but it still worked out great. 291 00:20:20,000 --> 00:20:21,700 So anyway, I clicked on this article. 292 00:20:21,940 --> 00:20:26,560 And it was a really great article describing how this protocol works. 293 00:20:26,720 --> 00:20:29,120 It broke down the RPC structure. 294 00:20:29,120 --> 00:20:32,700 It's a binary protocol, which I was a little bit uncomfortable with as a web guy. 295 00:20:32,840 --> 00:20:35,360 But I decided to try to continue working on it. 296 00:20:35,420 --> 00: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. 297 00:20:42,340 --> 00:20:45,180 Now if you read that for a second, you'll see something a little bit odd. 298 00:20:45,980 --> 00:20:50,680 The server says, client open file, client write file. 299 00:20:51,420 --> 00:20:54,760 And I was like, hmm, that seems odd. 300 00:20:54,840 --> 00:20:57,240 That the server can just say, write files. 301 00:20:57,240 --> 00:20:58,900 But it is a version control system. 302 00:20:58,900 --> 00:21:02,400 I wonder if there's any path traversals or something nasty that I can do with that. 303 00:21:03,460 --> 00:21:08,480 So on a hunch, I started developing this malicious Perforce server. 304 00:21:08,900 --> 00:21:11,860 And this was, I'm not going to lie to you guys, this was really intimidating to me. 305 00:21:11,860 --> 00:21:13,740 Because I'm a web guy, like I said. 306 00:21:13,740 --> 00:21:15,740 And I don't really deal a lot with binary protocols. 307 00:21:15,740 --> 00:21:19,100 But I thought, now is probably the best chance I'll ever get. 308 00:21:19,100 --> 00:21:23,220 Because this article literally breaks everything out as clean as can possibly be. 309 00:21:23,280 --> 00:21:25,240 So I decided to go down that path. 310 00:21:25,240 --> 00:21:27,940 And in the end, the code was actually really simple. 311 00:21:28,040 --> 00:21:32,220 I just created a function that would pass in a JSON blob. 312 00:21:32,220 --> 00:21:37,120 And those names and values would then be encoded into the binary format that was described in the article. 313 00:21:37,120 --> 00:21:45,340 Which was essentially the parameter name, a null byte, the value length, and then the actual value itself. 314 00:21:45,340 --> 00:21:46,300 And then a null byte. 315 00:21:46,300 --> 00:21:53,340 And then that would be sort of packed into a bigger sort of call that would pass through the socket. 316 00:21:53,340 --> 00:22:01,320 So, man, working with struct.pack was really scary to me. 317 00:22:01,320 --> 00:22:07,320 Whenever I saw those exploits where it's like, alright, less than, and B, and I, and H. 318 00:22:07,680 --> 00:22:10,340 I was thinking like, wow, this is really complicated. 319 00:22:10,360 --> 00:22:14,040 But, one, ChatGPT is really helpful for that nowadays. 320 00:22:14,660 --> 00:22:19,320 And two, you just kind of put your head down and keep working at it. 321 00:22:19,320 --> 00:22:21,000 I think it comes pretty quickly. 322 00:22:21,600 --> 00:22:23,800 So, I was able to build the whole exploit. 323 00:22:23,800 --> 00:22:26,740 And essentially, this is a funny part that I wanted to highlight for you guys. 324 00:22:27,340 --> 00:22:30,400 When the client connects, of course, it's going to try to auth, right? 325 00:22:30,400 --> 00:22:33,740 And my server was just like, yes, yes, you've authed correctly. 326 00:22:33,740 --> 00:22:34,600 Let's go. 327 00:22:34,660 --> 00:22:36,480 And just ignored the whole auth part. 328 00:22:36,780 --> 00:22:37,880 Which was really funny. 329 00:22:37,880 --> 00:22:39,520 And then just said, write a file. 330 00:22:39,720 --> 00:22:44,840 And essentially what it would do is write a file to anywhere on the file system via path traversal. 331 00:22:45,140 --> 00:22:48,280 And so, how do we convert that to RCE? 332 00:22:48,280 --> 00:22:49,660 Well, it was really easy. 333 00:22:49,660 --> 00:22:53,020 There was an exe file that was getting run every two seconds. 334 00:22:53,020 --> 00: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. 335 00:23:02,840 --> 00:23:07,340 And, yeah, how do we actually make this a plausible attack? 336 00:23:07,340 --> 00:23:13,460 Well, as I mentioned earlier, there was the ability to include malicious settings for the project. 337 00:23:13,460 --> 00: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. 338 00:23:23,760 --> 00:23:26,700 And when it opened the file, it would automatically connect to that server. 339 00:23:26,700 --> 00:23:28,680 So, I could provide a victim with a file. 340 00:23:29,020 --> 00:23:30,940 They'd open it, connect to my server. 341 00:23:30,940 --> 00:23:34,360 My server would push a file down and shell the device. 342 00:23:34,840 --> 00:23:37,260 So, that was an RCE via malicious file. 343 00:23:37,820 --> 00:23:40,460 And the bounty for that was 15 to 30k. 344 00:23:40,700 --> 00:23:42,780 Critical, critical, critical, of course. 345 00:23:42,780 --> 00:23:45,060 And that was, again, on a public program. 346 00:23:45,140 --> 00:23:45,980 Takeaways from this. 347 00:23:45,980 --> 00:23:47,100 Read the freaking docs. 348 00:23:47,100 --> 00:23:48,000 It really helps. 349 00:23:48,000 --> 00:23:48,980 And articles. 350 00:23:49,260 --> 00:23:51,380 Don't shy away from targets you're scared of. 351 00:23:51,380 --> 00:23:59,640 And use your super amazing hacker brain for any struct pack calls or chat GPT, whichever you're more comfortable with. 352 00:24:00,200 --> 00:24:00,580 Okay. 353 00:24:00,580 --> 00:24:03,880 Joel, I've got some Easter eggs for you in this one, man. 354 00:24:03,880 --> 00:24:05,160 You're going to like this, okay? 355 00:24:05,160 --> 00:24:09,460 So, the next bug that I wanted to talk about was shelling a public program router. 356 00:24:10,500 --> 00:24:14,680 Once again, I wasn't super familiar with IoT devices before this. 357 00:24:14,740 --> 00:24:20,980 And so, I leaned heavily on my boy Joel Margolis, my podcast co-host here. 358 00:24:20,980 --> 00:24:25,800 And as cute as we are together there in that picture, we are both independently married. 359 00:24:26,080 --> 00:24:27,680 Although, that would be great. 360 00:24:30,780 --> 00:24:34,920 So, let's get to the details, okay, guys? 361 00:24:35,820 --> 00:24:39,240 Essentially, what we did is we took this router that was in a public program. 362 00:24:39,240 --> 00:24:40,280 We broke it apart. 363 00:24:40,660 --> 00: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. 364 00:24:53,700 --> 00:24:54,700 This is coming out of Joel's mouth. 365 00:24:54,700 --> 00:24:56,560 And I was like, oh my gosh, what the heck is that? 366 00:24:56,560 --> 00:24:59,080 Well, it's a lot easier than you would think. 367 00:24:59,080 --> 00:25:00,140 It's a ball grid array. 368 00:25:00,140 --> 00:25:06,220 Those are those little pieces of silver pieces there, the little pieces of solder, the connections. 369 00:25:06,220 --> 00: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. 370 00:25:15,580 --> 00:25:16,820 So, that was really cool. 371 00:25:16,860 --> 00:25:18,900 So, we wanted to get that chip off. 372 00:25:19,120 --> 00:25:22,680 So , and for some reason, Joel let me do it. 373 00:25:22,680 --> 00:25:25,660 So, what we did was we get a hot air. 374 00:25:25,660 --> 00:25:27,540 I ordered a bunch of stuff on Amazon. 375 00:25:27,540 --> 00:25:30,180 I got the hot air rework station and lots of flux. 376 00:25:30,180 --> 00:25:36,140 And I sat down on the device and started blasting it with 500 degrees Fahrenheit air. 377 00:25:36,140 --> 00:25:38,100 And Joel was like, don't do that, bro. 378 00:25:38,180 --> 00:25:45,120 And then I proceeded to pull the EMMC chip off before the solder was completely liquid. 379 00:25:45,120 --> 00:25:46,440 And Joel was like, don't do that. 380 00:25:46,440 --> 00:25:47,940 And just give it some time. 381 00:25:47,940 --> 00: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. 382 00:26:00,180 --> 00:26:04,200 Here's Joel's super awesome hardware hacking setup, by the way, which I'm jealous of. 383 00:26:05,520 --> 00:26:06,840 Yeah, bricked three of them. 384 00:26:06,840 --> 00:26:07,680 Not a great feeling. 385 00:26:07,680 --> 00:26:09,700 But the company paid for it, so that was great. 386 00:26:10,120 --> 00:26:13,040 So, now we've got the firmware so we can start hunting reliably. 387 00:26:13,220 --> 00:26:15,080 And it's time to shell that. 388 00:26:15,200 --> 00:26:18,980 So, what we did then, we were hoping it was going to be a lot easier than it was. 389 00:26:18,980 --> 00: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. 390 00:26:27,280 --> 00: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. 391 00:26:39,740 --> 00: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. 392 00:26:49,960 --> 00: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. 393 00:27:00,320 --> 00:27:02,440 So, we spent a couple days continuing to look. 394 00:27:02,940 --> 00:27:09,140 Then, finally, we came across this specific piece of functionality, which is write reservations. 395 00:27:09,440 --> 00:27:14,920 And as you can see in there, there's a Jinja2 template being referenced, right? 396 00:27:14,920 --> 00:27:18,360 So, everyone's probably thinking template injection, but it's not. 397 00:27:18,360 --> 00:27:19,860 They're using it correctly. 398 00:27:19,900 --> 00:27:28,620 What it is, however, is configuration file injection, which is a much rarer and, I think, totally underrated vulnerability class. 399 00:27:29,840 --> 00:27:31,540 And it kind of looks like this. 400 00:27:31,540 --> 00:27:35,620 This functionality would... what was this functionality doing? 401 00:27:35,620 --> 00:27:39,500 Yeah, it was writing static IP reservations for the router, right? 402 00:27:39,500 --> 00: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. 403 00:27:48,320 --> 00:27:53,760 However, it wasn't escaping the characters that would allow us to write other DHCPD commands. 404 00:27:53,760 --> 00:28:02,480 So, we were able to identify a command that would run a shell command when a new DHCP lease was issued. 405 00:28:02,480 --> 00:28:07,780 And we were able to code golf it so that it keeps the correct syntax and doesn't break anything. 406 00:28:08,380 --> 00: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. 407 00:28:17,760 --> 00:28:20,760 Which is one of my favorite moments I've ever had hacking. 408 00:28:20,840 --> 00:28:24,140 Joel knows that I, like, jumped up and screamed, and it was amazing. 409 00:28:24,220 --> 00:28:28,220 So, that one was 20 to 32K, once again, on a public program. 410 00:28:28,380 --> 00:28:30,220 And I'm pretty proud of this fact. 411 00:28:30,220 --> 00:28:36,240 It took us, like, from zero, from knowing nothing about this target, about 10 days to get that shell. 412 00:28:36,240 --> 00:28:40,260 And so, I think, and I thought it was going to be a lot harder than that. 413 00:28:40,300 --> 00:28:44,260 So, don't shy away from these sort of things if you're intimidated by it like I was. 414 00:28:44,780 --> 00:28:49,400 Takeaways from this one is hack with a collaborator, or Joel Margolis, one of those two. 415 00:28:49,800 --> 00:28:53,500 Don't be afraid of hacking different types of scope. 416 00:28:53,780 --> 00:28:56,880 Get your hands on source code as much as you possibly can. 417 00:28:57,340 --> 00:29:03,500 And, obviously, configuration file injection is a pretty underrated vuln class, I think, especially in the IoT world. 418 00:29:03,500 --> 00:29:06,880 Okay, we're just going to do it again, real quick. 419 00:29:06,980 --> 00:29:08,800 And then we'll move on to the next one. 420 00:29:08,940 --> 00:29:11,260 This one was really interesting, though, so I wanted to include it. 421 00:29:11,260 --> 00:29:16,260 Another vulnerable endpoint on that same target was doing the same thing for DNS mask. 422 00:29:16,360 --> 00:29:19,000 So, we're like, okay, let's see if we can do the same thing there. 423 00:29:19,020 --> 00:29:25,280 So, of course, we Google, how to execute code with DNS mask config, and nothing comes up. 424 00:29:25,300 --> 00:29:27,280 Unfortunately, there's not a great way to do that. 425 00:29:27,300 --> 00:29:32,960 However, what every good DNS caching software needs is a built-in TFTP server. 426 00:29:33,860 --> 00:29:34,740 Yeah. 427 00:29:34,880 --> 00:29:39,420 Uh, so, essentially, that can be turned on via a DHTPD configuration. 428 00:29:39,540 --> 00:29:45,280 Uh, and you are able, then you will just be able to have FTP on the whole file system. 429 00:29:45,280 --> 00:29:48,440 And we're able to grab another file that can have a lot of impact. 430 00:29:48,440 --> 00:29:53,400 The problem was, is that we had double injection points this time around in the template, okay? 431 00:29:53,600 --> 00:29:56,360 And we really got stuck here for a long time. 432 00:29:56,360 --> 00:30:06,780 Because the user root directive, which is required to open up this TFTP server, cannot be duplicated twice. 433 00:30:06,780 --> 00:30:07,740 Just that one directive. 434 00:30:07,740 --> 00:30:10,540 Everything else can be duplicated, but the user root cannot. 435 00:30:11,780 --> 00:30:17,120 And so, because of the double injection points, we were having a really hard time with that. 436 00:30:17,120 --> 00:30:26,040 So, the solution, of course, is to reach out to Sam Erb, a Googler and double-time black badge guy. 437 00:30:26,080 --> 00:30:28,480 And say, hey, we've got this problem. 438 00:30:28,480 --> 00:30:29,320 And what does Sam do? 439 00:30:29,320 --> 00:30:35,320 Of course, he just opens up the C code for DNS Mask and starts reviewing how lines are getting parsed. 440 00:30:35,340 --> 00:30:39,760 Um, which is very Sam Erb of him to do. 441 00:30:39,760 --> 00: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. 442 00:30:46,580 --> 00:30:49,000 And that's 1025. 443 00:30:49,060 --> 00: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. 444 00:31:02,660 --> 00:31:04,800 Um, that's the code that's vulnerable. 445 00:31:04,960 --> 00:31:07,720 It's not really vulnerable, it's just useful in this scenario. 446 00:31:07,880 --> 00: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. 447 00:31:14,800 --> 00:31:24,820 So, uh, on the shorter line, we created a, um, an injection that would not exceed the 1025 byte limit. 448 00:31:24,980 --> 00: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. 449 00:31:33,640 --> 00:31:36,980 And then on the longer injection, let me see if I can show you. 450 00:31:36,980 --> 00: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. 451 00:31:46,380 --> 00:31:49,620 Uh, that would be read, uh, when parsing the config file. 452 00:31:49,620 --> 00: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. 453 00:31:59,660 --> 00:32:02,000 Um, so this is what the exploit looked like at the end. 454 00:32:02,000 --> 00: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. 455 00:32:10,620 --> 00: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. 456 00:32:18,480 --> 00:32:24,480 And then user root gets dropped down into the next line, and, uh, gets parsed, uh, and executed. 457 00:32:24,480 --> 00: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. 458 00:32:35,580 --> 00:32:36,720 That was another one. 459 00:32:36,720 --> 00:32:38,020 Uh, same program. 460 00:32:38,140 --> 00:32:41,000 Uh, I think maybe this was a little bit after the 10 days. 461 00:32:41,000 --> 00:32:44,340 It might have been 11 days or 12 days, but we found it pretty quickly afterwards. 462 00:32:45,700 --> 00:32:48,920 Uh, takeaway for this one is if it works, do it again. 463 00:32:48,920 --> 00: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. 464 00:32:59,740 --> 00:33:02,380 So definitely do your due diligence and go down that route. 465 00:33:03,260 --> 00:33:06,620 Okay, we're gonna do another one really quick, but I'm gonna get a drink of water first. 466 00:33:10,940 --> 00:33:12,400 Okay, bug number 9. 467 00:33:12,640 --> 00:33:13,540 We're doing really good. 468 00:33:13,540 --> 00:33:15,400 Actually, I'm moving a little fast. 469 00:33:15,700 --> 00:33:18,260 I may not use my full, uh, my full time block. 470 00:33:19,940 --> 00:33:21,160 Um, okay. 471 00:33:21,160 --> 00:33:24,460 So we, this time we've got a version control binary SQL injection. 472 00:33:24,460 --> 00:33:27,720 And I'm gonna make this one a little bit shorter because it's, it's kind of complicated. 473 00:33:28,120 --> 00: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. 474 00:33:35,800 --> 00:33:40,080 And then I get a bunch of errors relating to Microsoft and CLR and dot net. 475 00:33:40,380 --> 00:33:44,320 So I loaded up into dot peak and we were able to get the source code out. 476 00:33:44,320 --> 00:33:51,140 Uh, which was great because apparently you can, uh, like decompile those binaries and you get some really clean source code. 477 00:33:51,240 --> 00: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. 478 00:33:59,940 --> 00:34:01,820 And that file could have a malicious name. 479 00:34:02,100 --> 00:34:04,840 Um, and then it would be stored in the version control environment. 480 00:34:04,840 --> 00: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. 481 00:34:15,800 --> 00: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. 482 00:34:29,120 --> 00:34:32,360 This was found in collaboration with an amazing hacker named Odiotuk. 483 00:34:32,360 --> 00:34:35,360 And he reads C sharp code to fall asleep at night. 484 00:34:35,360 --> 00:34:38,980 So he was the original one who found this, uh, this sink. 485 00:34:38,980 --> 00: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. 486 00:34:48,180 --> 00: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. 487 00:35:01,740 --> 00:35:06,500 And then recheck that file back into version control, which would push it back up to the web app. 488 00:35:06,500 --> 00:35:10,960 And then we could download and get ATO on that victim's web version control account. 489 00:35:11,480 --> 00:35:13,860 Um, and so that one, that was the end of the vuln. 490 00:35:13,860 --> 00:35:14,940 That was where we chained it to. 491 00:35:14,940 --> 00:35:16,500 That one was 30, 40K. 492 00:35:16,660 --> 00:35:20,820 And once again, wanted to reiterate, definitely hack with other hackers. 493 00:35:20,820 --> 00:35:24,640 It really expands your, your knowledge, especially in areas where you're uncomfortable. 494 00:35:24,940 --> 00:35:29,180 Um, I have to admit, I, I kind of underestimated SQLite. 495 00:35:29,180 --> 00: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. 496 00:35:34,780 --> 00:35:36,380 Um, they're just a little bit deeper. 497 00:35:36,480 --> 00:35:38,420 And sometimes they're not even just a little bit deeper. 498 00:35:38,420 --> 00:35:39,620 They're, they're out there. 499 00:35:40,020 --> 00: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. 500 00:35:46,960 --> 00:35:48,500 Um, so definitely check that out. 501 00:35:48,680 --> 00: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. 502 00:36:01,900 --> 00:36:02,420 Yeah. 503 00:36:02,420 --> 00:36:04,180 And maybe don't roll your own version control. 504 00:36:04,180 --> 00:36:05,420 That's a nice takeaway as well. 505 00:36:05,720 --> 00:36:07,280 That never seems to end well. 506 00:36:07,900 --> 00:36:08,700 Okay. 507 00:36:08,700 --> 00:36:12,920 Now we are on to, uh, the very hard, uh, exploits. 508 00:36:12,920 --> 00:36:14,460 So buckle up. 509 00:36:14,460 --> 00:36:16,100 This one's going to take a hot second. 510 00:36:16,260 --> 00:36:17,860 I'm going to get water again. 511 00:36:23,670 --> 00:36:24,390 Okay. 512 00:36:24,390 --> 00:36:28,910 Target for this one was an in-home tabletop IOT device with camera and microphone. 513 00:36:28,910 --> 00:36:30,190 There's a couple out there. 514 00:36:30,190 --> 00: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. 515 00:36:36,230 --> 00: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. 516 00:36:47,670 --> 00: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. 517 00:36:57,070 --> 00:37:01,650 Uh, and so I started going after that path and I started ideating on what the possibilities for this were. 518 00:37:01,650 --> 00:37:02,910 Here are a couple. 519 00:37:02,910 --> 00:37:04,790 We could get a no interaction shell on the device. 520 00:37:04,790 --> 00:37:06,310 That would be really challenging. 521 00:37:06,510 --> 00: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. 522 00:37:14,090 --> 00:37:18,090 We could bypass auth specifically for the cam and mic related endpoints. 523 00:37:18,090 --> 00:37:22,710 We could compromise storage for video and audio feeds and maybe get access that way. 524 00:37:22,710 --> 00: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. 525 00:37:32,810 --> 00:37:34,450 So which one are we feeling guys? 526 00:37:34,450 --> 00:37:36,170 Raise your hands, put them up. 527 00:37:36,170 --> 00:37:40,050 I'm going to give a critical thinking t-shirt to anybody who gets it right. 528 00:37:43,150 --> 00:37:46,750 It was number three and the first person I see with number three is this guy right here. 529 00:37:46,750 --> 00:37:48,130 So I'll get you a t-shirt right after. 530 00:37:48,130 --> 00:37:49,070 Come up and get it. 531 00:37:49,070 --> 00:37:53,210 So it was bypass auth specifically for the cam and mic related endpoints. 532 00:37:53,210 --> 00:37:56,390 That's how we got it, so let's go ahead and go down that path. 533 00:37:57,130 --> 00:38:00,350 Okay, this IoT device has a Android app. 534 00:38:00,350 --> 00:38:05,930 And you can use that Android app, um, to video chat with this tabletop device, okay? 535 00:38:06,230 --> 00: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? 536 00:38:16,330 --> 00:38:23,090 So I thought that was really sus and was a prime feature for accomplishing the goal that I mentioned before. 537 00:38:24,030 --> 00: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. 538 00:38:30,710 --> 00:38:33,230 And then the never ending story began, okay? 539 00:38:33,230 --> 00:38:36,170 So this app was kind of locked down. 540 00:38:36,270 --> 00:38:41,810 So the first thing was it had root detection and there was some weird stuff with Google Play. 541 00:38:41,810 --> 00:38:48,610 So essentially what I had to do was patch the APK to run Frida and I did that with objection. 542 00:38:48,770 --> 00: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. 543 00:38:56,750 --> 00:39:00,850 And then, and there was some emulator detection as well in there. 544 00:39:01,430 --> 00:39:06,810 And so then the next one was bypassing TLS, pinning for HTTP. 545 00:39:06,810 --> 00:39:09,510 Of course they had that in place, most apps do nowadays. 546 00:39:09,510 --> 00:39:15,950 And so I had to come up and they had, unfortunately, a custom SIRT pinning solution. 547 00:39:15,950 --> 00: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. 548 00:39:26,150 --> 00: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. 549 00:39:33,030 --> 00:39:38,350 And overwrite those functions with the JavaScript in the Frida code. 550 00:39:38,350 --> 00:39:39,970 I'm gonna check my time really quickly. 551 00:39:40,190 --> 00:39:42,310 Nope, my phone died, so I'm not. 552 00:39:43,530 --> 00:39:44,470 What you got? 553 00:39:45,270 --> 00:39:46,750 536, alright, thanks guys. 554 00:39:46,750 --> 00:39:51,250 I was running my hotspot off of it for the last workshop and then I looked down and it was dead. 555 00:39:51,470 --> 00:39:57,930 Okay, so at that point, cool, we bypassed SIRT pinning and we've got HTTP introspection. 556 00:39:58,030 --> 00:39:58,770 Great. 557 00:39:58,770 --> 00:40:01,190 Now let's see how this whole calling thing works, right? 558 00:40:01,550 --> 00:40:04,810 Nope, because the calling thing is behind SIP. 559 00:40:04,810 --> 00:40:10,590 And more specifically SIPs, which is the secure version of the SIP protocol. 560 00:40:10,590 --> 00:40:11,370 Okay, what is SIP? 561 00:40:11,370 --> 00:40:12,470 Well, let me tell you. 562 00:40:12,950 --> 00: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. 563 00:40:23,870 --> 00:40:26,750 SIP is widely used for voice and video calls. 564 00:40:27,090 --> 00:40:27,770 Great. 565 00:40:27,770 --> 00:40:29,890 Now I've got to deal with another protocol. 566 00:40:29,890 --> 00:40:34,570 And it is also TLS-wrapped, so a bunch of stuff going on there. 567 00:40:35,070 --> 00: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. 568 00:40:42,790 --> 00: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. 569 00:40:52,130 --> 00:40:56,450 So what I realized I needed is... and this is kind of how it looks right there. 570 00:40:56,450 --> 00: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. 571 00:41:03,650 --> 00:41:06,230 But then it will just break the response. 572 00:41:06,870 --> 00:41:09,850 So I had to find a transparent proxy. 573 00:41:10,090 --> 00:41:11,970 And for this I used PolarProxy. 574 00:41:11,970 --> 00:41:16,090 It is a transparent TLS and SSL inspection proxy. 575 00:41:16,090 --> 00: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. 576 00:41:22,730 --> 00:41:28,690 And then I proxied all the stuff through PolarProxy and that would output a PCAP file. 577 00:41:29,090 --> 00: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. 578 00:41:37,350 --> 00:41:43,370 We are probably a week or two into looking at this target at this point. 579 00:41:43,370 --> 00:41:48,610 With no leads, no potential loans, no gadgets, nothing. 580 00:41:48,610 --> 00:41:50,490 Just setup at this point. 581 00:41:50,490 --> 00: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. 582 00:41:57,930 --> 00: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. 583 00:42:06,210 --> 00:42:07,330 Which is really tricky. 584 00:42:07,510 --> 00:42:13,110 That's something from a bug bounty perspective that the programs really need to help and minimize as much as possible. 585 00:42:13,110 --> 00: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. 586 00:42:23,030 --> 00:42:25,450 Okay, so now we finally get to see how all this works. 587 00:42:25,490 --> 00:42:27,470 So let's talk through that flow a little bit. 588 00:42:27,470 --> 00:42:31,710 So step one is, let's talk about getting a call, receiving a call. 589 00:42:31,710 --> 00:42:37,830 So you open up the app and it right away does a call to slash API slash get SIP auth token. 590 00:42:37,830 --> 00:42:40,970 With your auth token associated with your account. 591 00:42:41,250 --> 00:42:44,310 And then it will return a token that sort of looks like this. 592 00:42:44,310 --> 00:42:49,750 It's sort of like a JWT but it's not actually Base64 encoded. 593 00:42:49,750 --> 00:42:52,630 And it has these various delimiters in them. 594 00:42:52,630 --> 00:42:55,770 The ones that's most interesting to us is the payload delimiter. 595 00:42:55,770 --> 00:43:04,070 And in that payload delimiter there is a from field and a to field and a bunch of other fields. 596 00:43:04,070 --> 00:43:06,890 But the ones that are most interesting are the from and to fields. 597 00:43:08,010 --> 00:43:12,510 So then what would happen then is they would take that auth token that they got from the API request. 598 00:43:12,510 --> 00:43:16,470 They would put that as a header in SIP protocol which is very similar to HTTP in a lot of ways. 599 00:43:16,470 --> 00:43:18,470 The concepts are very similar. 600 00:43:18,570 --> 00:43:20,830 There's headers and stuff like that and they look similar. 601 00:43:20,830 --> 00:43:27,850 And then it would put that auth token into the request with its own SIP level from to and contact headers. 602 00:43:27,890 --> 00:43:35,870 And that would essentially allow you to register the address of record that is in the to header. 603 00:43:37,310 --> 00: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. 604 00:43:46,010 --> 00:43:51,730 And then somehow through black magic when somebody calls your phone will ring. 605 00:43:51,730 --> 00:43:52,410 It's kind of nut. 606 00:43:52,410 --> 00:43:56,010 I don't know how all that transport stuff happens in the background. 607 00:43:56,650 --> 00:44:00,370 But I thought that was interesting so I went ahead and moved along. 608 00:44:00,370 --> 00:44:02,630 And so now let's look at making a call. 609 00:44:02,630 --> 00:44:04,590 So say we want to call somebody else. 610 00:44:04,590 --> 00:44:09,610 So we go ahead and send a request to slash API slash init call auth. 611 00:44:09,610 --> 00:44:14,430 And we provide as a post parameter to that a target. 612 00:44:14,430 --> 00:44:22,570 And this target will be reflected in the payload in the from field. 613 00:44:22,570 --> 00:44:24,930 Or I'm sorry the to field because we're making a call. 614 00:44:25,890 --> 00:44:27,190 And that was great. 615 00:44:27,190 --> 00: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. 616 00:44:37,770 --> 00:44:42,710 And then somehow through black magic the other person's device starts ringing. 617 00:44:42,710 --> 00: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. 618 00:44:49,410 --> 00:44:50,050 Okay. 619 00:44:50,050 --> 00: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. 620 00:44:58,170 --> 00:44:58,790 Right? 621 00:44:59,330 --> 00:45:03,930 So let's talk a little bit about how we could fake a call. 622 00:45:03,930 --> 00: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. 623 00:45:13,730 --> 00: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. 624 00:45:19,510 --> 00: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. 625 00:45:30,150 --> 00:45:31,250 Semi colon out. 626 00:45:31,430 --> 00:45:33,510 And then provide another header. 627 00:45:33,510 --> 00:45:34,070 Five minutes? 628 00:45:34,070 --> 00:45:34,630 Oh wow. 629 00:45:34,630 --> 00:45:35,630 Okay I gotta move. 630 00:45:35,630 --> 00:45:41,050 Um then provide another from header uh as uh person two. 631 00:45:41,090 --> 00: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. 632 00:45:49,910 --> 00: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. 633 00:45:58,330 --> 00: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. 634 00:46:05,470 --> 00:46:08,690 Put it into the invite uh SIP request. 635 00:46:08,770 --> 00:46:17,330 And since the from and to fields matched and the um auth token validated those two things. 636 00:46:17,330 --> 00:46:20,070 Uh the call would happen and it would auto answer. 637 00:46:20,070 --> 00:46:24,950 However there was no contact field in the auth token so that wasn't validated. 638 00:46:24,950 --> 00:46:30,390 And the contact thing is actually where the contact header is where the call gets actually routed to. 639 00:46:30,410 --> 00: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. 640 00:46:35,870 --> 00:46:38,890 Um which was nuts and I cannot believe it worked. 641 00:46:39,610 --> 00:46:44,030 Um but wait you might ask what is up with the from header there? 642 00:46:44,030 --> 00:46:44,830 Right? 643 00:46:44,870 --> 00:46:48,790 Um well the from header uh was an interesting situation. 644 00:46:48,790 --> 00: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. 645 00:46:55,330 --> 00: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? 646 00:47:04,050 --> 00:47:09,750 Well the answer to that is a shit ton of Frida or Frida uh calls. 647 00:47:09,750 --> 00:47:16,110 To overwrite and actually use the mobile client as our own you know proxy to send stuff through. 648 00:47:16,110 --> 00:47:18,310 Um which was really painful. 649 00:47:18,310 --> 00:47:24,050 And unfortunately the section that set that from header was automatically done inside of a dot so file. 650 00:47:24,050 --> 00:47:27,250 A binary file within the uh app. 651 00:47:27,610 --> 00:47:31,470 So it couldn't be hooked very easily with Frida because of the situation. 652 00:47:31,470 --> 00:47:34,270 So I was kind of lost at this point what do I do? 653 00:47:35,070 --> 00:47:38,470 And I was talking to another awesome hacker named Space Raccoon. 654 00:47:38,710 --> 00:47:43,210 And uh he advised hey man it's a you know why don't you just patch the binary? 655 00:47:43,710 --> 00:47:46,370 And I was like that's scary as hell. 656 00:47:46,370 --> 00:47:47,530 I don't know how to do that. 657 00:47:47,530 --> 00:47:51,110 And then he realized or he told me that it's just a string. 658 00:47:51,130 --> 00: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. 659 00:47:57,510 --> 00:48:00,150 So I did that in a hex editor and it worked. 660 00:48:00,150 --> 00:48:06,030 And then I was able to add another from header via the Java bindings which matched the auth token. 661 00:48:06,030 --> 00:48:11,630 And allowed me to bypass auth and peer through anybody's desktop IOT device. 662 00:48:12,290 --> 00:48:13,470 Whew okay. 663 00:48:13,550 --> 00:48:16,610 And that was a 20 to 50k bug. 664 00:48:16,830 --> 00:48:21,550 Um and takeaways for that were set a goal and go after it really hard. 665 00:48:21,550 --> 00:48:26,390 Because some of this crazy stuff that they talk about in the horror stories is really possible. 666 00:48:26,390 --> 00:48:30,830 Um and I've become a believer in that since this happened. 667 00:48:30,930 --> 00:48:33,010 Last bug is really quick. 668 00:48:33,130 --> 00:48:37,850 Um and I should be able to go through pretty quickly because it's in the same stack. 669 00:48:38,030 --> 00:48:43,790 Um this was a bug where you could hijack calls going to other people. 670 00:48:43,790 --> 00:48:49,650 And the way that you did that was using that token the call auth token. 671 00:48:49,650 --> 00:48:53,090 Um so let me uh yeah. 672 00:48:53,090 --> 00:48:56,650 So you can see here right that the register token as a reminder. 673 00:48:56,870 --> 00:49:01,370 Uh the register token where you register your name has a to and from field that match. 674 00:49:01,370 --> 00:49:05,910 The call token has a from and to field that are different from each other. 675 00:49:05,910 --> 00:49:07,810 Because you're calling somebody else right. 676 00:49:08,030 --> 00:49:11,210 Um when we look at the register SIP request that occurs. 677 00:49:11,210 --> 00:49:13,850 Um there's this caveat in the from section. 678 00:49:14,070 --> 00:49:17,990 Which essentially allows for this feature called third party registration. 679 00:49:17,990 --> 00:49:20,550 Where you are registering for somebody else. 680 00:49:20,690 --> 00:49:26,590 Now when we use the init call um HDP request to generate the token. 681 00:49:26,630 --> 00:49:32,770 Uh we can specify a different from or a different to header in that auth token right. 682 00:49:32,770 --> 00:49:34,850 Because that's the person we're calling to. 683 00:49:34,850 --> 00:49:37,990 So then we can take that token which has the same signature. 684 00:49:38,250 --> 00:49:40,690 And apply it to the register header. 685 00:49:40,690 --> 00:49:43,910 And it will have a from header that is different from the to header. 686 00:49:43,910 --> 00:49:46,830 And the to header can be any one that we specify. 687 00:49:46,830 --> 00:49:49,370 So then we could register. 688 00:49:49,370 --> 00:49:52,510 Essentially do a third party register for any other user. 689 00:49:52,630 --> 00:49:54,950 And map their address of record right. 690 00:49:54,950 --> 00:49:56,730 The thing that routes the call to them. 691 00:49:56,730 --> 00:49:59,650 To our contact location. 692 00:49:59,710 --> 00:50:02,790 Uh and then when somebody calls that user. 693 00:50:02,790 --> 00:50:04,830 Our device would start ringing. 694 00:50:05,330 --> 00:50:08,130 And that one was another 20 to 50k. 695 00:50:08,130 --> 00:50:10,610 Critical, critical, critical on a public program. 696 00:50:10,610 --> 00:50:13,390 And uh takeaways are pretty much the same. 697 00:50:13,390 --> 00:50:15,710 Uh but don't be afraid of new protocols. 698 00:50:15,710 --> 00:50:20,190 Uh and that is one of the biggest takeaways I've found in my many, many years of bug bounty. 699 00:50:20,730 --> 00:50:22,210 Alright, that was the recap. 700 00:50:22,210 --> 00:50:23,990 11 bugs, all paid as critical. 701 00:50:23,990 --> 00:50:28,370 The grand total for this was somewhere between 225 and 400k. 702 00:50:28,370 --> 00:50:29,650 For all those bugs. 703 00:50:29,990 --> 00:50:31,110 And that's it. 704 00:50:31,110 --> 00:50:32,250 Thank you guys.