start	end	text
0	2900	All righty y'all, I think we're going to go ahead and get started a little bit early.
3280	7240	Sorry for any of the people that are coming in at the last minute, but we'll go ahead and get rolling.
7460	12540	Also, I realized that I got super lucky because this is the last slot of the day.
13260	15520	So we can go a little bit long, which is exciting.
16060	19000	You guys can hear me all right on this one too, right? I kind of like to walk around a little bit.
19000	22420	Okay, so I need to point it right at it.
22420	26900	Okay, so for any of you the guys that don't know me, I'm Justin Gardner, a.k.a. Rhino Raider.
26900	33580	I'm a professional live hacking event participant, a.k.a. full-time Bug Bounty, a.k.a. no job.
33840	39500	And I hack web applications mostly, and IoT devices occasionally,
39500	43460	and sometimes mobile devices when Joel is here to help me out.
44300	48840	I'm the host of the Critical Thinking Bug Bounty podcast with my boy Joel right here as the co-host.
48860	54200	And I'm also advisor for Kaido. So check those out if you're interested.
54700	57480	All right, let's go ahead and talk about the roadmap for today's talk.
58600	62780	We're going to hit 11 bugs, and I don't have to rush, which is great.
62900	65480	I was going to give you a disclaimer that we're going to move pretty quickly.
65780	75940	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,
75940	79480	which is at the end of the event when we all sit down and we compare notes.
79480	83160	Some of the people go up on stage and present the bugs that they've found.
83160	89700	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.
89760	96880	And I'm going to walk you through each one. And I'm going to do so at as much technical depth as I can without revealing the target.
97900	102860	We have three easy bugs. We have two mediums, four hards, and two very hards.
102860	107640	So we're going to start off easy and then we're going to go go a little bit deeper after that.
107640	112880	So let's jump into it. First one is an NGINX 403 bypass to PII leak.
113360	116080	So this is on a semi-private program.
116080	126260	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,
126260	131320	which is essentially a private program that everyone knows exists and they're very public about the fact that they exist.
131320	135300	And you can easily get added to that program and paid for a bug if you have a bug.
136320	146420	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.
146440	152120	And then they've modified it to be publicly used so anybody can sign up and log into this app.
152120	155720	Right. So when they do that, of course, the threat model changes for the application.
155720	160000	Right. So I thought that was really sketchy. So I decided to look into it a little bit deeper.
160780	166420	So what I was thinking is, OK, well, when this app was intended for private use only within an organization,
166420	170040	then there was probably a lot of implicit trust between the users in the organization.
170240	177300	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.
177300	181900	Right. However, in a public application, that information may be more sensitive.
181900	186960	So I decided to look for those sort of endpoints, exploiting implicit trust and leak user data.
187700	193760	So I identified a couple of those endpoints in the sort of internal use version of the software.
193880	199060	And when I hit them on the API, I noticed that I got an NGINX 403. Right.
199060	202600	Instead of the application level 403. You can see the differences over there.
202660	209420	The NGINX 403 seems to imply that there is this sort of structure.
209420	214440	OK. So we're on the network. We send a request over the Internet to the NGINX reverse proxy.
214440	217380	That's standing in front of the backend server.
217380	222900	And then the backend server processes that request, gives the response back to NGINX, which gives the response back to the user.
222900	227060	Pretty standard NGINX structure or reverse proxy structure.
227060	234420	However, when we request the API endpoint slash API slash internal slash get all users, that's not the API endpoint.
234500	239600	That's obfuscated. It hits the reverse proxy.
239600	243120	And then the reverse proxy says not allowed. Right.
243120	249400	So I noticed the difference between those two 403 pages and I thought we should try to fuzz that a little bit.
249400	253420	So what do we do? We try get all users. We hit the 403.
253420	266140	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.
266140	267880	Right. We get a 404 there.
267880	274520	So not that whole path is slash API slash internal is not all blocked, just get all users.
274580	288840	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.
288840	293380	And it would be parsed on the backend as an S.
293380	297160	So it would match that get all users route and dump back a ton of data.
298200	302600	So the impact of that one was 4.5 million users PII leaked.
302600	304540	The bounty was between 15 and 20K.
304540	310960	I'm going to give you ranges because some of the ranges can, the actual numbers can disclose the programs.
311180	315700	The severity was critical, critical, critical, which is what we say from the critical thinking podcast.
315700	317020	Shout out to YT Cracker.
317280	320600	And this program was semi-private as mentioned before.
320600	324900	The takeaways for this one were obviously that change to threat model.
325900	328420	Identify odd and out of place 403 pages.
328420	339760	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.
339760	349120	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.
349200	351780	So I bet that would also be really helpful here.
352380	358120	So the last takeaway is know your bypass tricks, URL encoding, double URL encoding, path reversal, et cetera.
358120	359120	All right, let's move to the next one.
359120	360460	This one's really easy.
360460	364100	It's an arbitrary count takeover via docs, essentially.
364100	372620	So I open the docs, I look at these endpoints, and I notice that there is an API endpoint for slash OAuth slash token.
372620	376160	And there's an authorization header required for that.
376300	378180	And the body is really simple.
378180	380860	It's just grant type equals password.
380860	385400	And then user equals username, password equals password.
385400	386860	That's exactly what you would expect.
387300	389060	And it dumps back the access token.
389060	390240	Very, very reasonable.
391120	392120	But wait a second.
392220	393060	A password?
393060	396680	This application is a OTP login application.
397100	398000	There's no password.
398000	401620	You just put in your email, they send you a link to your email, you click on it, and you're logged in.
401780	402940	So how does that work?
402940	404400	So I started building it out.
404400	407120	And when I sent the request, I got a 401 unauthorized.
407120	415920	Of course, we need to authorize with the credentials mentioned in the doc for the authorization header.
416440	420240	So I went and I needed that.
420240	421500	So I was like, what do I do?
421500	424020	Of course, to the JS files.
424180	425940	So I search in the JS files.
425940	430920	I'm looking for the part of the UI that uses this request.
430920	436780	And I find sitting in the JS files these authorization credentials.
436780	439080	And they're obviously Base64 encoded.
439080	440440	And the values were kind of odd.
440440	444680	I can't show them to you, but they weren't random.
444680	446280	They were just a string.
446280	447900	So it was a little bit of an odd setup.
448900	455800	And so then using those authorization basic credentials, we could literally just submit any password for any user.
455800	462620	And it would accept it and dump back the authorization token, giving us access to arbitrary account takeover on this target.
462620	464280	This is a public program.
464280	466980	This is a very high-paying public program.
466980	468420	And this sort of stuff is out there.
469360	471860	So this was... thank you, thank you.
472000	478960	This was an arbitrary ATO on double-digit million accounts, 40 to 60K bounty, of course, critical.
478960	481560	And like I mentioned, public, public program.
481560	487940	So takeaways for this will be read the docs, think about the docs, and then check the JS.
488340	491000	Because there's a lot of good stuff in there.
491600	493340	All right, next, bug number three.
493340	495460	This one's very similar to the last one.
495500	500920	Essentially, you take the AuthBearer and you log into that API, that godforsaken API.
501220	510500	And there's simply a numeric IDOR in that API that literally leaks password hashes and password reset tokens.
511180	516620	And I see someone in the audience that is laughing because I think they know the target that I'm talking about.
516900	518540	So that's interesting.
518540	520760	But yeah, the password reset token is there.
520760	526480	You can just password reset the account, hit the IDOR, and then you'll be able to log into the person's account.
526480	528360	This was also 40 to 60K.
528760	534240	And the takeaway from this one that's different from the other one is just get really deep into these apps.
534760	544180	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.
545180	547400	So that's the behind the scenes.
547400	553720	I want to make sure that it's not perceived as looking too easy because there is some work that goes into it.
554440	558180	Okay, bug number four, we're moving into the medium difficulty section now.
558260	562880	This was a blind XSS via SMS to arbitrary account takeover.
563040	568480	So this was on an app that was a place where you could buy a car.
568520	576240	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?
576240	578680	So you go ahead and find a car.
578780	581380	I was interested in this DeLorean for $42 million.
582080	584580	And so I went ahead and filled it out.
584680	588560	And somebody named Christina from my local car place reached out to me and said,
588560	591600	Hey, Justin, I saw that you filled out the request for this.
592320	593960	When can we meet to see the car?
593960	594960	I was like, okay, wow.
594960	595820	How did they do that?
595820	601260	Because I had access to the dealer panel as a part of this scope and I didn't see where they did that.
601380	606180	So I said, okay, let me go ahead and log into the dealer software and get that perspective.
606180	607140	So this is what I see.
607140	612420	You can select the users that you want to view the details for on the left hand side.
612420	614480	And there's like an info and a financing tab.
614480	618480	And you can kind of inspect that lead that had come through the website.
619340	621460	And so I started reading the code on that page.
621460	624860	And there's like some super long window object that's kind of difficult to read.
624860	633980	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.
633980	636880	And there was a messages feature flag.
636880	639680	So we turned that from false to true.
639960	646160	And you can see, yeah, from false to true with this easy Kaido match and replace rule.
646680	652280	And voila, the messages tab appears in the application and we have the ability to use it.
652460	657460	So as we go into that application, we can send messages to the various leads.
657460	659320	It'll go to the phone number that they submitted.
659680	662120	And then you can interact with them.
662260	663140	Great.
663140	665600	So I sent myself a message.
665600	666880	I submitted a lead, sent myself a message.
666880	672260	And I thought, okay, wow, wouldn't it be cool if I could SMS myself an XSS payload?
672300	683860	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.
683860	693080	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.
694720	698800	So we've got blind XSS, but what can we do with it to get more impact?
699180	705640	Well, the authorization flow for this application happened in an invisible iframe right near this interface.
705920	712060	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.
712560	720860	And so what I did using the XSS is I cookie bombed that callback location so that the code wouldn't get consumed.
720860	726420	And then I stole the code out of the iframe and exfiltrated that to the attacker server.
726580	740260	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.
740260	745500	And you don't have to bypass MFA or anything like that because the session token is there.
745740	749820	Great. So now we've got, we can log in as the dealer, we've got ATO.
749820	751400	How can we get even more impact?
751400	756940	Well, that same request had three vulnerabilities in it, okay?
756940	766940	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.
766940	772320	So essentially what this means is that we can worm this XSS across all of the dealers.
772320	779260	We can send a message to every client from every dealer with an XSS payload and then proceed to hijack their accounts.
779260	786020	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.
786480	788580	So that was bad.
793020	801680	And that was an arbitrary ATO of double-digit million users, PII leak, 20 to 40K.
801680	806520	This was on a private program. However, this program will be going public soon, I'm aware.
806840	812500	And the takeaway for this is look at all the, look at the application from all perspectives, right?
812500	817180	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.
817180	823480	Make sure you're turning on all the feature flags with match and replace. That can enable features that are essential.
824020	827240	And look for alternative data input paths like SMS.
827680	831460	And then lastly, of course, chain, chain, chain to get maximum impact.
832740	836520	Okay, bug number five, snoop on other people's meetings.
836520	839400	This was a really interesting one. It's going to be a little brief.
839400	844620	But there was a target that I came across in a video chat and team collaboration app.
844620	856320	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?
856580	859700	So I started investigating how exactly that worked.
859700	864200	I read the developer's docs, the JavaScript code, the GitHub issues, everything.
864380	869940	And when I was investigating the GitHub issues, this GitHub issue popped up.
869940	874660	It says the participant list is wrong when XYZ audio device is used.
874660	876260	And I was like, huh, that's weird.
876260	881460	So the participant list didn't get updated when the user has a broken audio device.
881460	882600	Why would that be happening?
882600	889920	So I thought maybe I can make that happen and I would be able to enter meetings without people knowing I was there.
891320	894760	So how does this joining meeting work?
894760	897900	The user connects first over WebRTC.
897940	902660	Then they get all of the information like the call, comms channels, etc.
902840	910220	And then the JS code identifies an audio device that the user can use or it creates a fake audio device.
910220	915360	And then the client-side JS sends the audio connect signal to join.
916180	917280	Wait, what?
917280	919880	It sends an audio connect signal to join.
919880	926240	That little bloop that you hear when you join a meeting was the thing actually triggering the participant list update.
926240	928620	Which I really could not believe.
928640	934280	And so since this was happening on the client-side, we could just not send the signal.
934420	937360	And that's exactly what we did with this match and replace rule.
937780	946540	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.
946720	949860	And we became Snoop Dogg in that environment.
949860	951200	Okay, so let's see how it worked.
951200	953120	Here's my Snoop Dogg POC right here.
953120	955360	That's what I named it. The triagers loved it.
955820	960260	And essentially what you would do is paste in the meeting information.
960380	962240	And then you would click Snoop.
962240	967260	And it would actually exfiltrate the user's transcripts.
967260	971280	And you would not see anything in the meeting participant list.
972580	976680	So that one was a 20 to 25k bounty.
976680	979260	It was technically high, but it was paid as a critical.
979260	982340	Given the various bonuses that were occurring.
982340	983820	This was on a public program as well.
984320	985740	So takeaways from this one.
985740	991180	Reading the GitHub issues can have massive dividends, especially anything related to security or privacy.
992120	995720	Set goals for your target, like being able to Snoop on meetings.
995840	1000520	And then verify in the code base how this works, especially on the client side.
1001600	1003860	Okay, we are 15 minutes in.
1003860	1005180	Dude, we are doing good.
1005180	1006940	I may not keep you here long.
1006940	1010000	We will see though, because now things are getting a little bit trickier.
1010180	1012260	So this one is going to be a long one.
1012440	1018440	This one was a Perforce server to client RCE.
1018700	1020520	And I will explain what that is in just a second.
1020520	1024980	The target for this was a desktop application used for game development.
1025300	1028340	The problem is, I suck at hacking desktop applications.
1028340	1032540	Note that I did not add that in the list of things that I often hack in the intro slide.
1032880	1036200	So I was thinking, how can I attack this?
1036200	1039060	This is kind of a little bit outside of my comfort zone.
1039200	1043440	I can't really do privilege escalation stuff, because this doesn't really run in a privileged environment.
1043540	1046220	So I was thinking, okay, but local attacks are kind of dumb anyway.
1046400	1048560	Let me try to focus on remote attacks.
1048560	1050300	And these are some of the ideas that I came up with.
1050300	1054080	I just want to walk you through the process, so all of this doesn't seem too easy.
1054080	1057240	And you see how often we fail when attacking targets like this.
1057760	1059860	So here are some of the attack factors I came up with.
1059860	1065060	I was thinking, we could open a malicious file in the development thing, and something bad would happen.
1065060	1070480	We could connect to a malicious server with the development environment, and then something bad would happen.
1070480	1076900	We could attack the software development lifecycle, a la Lupin, a la Ronnie Carta right here.
1077060	1081720	And try to inject something into the build of this application itself.
1082080	1090120	We could take advantage of some sort of misconfiguration in the actual code itself.
1090120	1095020	Like maybe it's reaching out to an unclaimed domain, or an unclaimed S3 bucket, and inject sort of there.
1095020	1101460	Or we could take these reusable game component pieces that were being processed, and try to do something with those.
1101460	1106720	So I started going down these paths, and I checked out open a malicious file.
1107100	1114060	So I broke apart some of the file extensions associated with this, and looked at the structure.
1114140	1119140	I was replacing paths with UNC paths to see if I could force it to reach out to a remote server.
1119140	1123460	I found that you could include settings for a project in a file.
1123460	1127680	That was kind of interesting, but couldn't really do anything malicious with it at the time.
1128000	1130240	I noticed that there was lots of XML.
1130400	1135240	So I started spraying around various XXE payloads in there, and seeing if they would trigger.
1135260	1139280	No luck. Symbolic links, I was kind of playing around with those.
1140060	1141880	And nothing's really working.
1142100	1145720	Kind of meh, feeling kind of insufficient at this point to look at this target.
1145720	1148980	So I move along to the next attack factor.
1149360	1151500	So that was connect to a malicious server.
1151500	1153140	So what do I mean by that?
1153140	1158200	This software had the ability to connect to remote version control servers.
1158220	1164140	So that you could store your code that you were developing in a remote version control.
1164440	1168760	And there were multiple types, and Perforce was one of those types.
1168780	1172560	And that was something that I hadn't really heard of before.
1172560	1181600	And I know from a lot of the work of Alex Chapman and some of the other great Git version control hackers out there,
1181600	1184400	that version control can be hella sketchy.
1185060	1187880	And so I kind of went down this route.
1188540	1192300	So I started looking up the Perforce protocol spec.
1192360	1195940	And I found this awesome article that told me about that.
1195940	1199780	Funny side note that I don't have in the slides, the guy I just mentioned, Alex Chapman,
1199780	1203380	he was also working on this target at the same time.
1203440	1209320	And he actually had a public blog on how to exploit this specific protocol
1209320	1212700	that I didn't find until a little bit later.
1212940	1216240	And then I realized, oh shit, he's going to find that same bug.
1216340	1219640	And we did have a bug collision, but it still worked out great.
1220000	1221700	So anyway, I clicked on this article.
1221940	1226560	And it was a really great article describing how this protocol works.
1226720	1229120	It broke down the RPC structure.
1229120	1232700	It's a binary protocol, which I was a little bit uncomfortable with as a web guy.
1232840	1235360	But I decided to try to continue working on it.
1235420	1240840	And as I was reading through the article, I see this very convenient file synchronization flow
1240840	1242280	on the right-hand side there.
1242340	1245180	Now if you read that for a second, you'll see something a little bit odd.
1245980	1250680	The server says, client open file, client write file.
1251420	1254760	And I was like, hmm, that seems odd.
1254840	1257240	That the server can just say, write files.
1257240	1258900	But it is a version control system.
1258900	1262400	I wonder if there's any path traversals or something nasty that I can do with that.
1263460	1268480	So on a hunch, I started developing this malicious Perforce server.
1268900	1271860	And this was, I'm not going to lie to you guys, this was really intimidating to me.
1271860	1273740	Because I'm a web guy, like I said.
1273740	1275740	And I don't really deal a lot with binary protocols.
1275740	1279100	But I thought, now is probably the best chance I'll ever get.
1279100	1283220	Because this article literally breaks everything out as clean as can possibly be.
1283280	1285240	So I decided to go down that path.
1285240	1287940	And in the end, the code was actually really simple.
1288040	1292220	I just created a function that would pass in a JSON blob.
1292220	1297120	And those names and values would then be encoded into the binary format that was described in the article.
1297120	1305340	Which was essentially the parameter name, a null byte, the value length, and then the actual value itself.
1305340	1306300	And then a null byte.
1306300	1313340	And then that would be sort of packed into a bigger sort of call that would pass through the socket.
1313340	1321320	So, man, working with struct.pack was really scary to me.
1321320	1327320	Whenever I saw those exploits where it's like, alright, less than, and B, and I, and H.
1327680	1330340	I was thinking like, wow, this is really complicated.
1330360	1334040	But, one, ChatGPT is really helpful for that nowadays.
1334660	1339320	And two, you just kind of put your head down and keep working at it.
1339320	1341000	I think it comes pretty quickly.
1341600	1343800	So, I was able to build the whole exploit.
1343800	1346740	And essentially, this is a funny part that I wanted to highlight for you guys.
1347340	1350400	When the client connects, of course, it's going to try to auth, right?
1350400	1354600	And my server was just like, yes, yes, you've authed correctly. Let's go.
1354660	1356480	And just ignored the whole auth part.
1356780	1357880	Which was really funny.
1357880	1359520	And then just said, write a file.
1359720	1364840	And essentially what it would do is write a file to anywhere on the file system via path traversal.
1365140	1368280	And so, how do we convert that to RCE?
1368280	1369660	Well, it was really easy.
1369660	1373020	There was an exe file that was getting run every two seconds.
1373020	1382100	So, you just take your malicious exe file, overwrite that file, and then it gets run two seconds later and you pop a shell.
1382840	1387340	And, yeah, how do we actually make this a plausible attack?
1387340	1393460	Well, as I mentioned earlier, there was the ability to include malicious settings for the project.
1393460	1403760	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.
1403760	1406700	And when it opened the file, it would automatically connect to that server.
1406700	1408680	So, I could provide a victim with a file.
1409020	1410940	They'd open it, connect to my server.
1410940	1414360	My server would push a file down and shell the device.
1414840	1417260	So, that was an RCE via malicious file.
1417820	1420460	And the bounty for that was 15 to 30k.
1420700	1422780	Critical, critical, critical, of course.
1422780	1425060	And that was, again, on a public program.
1425140	1425980	Takeaways from this.
1425980	1427100	Read the freaking docs.
1427100	1428000	It really helps.
1428000	1428980	And articles.
1429260	1431380	Don't shy away from targets you're scared of.
1431380	1439640	And use your super amazing hacker brain for any struct pack calls or chat GPT, whichever you're more comfortable with.
1440200	1440580	Okay.
1440580	1443880	Joel, I've got some Easter eggs for you in this one, man.
1443880	1445160	You're going to like this, okay?
1445160	1449460	So, the next bug that I wanted to talk about was shelling a public program router.
1450500	1454680	Once again, I wasn't super familiar with IoT devices before this.
1454740	1460980	And so, I leaned heavily on my boy Joel Margolis, my podcast co-host here.
1460980	1465800	And as cute as we are together there in that picture, we are both independently married.
1466080	1467680	Although, that would be great.
1470780	1474920	So, let's get to the details, okay, guys?
1475820	1479240	Essentially, what we did is we took this router that was in a public program.
1479240	1480280	We broke it apart.
1480660	1488920	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,
1489040	1493700	a BGA EMMC ABC1234G74XYZ.
1493700	1494700	This is coming out of Joel's mouth.
1494700	1496560	And I was like, oh my gosh, what the heck is that?
1496560	1499080	Well, it's a lot easier than you would think.
1499080	1500140	It's a ball grid array.
1500140	1506220	Those are those little pieces of silver pieces there, the little pieces of solder, the connections.
1506220	1515260	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.
1515580	1516820	So, that was really cool.
1516860	1518900	So, we wanted to get that chip off.
1519120	1522680	So, and for some reason, Joel let me do it.
1522680	1525660	So, what we did was we get a hot air.
1525660	1527540	I ordered a bunch of stuff on Amazon.
1527540	1530180	I got the hot air rework station and lots of flux.
1530180	1536140	And I sat down on the device and started blasting it with 500 degrees Fahrenheit air.
1536140	1538100	And Joel was like, don't do that, bro.
1538180	1545120	And then I proceeded to pull the EMMC chip off before the solder was completely liquid.
1545120	1546440	And Joel was like, don't do that.
1546440	1547940	And just give it some time.
1547940	1559260	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.
1560180	1564200	Here's Joel's super awesome hardware hacking setup, by the way, which I'm jealous of.
1565520	1566840	Yeah, bricked three of them.
1566840	1567680	Not a great feeling.
1567680	1569700	But the company paid for it, so that was great.
1570120	1573040	So, now we've got the firmware so we can start hunting reliably.
1573220	1575080	And it's time to shell that.
1575200	1578980	So, what we did then, we were hoping it was going to be a lot easier than it was.
1578980	1586320	But it was several days of weeding through Python code to find the actual attack vector that we ended up getting RCU with.
1587280	1599740	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.
1599740	1609540	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.
1609960	1620320	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.
1620320	1622440	So, we spent a couple days continuing to look.
1622940	1629140	Then, finally, we came across this specific piece of functionality, which is write reservations.
1629440	1634920	And as you can see in there, there's a Jinja2 template being referenced, right?
1634920	1638360	So, everyone's probably thinking template injection, but it's not.
1638360	1639860	They're using it correctly.
1639900	1648620	What it is, however, is configuration file injection, which is a much rarer and, I think, totally underrated vulnerability class.
1649840	1651540	And it kind of looks like this.
1651540	1655620	This functionality would... what was this functionality doing?
1655620	1659500	Yeah, it was writing static IP reservations for the router, right?
1659500	1668320	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.
1668320	1673760	However, it wasn't escaping the characters that would allow us to write other DHCPD commands.
1673760	1682480	So, we were able to identify a command that would run a shell command when a new DHCP lease was issued.
1682480	1687780	And we were able to code golf it so that it keeps the correct syntax and doesn't break anything.
1688380	1697600	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.
1697760	1700760	Which is one of my favorite moments I've ever had hacking.
1700840	1704140	Joel knows that I, like, jumped up and screamed, and it was amazing.
1704220	1708220	So, that one was 20 to 32K, once again, on a public program.
1708380	1710220	And I'm pretty proud of this fact.
1710220	1716240	It took us, like, from zero, from knowing nothing about this target, about 10 days to get that shell.
1716240	1720260	And so, I think, and I thought it was going to be a lot harder than that.
1720300	1724260	So, don't shy away from these sort of things if you're intimidated by it like I was.
1724780	1729400	Takeaways from this one is hack with a collaborator, or Joel Margolis, one of those two.
1729800	1733500	Don't be afraid of hacking different types of scope.
1733780	1736880	Get your hands on source code as much as you possibly can.
1737340	1743500	And, obviously, configuration file injection is a pretty underrated vuln class, I think, especially in the IoT world.
1743500	1746880	Okay, we're just going to do it again, real quick.
1746980	1748800	And then we'll move on to the next one.
1748940	1751260	This one was really interesting, though, so I wanted to include it.
1751260	1756260	Another vulnerable endpoint on that same target was doing the same thing for DNS mask.
1756360	1759000	So, we're like, okay, let's see if we can do the same thing there.
1759020	1765280	So, of course, we Google, how to execute code with DNS mask config, and nothing comes up.
1765300	1767280	Unfortunately, there's not a great way to do that.
1767300	1772960	However, what every good DNS caching software needs is a built-in TFTP server.
1773860	1779420	Yeah. Uh, so, essentially, that can be turned on via a DHTPD configuration.
1779540	1785280	Uh, and you are able, then you will just be able to have FTP on the whole file system.
1785280	1788440	And we're able to grab another file that can have a lot of impact.
1788440	1793400	The problem was, is that we had double injection points this time around in the template, okay?
1793600	1796360	And we really got stuck here for a long time.
1796360	1806780	Because the user root directive, which is required to open up this TFTP server, cannot be duplicated twice.
1806780	1810540	Just that one directive. Everything else can be duplicated, but the user root cannot.
1811780	1817120	And so, because of the double injection points, we were having a really hard time with that.
1817120	1826040	So, the solution, of course, is to reach out to Sam Erb, a Googler and double-time black badge guy.
1826080	1828480	And say, hey, we've got this problem.
1828480	1835320	And what does Sam do? Of course, he just opens up the C code for DNS Mask and starts reviewing how lines are getting parsed.
1835340	1839760	Um, which is very Sam Erb of him to do.
1839760	1846580	Uh, and he comes back and he says, hey, there's a maximum character length on a config line for DNS Mask.
1846580	1849000	And that's 1025.
1849060	1861860	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.
1862660	1864800	Um, that's the code that's vulnerable.
1864960	1867720	It's not really vulnerable, it's just useful in this scenario.
1867880	1874800	Um, and so what we did is one of those two double injection points was, the line was much longer than the other one.
1874800	1884820	So, uh, on the shorter line, we created a, um, an injection that would not exceed the 1025 byte limit.
1884980	1893640	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.
1893640	1896980	And then on the longer injection, let me see if I can show you.
1896980	1906120	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.
1906380	1909620	Uh, that would be read, uh, when parsing the config file.
1909620	1919400	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.
1919660	1922000	Um, so this is what the exploit looked like at the end.
1922000	1930620	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.
1930620	1938480	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.
1938480	1944480	And then user root gets dropped down into the next line, and, uh, gets parsed, uh, and executed.
1944480	1954820	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.
1955580	1964340	That was another one. Uh, same program. Uh, I think maybe this was a little bit after the 10 days. It might have been 11 days or 12 days, but we found it pretty quickly afterwards.
1965700	1973900	Uh, takeaway for this one is if it works, do it again. Uh, that's one of the big principles of bug bounty, is if you find a bug in one particular area,
1973900	1982380	there's very likely to be bugs that are similar to it else, uh, in a similar, in a similar location. So definitely do your due diligence and go down that route.
1983260	1986620	Okay, we're gonna do another one really quick, but I'm gonna get a drink of water first.
1990940	1998260	Okay, bug number 9. We're doing really good. Actually, I'm moving a little fast. I may not use my full, uh, my full time block.
1999940	2007720	Um, okay. So we, this time we've got a version control binary SQL injection. And I'm gonna make this one a little bit shorter because it's, it's kind of complicated.
2008120	2015400	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.
2015800	2024320	And then I get a bunch of errors relating to Microsoft and CLR and dot net. So I loaded up into dot peak and we were able to get the source code out.
2024320	2031140	Uh, which was great because apparently you can, uh, like decompile those binaries and you get some really clean source code.
2031240	2039940	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.
2039940	2044840	And that file could have a malicious name. Um, and then it would be stored in the version control environment.
2044840	2054300	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,
2054300	2069120	SQLite database. 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.
2069120	2078980	This was found in collaboration with an amazing hacker named Odiotuk. And he reads C sharp code to fall asleep at night. So he was the original one who found this, uh, this sink.
2078980	2088180	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.
2088180	2101740	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.
2101740	2110960	And then recheck that file back into version control, which would push it back up to the web app. And then we could download and get ATO on that victim's web version control account.
2111480	2120820	Um, and so that one, that was the end of the vuln. That was where we chained it to. That one was 30, 40K. And once again, wanted to reiterate, definitely hack with other hackers.
2120820	2129180	It really expands your, your knowledge, especially in areas where you're uncomfortable. Um, I have to admit, I, I kind of underestimated SQLite.
2129180	2136380	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. Um, they're just a little bit deeper.
2136480	2146960	And sometimes they're not even just a little bit deeper. They're, they're out there. Um, .peek is super helpful for those sort of decompilation scenarios when the base language is, I think like .net or C sharp.
2146960	2160480	Um, so definitely check that out. 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.
2161900	2167280	Yeah. And maybe don't roll your own version control. That's a nice takeaway as well. That never seems to end well.
2167900	2177860	Okay. Now we are on to, uh, the very hard, uh, exploits. So buckle up. This one's going to take a hot second. I'm going to get water again.
2183670	2196230	Okay. Target for this one was an in-home tabletop IOT device with camera and microphone. There's a couple out there. 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.
2196230	2207670	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.
2207670	2216950	So I wanted to do no user interaction spying on, uh, some, in somebody's house and essentially just teleport myself into their house.
2217070	2221650	Uh, and so I started going after that path and I started ideating on what the possibilities for this were.
2221650	2226310	Here are a couple. We could get a no interaction shell on the device. That would be really challenging.
2226510	2234090	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.
2234090	2238090	We could bypass auth specifically for the cam and mic related endpoints.
2238090	2242710	We could compromise storage for video and audio feeds and maybe get access that way.
2242710	2252350	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.
2252810	2256170	So which one are we feeling guys? Raise your hands, put them up.
2256170	2260050	I'm going to give a critical thinking t-shirt to anybody who gets it right.
2263150	2266750	It was number three and the first person I see with number three is this guy right here.
2266750	2269070	So I'll get you a t-shirt right after. Come up and get it.
2269070	2273210	So it was bypass auth specifically for the cam and mic related endpoints.
2273210	2276390	That's how we got it, so let's go ahead and go down that path.
2277130	2280350	Okay, this IoT device has a Android app.
2280350	2285930	And you can use that Android app, um, to video chat with this tabletop device, okay?
2286230	2296330	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?
2296330	2303090	So I thought that was really sus and was a prime feature for accomplishing the goal that I mentioned before.
2304030	2310190	So I started, I took the mobile app and I threw it into JADX and decompiled it and got the source code.
2310710	2313230	And then the never ending story began, okay?
2313230	2316170	So this app was kind of locked down.
2316270	2321810	So the first thing was it had root detection and there was some weird stuff with Google Play.
2321810	2328610	So essentially what I had to do was patch the APK to run Frida and I did that with objection.
2328770	2336390	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.
2336750	2340850	And then, and there was some emulator detection as well in there.
2341430	2346810	And so then the next one was bypassing TLS, pinning for HTTP.
2346810	2349510	Of course they had that in place, most apps do nowadays.
2349510	2355950	And so I had to come up and they had, unfortunately, a custom SIRT pinning solution.
2355950	2366150	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.
2366150	2373030	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.
2373030	2378350	And overwrite those functions with the JavaScript in the Frida code.
2378350	2379970	I'm gonna check my time really quickly.
2380190	2382310	Nope, my phone died, so I'm not.
2383530	2384470	What you got?
2385270	2386750	536, alright, thanks guys.
2386750	2391250	I was running my hotspot off of it for the last workshop and then I looked down and it was dead.
2391470	2397930	Okay, so at that point, cool, we bypassed SIRT pinning and we've got HTTP introspection.
2398030	2398770	Great.
2398770	2401190	Now let's see how this whole calling thing works, right?
2401550	2404810	Nope, because the calling thing is behind SIP.
2404810	2410590	And more specifically SIPs, which is the secure version of the SIP protocol.
2410590	2411370	Okay, what is SIP?
2411370	2412470	Well, let me tell you.
2412950	2423390	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.
2423870	2426750	SIP is widely used for voice and video calls.
2427090	2427770	Great.
2427770	2429890	Now I've got to deal with another protocol.
2429890	2434570	And it is also TLS-wrapped, so a bunch of stuff going on there.
2435070	2442270	So I start working on that and find a custom SIRT pinning solution for SIPs and kind of am able to disable that.
2442790	2452130	But BURP, while it is SIPs-friendly, is not SIPs-compatible and will break the application if you try to proxy it.
2452130	2456450	So what I realized I needed is... and this is kind of how it looks right there.
2456450	2463650	It will issue the register request with the SIP HTTP verb, or the register HTTP verb that is associated with the SIP protocol.
2463650	2466230	But then it will just break the response.
2466870	2469850	So I had to find a transparent proxy.
2470090	2471970	And for this I used PolarProxy.
2471970	2476090	It is a transparent TLS and SSL inspection proxy.
2476090	2482650	So I took that and I took the SIRT for that and I inserted it into the trust store for that specific mobile app.
2482730	2488690	And then I proxied all the stuff through PolarProxy and that would output a PCAP file.
2489090	2497350	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.
2497350	2503370	We are probably a week or two into looking at this target at this point.
2503370	2508610	With no leads, no potential loans, no gadgets, nothing.
2508610	2510490	Just setup at this point.
2510490	2517930	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.
2517930	2526210	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.
2526210	2527330	Which is really tricky.
2527510	2533110	That's something from a bug bounty perspective that the programs really need to help and minimize as much as possible.
2533110	2541910	If you want your mobile apps and your IoT devices and your desktop applications to get as much interest as your web applications do.
2543030	2545450	Okay, so now we finally get to see how all this works.
2545490	2547470	So let's talk through that flow a little bit.
2547470	2551710	So step one is, let's talk about getting a call, receiving a call.
2551710	2557830	So you open up the app and it right away does a call to slash API slash get SIP auth token.
2557830	2560970	With your auth token associated with your account.
2561250	2564310	And then it will return a token that sort of looks like this.
2564310	2569750	It's sort of like a JWT but it's not actually Base64 encoded.
2569750	2572630	And it has these various delimiters in them.
2572630	2575770	The ones that's most interesting to us is the payload delimiter.
2575770	2584070	And in that payload delimiter there is a from field and a to field and a bunch of other fields.
2584070	2586890	But the ones that are most interesting are the from and to fields.
2588010	2592510	So then what would happen then is they would take that auth token that they got from the API request.
2592510	2596470	They would put that as a header in SIP protocol which is very similar to HTTP in a lot of ways.
2596470	2598470	The concepts are very similar.
2598570	2600830	There's headers and stuff like that and they look similar.
2600830	2607850	And then it would put that auth token into the request with its own SIP level from to and contact headers.
2607890	2615870	And that would essentially allow you to register the address of record that is in the to header.
2617310	2626010	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.
2626010	2631730	And then somehow through black magic when somebody calls your phone will ring.
2631730	2636010	It's kind of nut. I don't know how all that transport stuff happens in the background.
2636650	2640370	But I thought that was interesting so I went ahead and moved along.
2640370	2642630	And so now let's look at making a call.
2642630	2644590	So say we want to call somebody else.
2644590	2649610	So we go ahead and send a request to slash API slash init call auth.
2649610	2654430	And we provide as a post parameter to that a target.
2654430	2662570	And this target will be reflected in the payload in the from field.
2662570	2664930	Or I'm sorry the to field because we're making a call.
2665890	2667190	And that was great.
2667190	2677770	And then you use that in an invite SIP request with the from and to headers matching the values in the auth token.
2677770	2682710	And then somehow through black magic the other person's device starts ringing.
2682710	2689010	And you go through all these networks and you send the TCP data through or the UDP data depending on the flow.
2689410	2698170	Okay. 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.
2698170	2698790	Right?
2699330	2703930	So let's talk a little bit about how we could fake a call.
2703930	2713730	So in the API slash init call request or call auth request the target that we would specify was actually accepted arbitrary data.
2713730	2719510	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.
2719510	2730150	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.
2730150	2731250	Semi colon out.
2731430	2733510	And then provide another header.
2733510	2735630	Five minutes? Oh wow. Okay I gotta move.
2735630	2741050	Um then provide another from header uh as uh person two.
2741090	2749910	Um so this was this would look like the call was coming from person two the person receiving the call and to person two.
2749910	2758330	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.
2758330	2765470	So we were able to uh smuggle in that from field and uh we would generate the the token with request number one.
2765470	2768690	Put it into the invite uh SIP request.
2768770	2777330	And since the from and to fields matched and the um auth token validated those two things.
2777330	2780070	Uh the call would happen and it would auto answer.
2780070	2784950	However there was no contact field in the auth token so that wasn't validated.
2784950	2790390	And the contact thing is actually where the contact header is where the call gets actually routed to.
2790410	2795630	Um so then you could see it on your device and you would be looking through that person's uh IOT device.
2795870	2798890	Um which was nuts and I cannot believe it worked.
2799610	2804030	Um but wait you might ask what is up with the from header there?
2804030	2808790	Right? Um well the from header uh was an interesting situation.
2808790	2815150	Because uh as much as we thought we had source code there was one more challenge that awaited for us at that point.
2815330	2824050	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?
2824050	2829750	Well the answer to that is a shit ton of Frida or Frida uh calls.
2829750	2836110	To overwrite and actually use the mobile client as our own you know proxy to send stuff through.
2836110	2838310	Um which was really painful.
2838310	2844050	And unfortunately the section that set that from header was automatically done inside of a dot so file.
2844050	2847250	A binary file within the uh app.
2847610	2851470	So it couldn't be hooked very easily with Frida because of the situation.
2851470	2854270	So I was kind of lost at this point what do I do?
2855070	2858470	And I was talking to another awesome hacker named Space Raccoon.
2858710	2863210	And uh he advised hey man it's a you know why don't you just patch the binary?
2863710	2866370	And I was like that's scary as hell.
2866370	2867530	I don't know how to do that.
2867530	2871110	And then he realized or he told me that it's just a string.
2871130	2877510	So just search the binary for that string and replace the O with an A and it will automatically put in a different header.
2877510	2880150	So I did that in a hex editor and it worked.
2880150	2886030	And then I was able to add another from header via the Java bindings which matched the auth token.
2886030	2891630	And allowed me to bypass auth and peer through anybody's desktop IOT device.
2892290	2893470	Whew okay.
2893550	2896610	And that was a 20 to 50k bug.
2896830	2901550	Um and takeaways for that were set a goal and go after it really hard.
2901550	2906390	Because some of this crazy stuff that they talk about in the horror stories is really possible.
2906390	2910830	Um and I've become a believer in that since this happened.
2910930	2913010	Last bug is really quick.
2913130	2917850	Um and I should be able to go through pretty quickly because it's in the same stack.
2918030	2923790	Um this was a bug where you could hijack calls going to other people.
2923790	2929650	And the way that you did that was using that token the call auth token.
2929650	2933090	Um so let me uh yeah.
2933090	2936650	So you can see here right that the register token as a reminder.
2936870	2941370	Uh the register token where you register your name has a to and from field that match.
2941370	2945910	The call token has a from and to field that are different from each other.
2945910	2947810	Because you're calling somebody else right.
2948030	2951210	Um when we look at the register SIP request that occurs.
2951210	2953850	Um there's this caveat in the from section.
2954070	2957990	Which essentially allows for this feature called third party registration.
2957990	2960550	Where you are registering for somebody else.
2960690	2966590	Now when we use the init call um HDP request to generate the token.
2966630	2972770	Uh we can specify a different from or a different to header in that auth token right.
2972770	2974850	Because that's the person we're calling to.
2974850	2977990	So then we can take that token which has the same signature.
2978250	2980690	And apply it to the register header.
2980690	2983910	And it will have a from header that is different from the to header.
2983910	2986830	And the to header can be any one that we specify.
2986830	2989370	So then we could register.
2989370	2992510	Essentially do a third party register for any other user.
2992630	2994950	And map their address of record right.
2994950	2996730	The thing that routes the call to them.
2996730	2999650	To our contact location.
2999710	3002790	Uh and then when somebody calls that user.
3002790	3004830	Our device would start ringing.
3005330	3008130	And that one was another 20 to 50k.
3008130	3010610	Critical, critical, critical on a public program.
3010610	3013390	And uh takeaways are pretty much the same.
3013390	3015710	Uh but don't be afraid of new protocols.
3015710	3020190	Uh and that is one of the biggest takeaways I've found in my many, many years of bug bounty.
3020730	3022210	Alright, that was the recap.
3022210	3023990	11 bugs, all paid as critical.
3023990	3028370	The grand total for this was somewhere between 225 and 400k.
3028370	3029650	For all those bugs.
3029990	3032250	And that's it. Thank you guys.
