Hey, everyone. Can you hear me? All right. We're good to go. Welcome, everyone, to DEF CON. Yeah. Yeah. So I'm super excited to be back here at DEF CON speaking again. I'm Farzan Karimi. I'm an offensive security researcher. And this is my talk. My session. Paywall optional. Stream for free with a new technique. Recursive request exploits. Little bit of cross talk that I'm hearing. Hopefully you're not hearing that too bad. So anyways, this is my session. Why did I choose a title focused on bypassing paywalls? So the important thing here is you really have to know your audience here at DEF CON. And when you say something like stream for free, you really rally all the cheapskates into one room. Yeah. And I mean that as a compliment. Because I'm one of you. And we speak the same language. So thank you for being here. In all seriousness, the title really understands some of the broader implications of this session. So I'm going to be talking about a new technique I'm going to be releasing called RRE, short for recursive request exploits. 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. So we're going to be talking about that. Two major areas of impact. One, I was able to leverage this technique to target a sports streaming service to get all their content for free. I also was able to target another major streaming service to access over 1,800 internal company meetings. Videos for internal company all hands, global town halls, et cetera. So the pattern works. And I just recently discovered this. So I'm still feeling like I'm just scratching the surface now. So we're going to talk about all that. A little background on me. 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. Right now, Moderna, I also manage security operations, incident response, security engineering, as well as red team. So the scope expanded a little bit, and it just makes the day-to-day more fun. 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. And I know what you're all thinking. Bravo, Farzan. Well done. Let's get on with it. Enough of your intro. We just want free streaming. So here's our session agenda. 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. So quick definition. When I say entitlement, I mean any digital asset that's tied to you, the customer. So that should be bound to your identity as well. And that's essentially the paywall problem here. 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. So think of news article sites, streaming sites, et cetera. So that's essentially the paywall problem. Then we're going to cover a couple of other paywall bypass techniques just for comprehensive analysis. So that's just four traditional bypass methods coupled with RRE. So you're going to get five here, techniques to bypass paywalls in 20 minutes or less. And then we're going to flow into our RRE technique, coupled that with a real world exploit targeting our sports streaming provider. And we'll be releasing a tool at the end of this to help automate it for everyone here. So quickly level set on the traditional bypass methods. I'm not going to talk about these here because we're just going to get into it for time sake. 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. Basically, let's say you're really interested in a news article about dancing nuns. You don't want to pay the $5.99 a month or whatever the newspaper article charges you, the publisher charges you. So what's a way around it? And the quick way here is I'm just going to refresh this page so you can see the paywall opens up. You can't see it. There's nothing on the screen? Has it always been a black screen? Shit. Okay. That's great. Okay. Working on it. Yeah. It's really hard to show you demos when you don't have anything to look at. So I'll just give the technical team here a minute to figure that out and we'll jump back in. Just go? It's all demos. It's all demos. Okay. Well, you know what? 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. I'm trying to keep my cool, but this kind of sucks, to be honest. So to understand what's being exploited with RRE, and by the way, hoot and holler if you actually see something at some point. You need to think about it. I think about it with this quick mental model. And I call it the APSEC principle of first reference. It's something cheesy I made up with, but the intent actually helps with explaining what this concept is doing. So this principle talks about basically we need to identify the first point where a sensitive value in a web app is introduced upstream. Okay? So this is often where trust assumptions are the strongest, but actual authentication and authorization is the weakest. So think of it as a chain of API calls that generate a secret, an entitlement. And in that chain of API calls, there's interdependencies between them that are not obvious. But if everything there is doing a good claims check or an authentication check, then that's good. That's considered a high trust input at each step of the chain. 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. 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, if that makes sense. Again, I had visuals. I wish I could show them to you. I promise there's stuff here. But that's sort of the high level. The attacker's goal here is to just recursively walk that chain, but in an automated fashion. 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. It's a high-cost effort for a pen tester to do this, and automation really helps here. 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. And you put that in the search prompt. There's a search API that returns a bunch of metadata back to you. 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. So Brad Pitt, Edward Norton. Great. 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. 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. You keep searching, rinse, repeat. You look for an episode API that gives you more information about the episode. Maybe there's a video identifier in there tied to the episode. Now you're working, again, all unauthenticated. 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. So that's sort of what I'm talking about visually. And this is a great challenge for me to do this without a visual, again. So I hope that's tracking a little bit. Does that make sense? Cool. Awesome. So if I were to define what RRE is, it is basically a methodology for recursively tracing interdependent web requests in reverse. 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. 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. So that's what I'm doing with this technique. In other words, the question I'm asking myself with this technique is, where was this parameter generated from? And asking that question again and again and again and again. Yes! I am so happy right now. Because actually I had nothing else to say. You know what? 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. Within 17 hours ago, I gave them responsible disclosure months ago. And so, of course, there's a little bit of, yeah, last minute attention that they're providing me. So we'll save time if we can go back to that. Great. Here is RRE. This is a manual flow of a demo of a manual flow of RRE. In this version, this is version one of my tool. Okay? So I'm not implementing any recursion just yet. Right? So just to show how this works. And then we're going to get into the recursive bit in the next demo. 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. So I'm going to start by searching for a football game on the sports streaming service. Since I'm not logged in, the video doesn't play, so that's a good sign. Now I'm going to log in as a valid user and repeat that same search. All right. Now in BERT by CD API response includes a video stream URL. That's a protected value. I had to log in to get it. Now test if I can replay that stream link in a media player like VLC. And we can see here in just a minute, the video plays. That's a great start for an attacker, right? Because you've circumvented the web app at this point entirely. There's no session off anymore. Now I want to know where that video stream came from initially. So it looks like it was returned from this V2 VODs API or video on demand API. And it depends on this parameter called VOD, whatever that means. 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. And it was turned out it was generated by another API call that used that VOD ID. And it's generated by this call that uses GAM. So what's GAM? I have no idea. Let's inspect that call. And you don't have to really watch the video anymore. Just listen to the narration. Now that I've gotten better about that. Really, we're just going back and doing this rinse and repeat to go back and identify the source of the call. And that GAM ID map to the game I was searching for in my search prompt initially. So again, all unauthenticated. And I was able to leverage this technique to trace back and see what was the originating call. Yes, manually, which is why I'm going to get into the next bit here. So just visualizing that chain, what I was able to do in that video. So I was at the very top. We have our video secret. And then everything else is a hop and a trace doing RRE step by step to see what API call generates the next. So VOD generates the load media, the URL stream, the M3 link. The GAM parameter generated the VOD call. And our original call was just an unauthenticated search, right, for the event. So we're just attacking metadata here, if that makes sense. So what's the problem? What challenge did I run using this technique? I couldn't scale it. Because I'm still manually clicking through API call, every API. So I need to find a way to make this recurse effectively. And that's a challenge, right? Because, again, these are asynchronous APIs, and I don't know what API connects to what. So what's the solution there? Entropy. 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, if that makes sense. So if you implement entropy here, I use Shannon entropy. I looked it up on chat GPT, what entropy should I use, and it just said Shannon, and it sounded good to me. There's no real preference here. You can use any entropy check of your choice. What's interesting or what's more important is I was able to also implement a threshold. 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, like, a very low entropy parameter like actor ID or whatever, right? So with that, this is the logic to show the threshold code. 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. So this is the version with recursion. So this shows everything works in one package, one 40-second demo. What you'll see here is the sum of all the parts we demonstrated so far in this presentation. Everything we did manually, we built recursion now, coupled with logic that prompts or pinpoints those candidate parameters based on these entropy checks, right? 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. So I'm going to right-click that video stream link parameter and go back and say RRE, give me the full chain. And in just a couple seconds, you'll see all the results nicely and neatly populated for you right here. So this is the entire grant flow for your target secret. The video stream chained back to each API call. You don't have to discover this anymore yourself. It maps it for you. Does that make sense? Yeah? Cool. And if none of these values are required off, cool, none of these values are required off, you're cooking. 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. We just did this in a couple seconds. So that's the value of the tool. So again, this is just for reference. Thank you. Right here is just a culmination final hurrah video that demonstrates this at scale, targeting this sports streaming service. I took that API sequence from the results of my RRE chain before and pointed it to this streaming service all in one day. So you're going to see a bunch of videos up here. This is literally me pulling down every live stream from this sports streaming service, every highlight, over and over again. What's interesting is you may see some empty stadiums and empty arenas. And this is really interesting. Because it's a cherry on top finding. If I move to the next slide. Why are there empty arenas? Because... what's that? Live streams. 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. There could be always on live streams. And they may not be advertised by the application for a specific window. But if you can hit the APIs with the right parameters, you can just tap into those cameras at any time. So it's a big privacy nightmare, right? Depending on who the live stream provider is. And I think there's a whole area to discover here that I'm just kind of just scratching the surface for myself. But I'm interested if anybody else dives into this as well. Feel free to reach out. So of course, as with any good red teamer, I've left one minute for the remediation slide. And so I don't have to talk about it too much. But the TLDR here is if you're doing stuff with multiple APIs, this informs good claim checks. DRM if you're doing streaming. Time bound session tokens. And this whole always on live stream concept, turn off the cameras. Unplug those cameras. Do whatever. Don't have always on live content. I'm so sorry I couldn't get to the team meeting compromise, which was a whole five-minute spiel. But yeah. I have three minutes. So I can go back a little bit. Great. Quick wrap up on this RRE. If you have any questions, hit up the QR code. That GitHub link, I managed to do it post this live. It's public now. I did it from safe internet. Not around here. So you can access it. And then, yeah. Feel free to hit me up with any questions. I'm going to go back really quick. And this will take a good minute of my time just going back. So this is this was also discovered by RRE, but it was an IDOR bug. So IDOR, you're like, eh. But it is another use case for RRE. So what you see here, and this is just redacted material, obviously. On the right is a company town hall, internal town hall that I had legitimate access to. And what you see on the left in my burp suite is the get request that generates that video. Okay? You can see where this is going to go, right? But there's identifiers, there's an account's identifier, an event's identifier, a video's identifier. But they come with seven to nine digit sequence IDs. So to unlock a video, forget about auth for a second. To unlock this video, you're going to have to guess the right sequence. And that's nearly impossible with all the permutations out there. So how do you go about trying to bypass this sequence? And guess the access? What you do is you just strip the entire call to its root, and you just have to guess one ID. And instead of getting an access denied error, you get metadata on the right. And this leaks interesting information that, hey, this is something internal, internal live media content. You scroll down, and that metadata also leaks event information. All right? What are we going to do with that? We're going to plop it over to the get request. And now we see a reference to a town hall with a redacted company. All right? 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. Did it again. And you scroll down, you see a video identifier that loads the actual video. Put it in a get request. So one other step. I'm skipping. Sorry. It generates a video stream, but it also gives you an off token. That's nice. That's a very helpful API. Right? So at this point, you have off. And you didn't need off to begin with. And you have the full sequence enumerated for you by a very helpful API. Because there's a chaining of events here, the RRE trace also works for this as well. So I'll stop because I'm getting the countdown here. Just really thank you all, DEF CON, for having me up on stage and talking to you a little bit about this pet project. I really appreciate the time. Thanks.