start	end	text
0	900	Hey, everyone.
900	1760	Can you hear me?
2160	2660	All right.
2660	3380	We're good to go.
3380	4960	Welcome, everyone, to DEF CON.
5560	6400	Yeah.
6880	7400	Yeah.
7400	11300	So I'm super excited to be back here at DEF CON speaking again.
11760	12860	I'm Farzan Karimi.
12860	14840	I'm an offensive security researcher.
15400	17020	And this is my talk.
17020	17460	My session.
17460	18300	Paywall optional.
18300	20240	Stream for free with a new technique.
20240	22000	Recursive request exploits.
22700	24560	Little bit of cross talk that I'm hearing.
24560	26520	Hopefully you're not hearing that too bad.
26520	30440	So anyways, this is my session.
30480	33980	Why did I choose a title focused on bypassing paywalls?
34300	38840	So the important thing here is you really have to know your audience here at DEF CON.
38840	44120	And when you say something like stream for free, you really rally all the cheapskates into one room.
44500	45380	Yeah.
45860	47440	And I mean that as a compliment.
47740	49880	Because I'm one of you.
50040	51700	And we speak the same language.
51700	53120	So thank you for being here.
53400	58160	In all seriousness, the title really understands some of the broader implications of this session.
58160	64980	So I'm going to be talking about a new technique I'm going to be releasing called RRE, short for recursive request exploits.
65040	78020	And with this technique, I was able to target a specific area of AppSec that allowed me to automate exploitation of basically a business logic of flaws that get you entitlement grant bypasses.
78020	79540	So we're going to be talking about that.
79540	81560	Two major areas of impact.
81560	87900	One, I was able to leverage this technique to target a sports streaming service to get all their content for free.
88100	95520	I also was able to target another major streaming service to access over 1,800 internal company meetings.
95540	99240	Videos for internal company all hands, global town halls, et cetera.
99260	100880	So the pattern works.
101020	103280	And I just recently discovered this.
103280	107120	So I'm still feeling like I'm just scratching the surface now.
107200	108820	So we're going to talk about all that.
108820	110460	A little background on me.
110620	118520	I've been a red team manager at a number of different organizations, such as Google, where I manage the Android red team, EA, as well as Moderna.
118600	124580	Right now, Moderna, I also manage security operations, incident response, security engineering, as well as red team.
124600	129180	So the scope expanded a little bit, and it just makes the day-to-day more fun.
129260	143920	I've been here in previous DEF CONs talking with my former Android red team on how we were able to exploit the Pixel 6, as well as attacking devices over cellular communications via a no-click over-the-air RCE that we delivered through an SMS message.
144040	145420	And I know what you're all thinking.
145600	146840	Bravo, Farzan.
147140	148260	Well done.
148300	149440	Let's get on with it.
149440	150380	Enough of your intro.
150380	151760	We just want free streaming.
152440	155620	So here's our session agenda.
155620	164320	Before we get into what RRE is, I wanted to quickly touch on this paywall problem, as well as the concept of entitlement grant bypasses.
164320	165260	So quick definition.
165260	169620	When I say entitlement, I mean any digital asset that's tied to you, the customer.
169800	172680	So that should be bound to your identity as well.
172680	174960	And that's essentially the paywall problem here.
174960	186360	So whether it's client-side scripts that you can manipulate, or cookies that you can tamper with, there's very weak authentication on applications that favor user experience over security.
186360	189840	So think of news article sites, streaming sites, et cetera.
190660	192980	So that's essentially the paywall problem.
192980	197800	Then we're going to cover a couple of other paywall bypass techniques just for comprehensive analysis.
197940	202780	So that's just four traditional bypass methods coupled with RRE.
202820	206900	So you're going to get five here, techniques to bypass paywalls in 20 minutes or less.
207400	213900	And then we're going to flow into our RRE technique, coupled that with a real world exploit targeting our sports streaming provider.
214000	219600	And we'll be releasing a tool at the end of this to help automate it for everyone here.
220440	223200	So quickly level set on the traditional bypass methods.
223200	226560	I'm not going to talk about these here because we're just going to get into it for time sake.
227000	233720	By the way, before I talk about this first method, it's pretty public knowledge you can YouTube how to do this to get around some paywalls.
233840	238720	Basically, let's say you're really interested in a news article about dancing nuns.
238720	245840	You don't want to pay the $5.99 a month or whatever the newspaper article charges you, the publisher charges you.
245840	247160	So what's a way around it?
247160	252520	And the quick way here is I'm just going to refresh this page so you can see the paywall opens up.
253760	255280	You can't see it.
257800	259380	There's nothing on the screen?
261040	265480	Has it always been a black screen?
265900	266800	Shit.
266800	267500	Okay.
273820	275040	That's great.
275640	276240	Okay.
276240	277340	Working on it.
278220	278720	Yeah.
278720	282960	It's really hard to show you demos when you don't have anything to look at.
284180	288900	So I'll just give the technical team here a minute to figure that out and we'll jump back in.
289420	290880	Just go?
291920	293100	It's all demos.
293100	294020	It's all demos.
299060	299560	Okay.
299560	300300	Well, you know what?
300400	308720	Let me see if I can go to something here that I could talk about and voice track a little bit of what I'm doing with RRE as a whole.
312940	315880	I'm trying to keep my cool, but this kind of sucks, to be honest.
318000	324780	So to understand what's being exploited with RRE, and by the way, hoot and holler if you actually see something at some point.
325760	326680	You need to think about it.
326680	328840	I think about it with this quick mental model.
329260	331860	And I call it the APSEC principle of first reference.
331860	337660	It's something cheesy I made up with, but the intent actually helps with explaining what this concept is doing.
337660	348080	So this principle talks about basically we need to identify the first point where a sensitive value in a web app is introduced upstream.
348300	349080	Okay?
349080	356020	So this is often where trust assumptions are the strongest, but actual authentication and authorization is the weakest.
356020	361420	So think of it as a chain of API calls that generate a secret, an entitlement.
361740	367560	And in that chain of API calls, there's interdependencies between them that are not obvious.
367600	372200	But if everything there is doing a good claims check or an authentication check, then that's good.
372200	376440	That's considered a high trust input at each step of the chain.
376480	388160	Now, if there's anything in that chain that talks about that basically generates a secret from metadata or an identifier or something that's not a claim, then you got some problems.
388160	402320	So that's the concept here and what the attack is basically automating is recursively going back through that API chain or the endpoint chain, whatever it is, and finding points where there could be low trust inputs that let you hijack the authentication stream,
402320	403660	if that makes sense.
403660	405180	Again, I had visuals.
405200	406500	I wish I could show them to you.
406500	408240	I promise there's stuff here.
408600	410020	But that's sort of the high level.
410020	414960	The attacker's goal here is to just recursively walk that chain, but in an automated fashion.
416460	425640	The challenge here is with modern apps and asynchronous APIs, that you don't have the ability to scale well if you do this manually.
425640	431680	It's a high-cost effort for a pen tester to do this, and automation really helps here.
432000	442660	So I'll kind of talk about this, again, sucks without the visual, but imagine a fictitious streaming site where you're searching for a video, and let's say you're looking for Fight Club.
442860	445360	And you put that in the search prompt.
445500	449140	There's a search API that returns a bunch of metadata back to you.
449320	459200	In that metadata may be information about the movies, a synopsis, a summary, et cetera, what it scored on Rotten Tomatoes, as well as metadata about the actors involved.
459200	460980	So Brad Pitt, Edward Norton.
460980	461720	Great.
461780	471780	Now you look through the entire app, again, the APIs, and see if there's something where you can fit some of that identifier info to a new API to generate something else that's interesting.
471940	484640	And let's say there's an actors API, and you pass it Brad Pitt, and now you get information about his background, also all the movies he played in, maybe some movie identifiers, TV shows and TV show identifiers, et cetera.
484640	486440	You keep searching, rinse, repeat.
486440	491340	You look for an episode API that gives you more information about the episode.
491440	494380	Maybe there's a video identifier in there tied to the episode.
494380	497580	Now you're working, again, all unauthenticated.
498040	506740	And then you get to this point in the chain where maybe that video identifier, if you find the right API, can actually fetch you a full network stream URL.
507220	509520	So that's sort of what I'm talking about visually.
509640	512980	And this is a great challenge for me to do this without a visual, again.
512980	515060	So I hope that's tracking a little bit.
515060	516220	Does that make sense?
516600	517200	Cool.
517200	517920	Awesome.
519320	529040	So if I were to define what RRE is, it is basically a methodology for recursively tracing interdependent web requests in reverse.
529040	536200	So you got to start with the secret, so you're cheating a little bit, but then you do this in reverse to then identify how you can go back unauthenticated.
536320	543300	And once you do that, you can rinse, repeat and replay and hit every video on the network streaming service for free, because you can discover them.
543480	545720	So that's what I'm doing with this technique.
546780	553700	In other words, the question I'm asking myself with this technique is, where was this parameter generated from?
553700	557180	And asking that question again and again and again and again.
557780	558580	Yes!
561000	562940	I am so happy right now.
564360	566680	Because actually I had nothing else to say.
568700	569420	You know what?
569420	582480	We're just going to continue with this flow of RRE, and if we have time, I'll go back to show some cool other exploit demos, because I had a conversation with the legal team yesterday at one of the providers I was able to exploit with this, and they said you can't go on and talk about this.
582480	588900	Within 17 hours ago, I gave them responsible disclosure months ago.
589320	594480	And so, of course, there's a little bit of, yeah, last minute attention that they're providing me.
594480	596420	So we'll save time if we can go back to that.
596420	597060	Great.
597220	597980	Here is RRE.
597980	602340	This is a manual flow of a demo of a manual flow of RRE.
602340	606540	In this version, this is version one of my tool.
606700	607360	Okay?
607360	610160	So I'm not implementing any recursion just yet.
610380	610860	Right?
610860	612480	So just to show how this works.
612480	615180	And then we're going to get into the recursive bit in the next demo.
615320	622900	So the goal here is to trace back a video stream that user legitimately accessed and see how it could be discovered by an unauthenticated attacker.
623220	626780	So I'm going to start by searching for a football game on the sports streaming service.
626780	630160	Since I'm not logged in, the video doesn't play, so that's a good sign.
630980	634960	Now I'm going to log in as a valid user and repeat that same search.
634960	636520	All right.
636520	640360	Now in BERT by CD API response includes a video stream URL.
640380	641620	That's a protected value.
641620	643100	I had to log in to get it.
643560	647660	Now test if I can replay that stream link in a media player like VLC.
648260	652260	And we can see here in just a minute, the video plays.
652460	654520	That's a great start for an attacker, right?
654520	657740	Because you've circumvented the web app at this point entirely.
657740	659400	There's no session off anymore.
660100	662840	Now I want to know where that video stream came from initially.
663180	668780	So it looks like it was returned from this V2 VODs API or video on demand API.
668820	672020	And it depends on this parameter called VOD, whatever that means.
672020	681420	So I'm going to run my extension, this RE extension manually to trace where that originally, that VOD value originally generated my entire HTTP trace, my history.
681580	686900	And it was turned out it was generated by another API call that used that VOD ID.
687040	691180	And it's generated by this call that uses GAM.
691180	692300	So what's GAM?
692300	692980	I have no idea.
692980	694360	Let's inspect that call.
694800	697020	And you don't have to really watch the video anymore.
697020	698660	Just listen to the narration.
698660	700340	Now that I've gotten better about that.
701100	708240	Really, we're just going back and doing this rinse and repeat to go back and identify the source of the call.
708240	712640	And that GAM ID map to the game I was searching for in my search prompt initially.
712640	714460	So again, all unauthenticated.
714520	719460	And I was able to leverage this technique to trace back and see what was the originating call.
719700	723080	Yes, manually, which is why I'm going to get into the next bit here.
723420	726660	So just visualizing that chain, what I was able to do in that video.
727480	729020	So I was at the very top.
729020	730940	We have our video secret.
731320	738240	And then everything else is a hop and a trace doing RRE step by step to see what API call generates the next.
738240	743460	So VOD generates the load media, the URL stream, the M3 link.
743820	747620	The GAM parameter generated the VOD call.
747620	752060	And our original call was just an unauthenticated search, right, for the event.
752060	755080	So we're just attacking metadata here, if that makes sense.
755540	757380	So what's the problem?
757380	759500	What challenge did I run using this technique?
759500	760900	I couldn't scale it.
760900	764220	Because I'm still manually clicking through API call, every API.
764380	768160	So I need to find a way to make this recurse effectively.
768400	769500	And that's a challenge, right?
769500	774300	Because, again, these are asynchronous APIs, and I don't know what API connects to what.
775020	776840	So what's the solution there?
776880	777620	Entropy.
777820	793760	So all I implemented here was an entropy check that goes back and, you know, my version 1 was looking and correctly finding the source originating API that calls the next API that calls the next API, but it had trouble finding that magic parameter that generated the next sequence,
793760	794900	if that makes sense.
795140	797920	So if you implement entropy here, I use Shannon entropy.
798940	805440	I looked it up on chat GPT, what entropy should I use, and it just said Shannon, and it sounded good to me.
805440	806520	There's no real preference here.
806520	808460	You can use any entropy check of your choice.
808500	812680	What's interesting or what's more important is I was able to also implement a threshold.
812780	830620	So you can do a sliding bar based on the app you're testing, whether you're testing an app that generates secrets from, like, GUIDs, which are highly entropic, but they're enumerable, discoverable, but they're so weak as an authentication mechanism, all the way down to,
830620	838260	like, a very low entropy parameter like actor ID or whatever, right?
838260	842900	So with that, this is the logic to show the threshold code.
842900	849620	All of this is going to be... I have less than five minutes left, so I'll just reference material for anybody that watches this later.
850220	852160	So this is the version with recursion.
852160	855660	So this shows everything works in one package, one 40-second demo.
855720	859740	What you'll see here is the sum of all the parts we demonstrated so far in this presentation.
859840	868900	Everything we did manually, we built recursion now, coupled with logic that prompts or pinpoints those candidate parameters based on these entropy checks, right?
868900	879860	So here we're going to go load a baseball game on the sports streaming service, capture the request, and this is version two of the RRE tool to run our full trace discovery.
879860	886040	So I'm going to right-click that video stream link parameter and go back and say RRE, give me the full chain.
886960	893360	And in just a couple seconds, you'll see all the results nicely and neatly populated for you right here.
893360	896460	So this is the entire grant flow for your target secret.
896680	899160	The video stream chained back to each API call.
899160	901100	You don't have to discover this anymore yourself.
901120	903020	It maps it for you.
903420	904620	Does that make sense?
904780	905200	Yeah?
905200	905940	Cool.
906200	911860	And if none of these values are required off, cool, none of these values are required off, you're cooking.
911980	921960	And this normally would be if you give a pretty decent pen tester or red teamer hours of work, maybe days of work, depending on who's testing the application.
921960	923800	We just did this in a couple seconds.
924040	925920	So that's the value of the tool.
927840	929720	So again, this is just for reference.
929720	930480	Thank you.
931940	939540	Right here is just a culmination final hurrah video that demonstrates this at scale, targeting this sports streaming service.
939540	945380	I took that API sequence from the results of my RRE chain before and pointed it to this streaming service all in one day.
945820	947680	So you're going to see a bunch of videos up here.
947680	954400	This is literally me pulling down every live stream from this sports streaming service, every highlight, over and over again.
954700	958940	What's interesting is you may see some empty stadiums and empty arenas.
958940	960240	And this is really interesting.
960240	962360	Because it's a cherry on top finding.
962780	964580	If I move to the next slide.
964640	966400	Why are there empty arenas?
968020	969360	Because... what's that?
969880	971280	Live streams.
971280	976200	Because there's this concept, and I don't know how big of a problem this is, and this is sort of new territory with live stream.
976200	978200	There could be always on live streams.
978200	982840	And they may not be advertised by the application for a specific window.
983140	988000	But if you can hit the APIs with the right parameters, you can just tap into those cameras at any time.
988480	990740	So it's a big privacy nightmare, right?
990800	993280	Depending on who the live stream provider is.
993280	1000720	And I think there's a whole area to discover here that I'm just kind of just scratching the surface for myself.
1000720	1003340	But I'm interested if anybody else dives into this as well.
1003340	1004840	Feel free to reach out.
1006300	1011360	So of course, as with any good red teamer, I've left one minute for the remediation slide.
1011360	1015240	And so I don't have to talk about it too much.
1015240	1022180	But the TLDR here is if you're doing stuff with multiple APIs, this informs good claim checks.
1022440	1024700	DRM if you're doing streaming.
1025340	1027480	Time bound session tokens.
1027540	1032360	And this whole always on live stream concept, turn off the cameras.
1032360	1033520	Unplug those cameras.
1033520	1034120	Do whatever.
1034120	1036620	Don't have always on live content.
1037260	1043560	I'm so sorry I couldn't get to the team meeting compromise, which was a whole five-minute spiel.
1044180	1045060	But yeah.
1045060	1045900	I have three minutes.
1045900	1047420	So I can go back a little bit.
1047840	1048420	Great.
1048420	1050040	Quick wrap up on this RRE.
1050040	1052780	If you have any questions, hit up the QR code.
1052780	1056100	That GitHub link, I managed to do it post this live.
1056100	1057080	It's public now.
1057080	1058240	I did it from safe internet.
1058240	1059300	Not around here.
1059400	1060940	So you can access it.
1061360	1062500	And then, yeah.
1062500	1063800	Feel free to hit me up with any questions.
1063800	1065620	I'm going to go back really quick.
1068680	1071600	And this will take a good minute of my time just going back.
1072820	1078540	So this is this was also discovered by RRE, but it was an IDOR bug.
1078540	1082540	So IDOR, you're like, eh.
1082540	1085220	But it is another use case for RRE.
1085640	1089960	So what you see here, and this is just redacted material, obviously.
1089960	1095640	On the right is a company town hall, internal town hall that I had legitimate access to.
1095640	1100980	And what you see on the left in my burp suite is the get request that generates that video.
1101340	1101960	Okay?
1101960	1104180	You can see where this is going to go, right?
1104180	1109200	But there's identifiers, there's an account's identifier, an event's identifier, a video's identifier.
1109580	1114200	But they come with seven to nine digit sequence IDs.
1114440	1117140	So to unlock a video, forget about auth for a second.
1117140	1120820	To unlock this video, you're going to have to guess the right sequence.
1121080	1124260	And that's nearly impossible with all the permutations out there.
1124260	1127900	So how do you go about trying to bypass this sequence?
1128060	1131340	And guess the access?
1131440	1137680	What you do is you just strip the entire call to its root, and you just have to guess one ID.
1137840	1142560	And instead of getting an access denied error, you get metadata on the right.
1142860	1147800	And this leaks interesting information that, hey, this is something internal, internal live media content.
1147840	1151780	You scroll down, and that metadata also leaks event information.
1152620	1152840	All right?
1152840	1153660	What are we going to do with that?
1153660	1156420	We're going to plop it over to the get request.
1157240	1160860	And now we see a reference to a town hall with a redacted company.
1161020	1161140	All right?
1161140	1172580	So this was the automation that basically allowed me to enumerate through sequencing through millions of IDs, getting to 1,800 validated internal meetings for different companies.
1172860	1174040	Did it again.
1174120	1178020	And you scroll down, you see a video identifier that loads the actual video.
1178180	1179800	Put it in a get request.
1179800	1180700	So one other step.
1180700	1181200	I'm skipping.
1181200	1181840	Sorry.
1182080	1185620	It generates a video stream, but it also gives you an off token.
1187000	1187660	That's nice.
1187660	1189520	That's a very helpful API.
1190020	1190420	Right?
1190900	1193160	So at this point, you have off.
1193280	1194940	And you didn't need off to begin with.
1194940	1198720	And you have the full sequence enumerated for you by a very helpful API.
1198760	1203840	Because there's a chaining of events here, the RRE trace also works for this as well.
1204140	1207440	So I'll stop because I'm getting the countdown here.
1207680	1212660	Just really thank you all, DEF CON, for having me up on stage and talking to you a little bit about this pet project.
1212660	1214160	I really appreciate the time.
1214160	1214760	Thanks.
