1 00:00:00,000 --> 00:00:08,120 So I'm happy to introduce Ronnie Carta and talk about practical exploitation in denial of service and bug bounties. 2 00:00:08,340 --> 00:00:09,780 Ronnie, thanks. 3 00:00:13,760 --> 00:00:17,220 Hi everyone, I'm really happy to be there today. 4 00:00:17,220 --> 00:00:29,060 This is the first ever Bug Bounty Village and it's a true honor to do the first talk ever, well with some technical difficulties of not having an HDMI cable, but no worries, we are there now. 5 00:00:29,840 --> 00:00:34,680 So the talk is about practical exploitation of denial of service in bug bounty program. 6 00:00:34,680 --> 00:00:48,940 So first of all, my name is Ronnie, I go by the nickname Lupin, I'm the co-founder of Lupin Homes, we are a security research and development company, and I'm coming from the best city in the world, Grenoble, it's in the French Alps, a lot of skiing, beautiful place. 7 00:00:50,100 --> 00:00:52,500 I love denial of service. 8 00:00:52,500 --> 00:00:59,700 I love denial of service because you can actually try to slow down or considerably take down an entire product environment. 9 00:00:59,920 --> 00:01:06,920 And so the goal of denial of service in bug bounties is to basically try to find the most business impact. 10 00:01:06,920 --> 00:01:12,340 Imagine like a website not having traffic anymore, that will be a huge bummer for the company. 11 00:01:13,280 --> 00:01:30,980 And so denial of service, and like the difference between denial of service and DDoS is basically denial of service is from one single machine, but DDoS, the additional D is for distributed, of course, so it means that we require a series of different machines to be able to take down our target. 12 00:01:31,040 --> 00:01:38,840 This is basically all about the resource that you have on your machine against the resources that you have on your target. 13 00:01:38,840 --> 00:01:53,860 So if the attacker has more resources on its machine, then it can basically take down the target, but in a DDoS, you might have amplification or multiplicating factor in order to be able to completely take down the machine. 14 00:01:53,940 --> 00:01:56,320 So that's what we're going to talk about today. 15 00:01:56,920 --> 00:01:59,880 A little bit of definition debates here. 16 00:02:00,960 --> 00:02:06,400 Basically, there is a whole debate about denial of service being an availability or integrity impact. 17 00:02:06,740 --> 00:02:14,400 So basically, the impact of like the DDoS is not a vulnerability class, but more like an impact, I will say. 18 00:02:14,400 --> 00:02:25,320 And we can say that deleting a resource is in a sense denied, but the CVSS documentation says that the deletion of a resource is integrity and not availability at all. 19 00:02:25,320 --> 00:02:30,600 So that whole blob of documentation, if you want to read it, is what the CVSS says. 20 00:02:30,600 --> 00:02:39,360 So basically, it says that availability is the performance and operation of the service itself and not the availability of the data. 21 00:02:39,360 --> 00:02:47,240 For those who have been doing bug bounty hunting, you know that you are debating a lot about CVSS and you need to read all the documentation. 22 00:02:47,240 --> 00:02:51,920 So be mindful of that if you want to argue with CVSS programs. 23 00:02:53,280 --> 00:02:55,720 So when DDoS is relevant? 24 00:02:55,760 --> 00:03:01,260 Basically, it is relevant for every feature where there is a strong dependency. 25 00:03:01,480 --> 00:03:10,480 This means that it's a feature that a lot of users are going to use or maybe there's a dependency on the machines that you are targeting. 26 00:03:10,980 --> 00:03:16,560 For instance, if you can take that entire EKS cluster in production, well, that might be super impactful. 27 00:03:17,900 --> 00:03:20,120 But yeah, I know what you are going to say. 28 00:03:20,120 --> 00:03:22,200 DDoS is totally out of scope. 29 00:03:22,200 --> 00:03:28,100 Actually, on HackerOne default templates for program, it's marked as out of scope by default. 30 00:03:28,380 --> 00:03:33,280 And there's a reason for that, because companies in usual do not like DDoS. 31 00:03:33,280 --> 00:03:45,820 Not because of the low impact of security, but because actually, if you let all your bug hunters completely take down your website, it might be a huge problem for them. 32 00:03:46,200 --> 00:03:53,720 So basically, it's not because DDoS has low impact, but because sometimes that's too much impact. 33 00:03:53,880 --> 00:03:59,940 But we can test DDoS responsibly and actually make a few bucks with it. 34 00:04:00,820 --> 00:04:07,820 In order to test DDoS responsibly, you need to find the gadget of the problem to fully exploit it. 35 00:04:07,820 --> 00:04:17,060 So this means that, for instance, if you have a request that takes more than 10 seconds, this may be a cool gadget in order to take down the entire environment. 36 00:04:17,060 --> 00:04:22,080 But you do not need to actually take it down to just see that one request takes more than 10 seconds. 37 00:04:22,220 --> 00:04:30,740 And also, if you are allowed, you can still try to take down the non-production environment, so staging, integration, sandbox, et cetera. 38 00:04:30,760 --> 00:04:39,520 But if there is something to know about this entire talk, please, always ask the programs before even searching for their services. 39 00:04:39,840 --> 00:04:45,700 Because programs need to be aware of what kind of tests you are going to do in order for them to monitor. 40 00:04:45,720 --> 00:04:54,220 And if everything is going to fire, they need to identify that you are the one doing the test and just call you and say, hey, I think there is a problem here. 41 00:04:55,700 --> 00:04:59,780 And DDoS service is all about program's maturity, right? 42 00:05:00,220 --> 00:05:09,540 Some companies do not care about, you know, services risk, because they, I don't know, they don't have, like, user traffic or stuff like that. 43 00:05:09,720 --> 00:05:14,960 But actually, some programs will allow you to completely take down their product environment. 44 00:05:15,500 --> 00:05:16,860 And I'm serious. 45 00:05:17,180 --> 00:05:20,300 They are completely allowing to take down their dub-dub-dub environment. 46 00:05:20,300 --> 00:05:21,840 So, this is amazing. 47 00:05:22,400 --> 00:05:30,620 Before starting going on all the different techniques, I need to thanks Rezo, Zack, Ixo, Snorlax, Befed, BonsoirD, and DoomerHunter. 48 00:05:30,620 --> 00:05:32,020 Those are amazing hunters. 49 00:05:32,080 --> 00:05:35,800 We did all this research together on the span of two years. 50 00:05:35,800 --> 00:05:38,540 So, I needed to quickly show that to them. 51 00:05:38,580 --> 00:05:40,600 Amazing people to follow, too. 52 00:05:41,680 --> 00:05:42,000 Okay. 53 00:05:42,000 --> 00:05:44,960 Let's start with a quick vulnerability. 54 00:05:44,960 --> 00:05:46,800 This one is really fun. 55 00:05:46,800 --> 00:05:49,520 So, one evening, we were hacking with Snorlax. 56 00:05:49,520 --> 00:05:55,740 And there was this application that was sending service to send chat messages. 57 00:05:56,020 --> 00:06:04,420 And so, with Snorlax, when we're hunting together, we have this game where the goal is to basically try to XSS the other one. 58 00:06:04,420 --> 00:06:09,960 So, we were contacting one another, sending messages, and we're, like, the first that got XSS wins it. 59 00:06:10,420 --> 00:06:14,840 But at some point, we were doing a test, and my page completely goes blank. 60 00:06:14,840 --> 00:06:17,020 And I was, like, maybe I lost internet. 61 00:06:17,020 --> 00:06:21,080 But I was still hearing Snorlax on Discord, and I was, like, there's something weird, right? 62 00:06:21,180 --> 00:06:26,260 Until he tells me, hey, Lupin, is your page blank, too? 63 00:06:27,040 --> 00:06:31,360 So, those are the payloads that we sent at this moment. 64 00:06:31,360 --> 00:06:36,620 So, try to think about which one did manage to make the page entirely blank. 65 00:06:36,920 --> 00:06:38,320 Do you have it? 66 00:06:40,140 --> 00:06:40,840 Yeah. 67 00:06:40,840 --> 00:06:42,000 This is the one. 68 00:06:42,000 --> 00:06:53,040 And so, to understand why this payload made the page blank, you need to understand that the service was using a library called sanitize HTML. 69 00:06:53,040 --> 00:07:01,180 So, basically, it's some kind of DOM purify that will try to sanitize every XSS that you are going to send. 70 00:07:01,420 --> 00:07:07,540 And this library actually tried to sanitize every href attribute in your frontend. 71 00:07:07,540 --> 00:07:13,420 So, for instance, if you have a JavaScript schema, it will try to remove it from the href. 72 00:07:13,420 --> 00:07:16,660 However, in this payload, where is the href? 73 00:07:16,660 --> 00:07:18,260 There's a problem here. 74 00:07:18,460 --> 00:07:26,440 And so, the library actually called the function href and take an argument href and do a dot replace on it. 75 00:07:26,440 --> 00:07:30,780 However, when it's undefined, it completely crashed the entire frontend. 76 00:07:30,980 --> 00:07:31,680 Okay. 77 00:07:31,680 --> 00:07:33,660 That was a pretty cool one. 78 00:07:34,040 --> 00:07:40,280 And so, for every kind of client-side service, I would say that the impact is not that huge. 79 00:07:40,280 --> 00:07:44,120 It's all depending on the target. 80 00:07:44,120 --> 00:07:50,800 Overall, with this specific technique of malformed data, HTML, we did $350 bounty. 81 00:07:50,820 --> 00:07:52,740 But that's just the start. 82 00:07:53,280 --> 00:08:07,120 If you want to actually search for more malformed data in the frontend, you can... there was a cool vulnerability where we had, like, a post request and we could send any invalid JSON. 83 00:08:07,120 --> 00:08:11,720 That was validated by the backend, but it was a completely malformed JSON. 84 00:08:11,720 --> 00:08:16,720 And so, when the frontend was using it, it will also completely crash. 85 00:08:16,800 --> 00:08:19,980 And so, the malformed JSON was really simple. 86 00:08:20,140 --> 00:08:25,060 It was using two back quotes at the same time. 87 00:08:25,060 --> 00:08:26,220 Two escape back quotes. 88 00:08:26,220 --> 00:08:29,040 And so, it was somehow accepted by the backend. 89 00:08:29,040 --> 00:08:34,220 But when you were doing a JSON.parse on the frontend, it would completely crash. 90 00:08:34,600 --> 00:08:40,500 And so, this technique actually worked on TikTok and we got paid for that. 91 00:08:40,500 --> 00:08:42,360 So, that was a cool one. 92 00:08:42,520 --> 00:08:44,960 But there's some cooler techniques now. 93 00:08:45,420 --> 00:08:46,120 Okay. 94 00:08:46,120 --> 00:08:51,140 So, that guy here is one of the biggest problems for all developers. 95 00:08:51,860 --> 00:08:54,100 The N plus one problem. 96 00:08:54,100 --> 00:09:07,240 Basically, this technique... I actually knew about it because my brother, who is a backend developer, told me about... like, we were talking about services and how I was trying to exploit them. 97 00:09:07,240 --> 00:09:09,520 And he was like, do you know what's an N plus one problem? 98 00:09:09,520 --> 00:09:10,340 And I was like, no. 99 00:09:10,340 --> 00:09:22,240 And he told me that, basically, an N plus one problem was a database when one query leads to N additional queries, causing inefficient data retrieval. 100 00:09:22,960 --> 00:09:32,260 So, basically, an attacker can exploit N plus one queries to trigger numerous calls to the database and potentially overwhelm the system. 101 00:09:32,640 --> 00:09:37,260 And the impact of an N plus one query often scales with the data size. 102 00:09:37,260 --> 00:09:42,200 So, the more data that you have, the more DOS capability you can have on your target. 103 00:09:43,140 --> 00:09:45,660 So, how do you detect an N plus one query? 104 00:09:45,700 --> 00:09:48,540 Basically, you find an endpoint that creates data in the API. 105 00:09:49,140 --> 00:09:52,400 You find a request that gets all the data at the same time. 106 00:09:52,400 --> 00:09:53,960 So, usually a get request. 107 00:09:53,960 --> 00:09:56,660 And if there is pagination, try to increase the limit. 108 00:09:56,660 --> 00:09:59,740 For instance, you have some request that is page equal 10. 109 00:09:59,740 --> 00:10:02,960 Try to put 10,000 and see what's going to happen. 110 00:10:03,660 --> 00:10:11,260 And if the more data you add in the backend, the more time delay there is in the response, then you have an N plus one error. 111 00:10:12,520 --> 00:10:17,660 I also created a BURP extension that I'm going to release right after this talk. 112 00:10:17,860 --> 00:10:19,540 That's called Tridos. 113 00:10:19,540 --> 00:10:29,860 And basically, it's going to search in your proxy passively all the requests that takes more than X seconds, where X is a threshold that you set yourself. 114 00:10:29,860 --> 00:10:32,260 I personally put it to three seconds. 115 00:10:32,260 --> 00:10:42,180 And this is a good way to actually identify queries that might take a lot of time on the backend and that you can actually use for your exploitation. 116 00:10:42,840 --> 00:10:48,280 So, let's take an example of an N plus one problem. 117 00:10:48,420 --> 00:10:53,280 There was an app that could accept to get as many objects as we wanted. 118 00:10:53,280 --> 00:10:57,160 The JSON blob was something like that, where you had a list of users. 119 00:10:57,160 --> 00:11:04,660 And then on each user, you can create... on each array of the list, you can create a new user. 120 00:11:04,660 --> 00:11:09,360 And then there was another sub object with another array with new objects. 121 00:11:09,360 --> 00:11:16,220 So, that's basically an N plus one problem, when one request can create as many sub objects as you want. 122 00:11:16,860 --> 00:11:18,800 And so, how did we exploit that ? 123 00:11:18,800 --> 00:11:26,600 Well, we sent the request to create all those objects and we created approximately 10,000 objects in the backend. 124 00:11:26,860 --> 00:11:33,800 And then our get request to retrieve all the objects took 10 seconds per request. 125 00:11:33,800 --> 00:11:38,700 So, that's a really, really good sign that you have an N plus one problem. 126 00:11:38,700 --> 00:11:49,920 We took that request, we put it into an intruder on Burp, and we set it with no payloads, concurrent requests, and we basically set it to run indefinitely. 127 00:11:50,280 --> 00:11:51,120 And the result... 128 00:11:54,300 --> 00:11:55,980 complete crash. 129 00:11:56,160 --> 00:12:03,060 Overall, this technique, not only single-vulnerability, but overall, we did 46,000 dollars in bounty. 130 00:12:03,060 --> 00:12:07,860 There was an LHE this week, so we can add 10,000 more to this slide. 131 00:12:08,000 --> 00:12:17,140 I think that 30k of this was Snorlax alone, because he's so good at just taking one technique and spreading it. 132 00:12:17,140 --> 00:12:22,100 I think he did 15k per vulnerability, so in two vulnerabilities, 30k. 133 00:12:22,100 --> 00:12:23,880 That guy is insane. 134 00:12:25,100 --> 00:12:28,980 Okay, let's talk about network-based denial of services. 135 00:12:29,460 --> 00:12:35,940 Have you ever been in that situation where you have a blind SSRF and you don't know what to do with it? 136 00:12:36,000 --> 00:12:43,900 And that you are desperate for a technique that will help you transform this sometimes informative vulnerability into a higher crit? 137 00:12:44,300 --> 00:12:46,880 Well, we have a technique for you. 138 00:12:48,380 --> 00:12:52,640 Basically, do you guys know something called, like, slow low-risk attack? 139 00:12:52,640 --> 00:13:02,560 Well, basically, we are going to try to do something really similar where we are going to try to make the bucket hang on the network level as much as possible. 140 00:13:02,560 --> 00:13:04,960 We can do it with several ways. 141 00:13:04,980 --> 00:13:12,880 You can make your server hang and just time out after 10 seconds, or you can create a request loop. 142 00:13:13,600 --> 00:13:15,920 So what do I mean by request loop? 143 00:13:15,920 --> 00:13:27,600 Well, you have your server that has a path that will reject 301 on path 2, and then the path 2 will reject again on path 1, so we create, like, an infinite loop of redirects. 144 00:13:27,600 --> 00:13:32,760 And the goal is to make the server time out as much as possible. 145 00:13:32,760 --> 00:13:36,360 So we have that kind of schema happening. 146 00:13:37,320 --> 00:13:47,320 And the goal of that technique is actually to fill all the available sockets of the server so it couldn't actually treat the next request. 147 00:13:48,580 --> 00:13:54,080 Until we have this bottleneck happening and there is no available sockets anymore. 148 00:13:56,820 --> 00:14:03,040 For this technique, I think it was on two separate vulnerabilities, we made 15k. 149 00:14:03,040 --> 00:14:08,060 So it's actually a great technique to transform blind SSRF into a critical. 150 00:14:08,220 --> 00:14:12,980 Again, every time that we take down product environments, we always ask for the programs. 151 00:14:12,980 --> 00:14:14,580 Really be mindful of that. 152 00:14:14,580 --> 00:14:18,560 But that's a pretty cool one if you're ever stuck. 153 00:14:19,680 --> 00:14:20,240 Okay. 154 00:14:20,240 --> 00:14:23,340 Let's go to sign-in denial of services. 155 00:14:24,520 --> 00:14:30,400 This one was really cool because we had a target with an employee web page. 156 00:14:30,400 --> 00:14:38,540 And basically when we see an employee web page, we try password stuffing or brute forcing, we see proclamation, injection, et cetera, et cetera. 157 00:14:38,700 --> 00:14:53,420 But why this target was particularly interesting for us is it was a target with more than 1,000 employees, there was no rate limiting on the login, no 2FA at all, and they were using first name dot last name for the user. 158 00:14:53,420 --> 00:14:58,580 So we could pull everything on LinkedIn and we had a great world list to work with. 159 00:14:58,960 --> 00:15:00,840 So what do we do? 160 00:15:00,840 --> 00:15:06,800 We managed to automate the attack, no rate limiting at all, and then no login found. 161 00:15:06,800 --> 00:15:07,440 Wait. 162 00:15:07,440 --> 00:15:08,740 No login found? 163 00:15:08,740 --> 00:15:11,020 But we still got a crit. 164 00:15:11,520 --> 00:15:12,300 Okay. 165 00:15:12,440 --> 00:15:17,420 Guess what protection they implemented for brute forcing attack? 166 00:15:17,420 --> 00:15:19,660 Is it A, delay the next attempt? 167 00:15:19,660 --> 00:15:21,000 B, capture? 168 00:15:21,120 --> 00:15:23,440 C, ban the IP address? 169 00:15:23,440 --> 00:15:25,540 Or D, ban the employee account? 170 00:15:30,270 --> 00:15:35,610 There is actual documentation on the internet that says that this is the right thing to do. 171 00:15:35,750 --> 00:15:37,310 So, yeah. 172 00:15:37,310 --> 00:15:38,190 What happened? 173 00:15:38,190 --> 00:15:39,970 600 accounts locked. 174 00:15:40,530 --> 00:15:48,830 They had integration with the ID, so active directory completely down, no access to the VPN anymore. 175 00:15:49,390 --> 00:15:52,610 Completely take down of the internet environment. 176 00:15:52,610 --> 00:15:53,910 So funny. 177 00:15:54,470 --> 00:16:04,910 I would say that the impact of this technique is actually like a three out of five, but it's because the presence in the world is also reduced. 178 00:16:04,910 --> 00:16:07,670 I don't think that a lot of companies are doing that anymore. 179 00:16:08,070 --> 00:16:10,090 But pretty cool bug. 180 00:16:11,050 --> 00:16:11,550 Okay. 181 00:16:11,550 --> 00:16:14,710 Let's go to another type of DOS. 182 00:16:14,810 --> 00:16:16,310 Disconception DOS. 183 00:16:16,330 --> 00:16:17,730 So, this story is quite cool. 184 00:16:17,730 --> 00:16:20,870 It started because I read this asset node research. 185 00:16:20,870 --> 00:16:25,590 If you guys don't know asset nodes, you should read every blog post of them. 186 00:16:25,590 --> 00:16:26,610 It's amazing. 187 00:16:26,610 --> 00:16:34,610 And there was this blog post from 2019 called discovering a zero day and getting code execution on modular AWS network. 188 00:16:34,610 --> 00:16:36,930 So, how did asset node achieve that? 189 00:16:36,930 --> 00:16:39,870 Basically, there was an instance called web page test. 190 00:16:40,310 --> 00:16:42,390 And it was completely open source. 191 00:16:42,390 --> 00:16:43,430 So, they read the code. 192 00:16:43,430 --> 00:16:48,930 And there was like this piece of code where you could extract a zip file that was given by the user. 193 00:16:48,930 --> 00:16:55,010 And then with some kind of quick race condition, you could actually call a PHP file. 194 00:16:55,070 --> 00:17:03,050 And so, for this race condition to work, you needed to set up an intruder and just run as many requests as possible. 195 00:17:03,770 --> 00:17:06,070 What happened when I tried it? 196 00:17:07,070 --> 00:17:11,010 The backend didn't have enough inodes to take the charge of requests. 197 00:17:11,010 --> 00:17:17,290 So, every time it was creating a zip file and trying to extract it, it was allocating inodes. 198 00:17:17,290 --> 00:17:21,590 And so, the disk was full in like maybe two, three seconds. 199 00:17:21,730 --> 00:17:22,510 So, yeah. 200 00:17:22,510 --> 00:17:24,330 I took down the instance. 201 00:17:24,330 --> 00:17:30,650 And I thought that this instance wasn't used by anyone until someone told me, hey, all the pipelines are down. 202 00:17:30,650 --> 00:17:34,530 And so, every time they were running a pipeline, they were going to that instance. 203 00:17:35,270 --> 00:17:36,390 That's cool. 204 00:17:37,050 --> 00:17:39,230 So, total crash of the server. 205 00:17:39,230 --> 00:17:40,270 No access to the disk. 206 00:17:40,270 --> 00:17:43,930 They needed to clean everything, wipe out, restart the server. 207 00:17:43,930 --> 00:17:45,430 That was a cool one. 208 00:17:45,490 --> 00:17:50,330 I would say that, again, the impact is reduced because of the presence in the world. 209 00:17:50,330 --> 00:17:52,390 So, it's a three out of five. 210 00:17:53,550 --> 00:17:55,030 Cache poisoning. 211 00:17:55,030 --> 00:17:56,630 That's a good one. 212 00:17:57,190 --> 00:18:05,490 So, one day, we were developing a new feature for our tool in research mode. 213 00:18:05,490 --> 00:18:14,370 Research mode for us is when we want to test an idea and spread it to see if it should be incorporated into our tool for our customers. 214 00:18:14,990 --> 00:18:25,030 And so, the idea was, what if registries, when you install a dependency and have two factories, used by the clients were vulnerable to cache poisoning in our service? 215 00:18:25,330 --> 00:18:27,250 It's a good thing to try. 216 00:18:27,250 --> 00:18:29,110 So, we developed a proof concept. 217 00:18:29,370 --> 00:18:34,370 And on the first run, we managed to get a hit on registry.npmjs.org. 218 00:18:34,370 --> 00:18:36,890 And I was like, no. 219 00:18:36,890 --> 00:18:38,230 That didn't happen. 220 00:18:38,230 --> 00:18:39,470 Like, no way. 221 00:18:40,510 --> 00:18:42,870 So, we thought it was a fault positive. 222 00:18:42,870 --> 00:18:45,750 And lo and behold, it worked. 223 00:18:46,590 --> 00:18:49,190 So, what is CPDOS? 224 00:18:49,490 --> 00:18:53,980 CPDOS is a web attack technique described by Paul Truger. 225 00:18:54,750 --> 00:18:57,670 Paul Truger actually made it really, really famous. 226 00:18:57,670 --> 00:19:02,090 Again, if you didn't read in your life a James Kettle research, you should do it. 227 00:19:02,490 --> 00:19:03,950 This guy is amazing. 228 00:19:03,950 --> 00:19:05,650 Always breaking the internet. 229 00:19:05,930 --> 00:19:13,290 And basically, it's in the web caching system in order to deliver malicious content to the users. 230 00:19:14,110 --> 00:19:21,590 So, the methodology is to first understand how the cache keys of our target is working. 231 00:19:21,590 --> 00:19:28,170 And then understand how the output of the request is linked to your HTTP input. 232 00:19:28,170 --> 00:19:31,290 So, for instance, is the cache key inside the path? 233 00:19:31,290 --> 00:19:32,290 The headers? 234 00:19:32,290 --> 00:19:35,050 Or maybe the post requests? 235 00:19:35,050 --> 00:19:41,650 Once you identify the cache key, try to understand how you can manipulate it in order to catch unwanted content. 236 00:19:41,650 --> 00:19:49,190 So, it could be a malicious content like an XSS payload or it could just take down the page for all the users. 237 00:19:49,910 --> 00:19:54,430 So, the case of registry.mpmjs.org was pretty cool. 238 00:19:54,510 --> 00:19:59,590 Basically, my assumption is that the cache key was actually the full path. 239 00:19:59,650 --> 00:20:07,110 And when we added our malicious header, it will create a fall for error. 240 00:20:07,110 --> 00:20:10,310 However, the cache key is still remaining the same. 241 00:20:10,310 --> 00:20:13,950 And so, it will just override the cache key with a 404. 242 00:20:14,690 --> 00:20:19,050 So, at this point, we called deny packages. 243 00:20:19,210 --> 00:20:26,630 That's a screenshot of my script running in the back and I'm trying to do an npm install and then that's it. 244 00:20:26,630 --> 00:20:29,570 We got a 404 in production environment. 245 00:20:29,570 --> 00:20:31,250 So, that was kind of cool. 246 00:20:31,250 --> 00:20:34,070 Don't worry, I did it on the package that I created myself. 247 00:20:34,070 --> 00:20:36,670 I didn't take down anything, hopefully. 248 00:20:37,650 --> 00:20:43,810 And so, the impact was a complete denial of any npm package in the world. 249 00:20:43,810 --> 00:20:47,530 Imagine experts as 30 million plus downloads per week. 250 00:20:48,110 --> 00:20:54,030 Actually, there was a lot of mitigation in place on GitHub and npm side. 251 00:20:54,190 --> 00:20:58,050 But what's quite cool about VT. 252 00:20:58,050 --> 00:21:03,690 And so, first, they awarded a $500 informative. 253 00:21:03,690 --> 00:21:14,570 But then, they actually did an awesome work to reconsider the severity and they added a $10,000 bounty for this npm crash. 254 00:21:14,570 --> 00:21:17,070 So, I was so happy. 255 00:21:17,070 --> 00:21:20,990 Especially for something that we didn't do on purpose, again. 256 00:21:21,970 --> 00:21:22,550 Okay. 257 00:21:22,550 --> 00:21:26,830 Let's go to another cool attack vector for denial of services. 258 00:21:26,830 --> 00:21:28,460 Everything related to GraphQL. 259 00:21:29,030 --> 00:21:31,620 So, why are we talking about GraphQL today? 260 00:21:31,620 --> 00:21:35,880 Because it has a huge adoption in the last few years. 261 00:21:35,900 --> 00:21:40,340 And there is so many denial of services in the default configuration. 262 00:21:40,340 --> 00:21:43,800 But when I say so many, I say so many. 263 00:21:45,160 --> 00:21:51,160 First case of denial of services on GraphQL is a circular definition. 264 00:21:51,160 --> 00:21:59,600 Basically, a circular definition occurs when an object references itself directly or indirectly. 265 00:21:59,600 --> 00:22:04,120 For instance, here we have a type user that has a best friend user. 266 00:22:04,120 --> 00:22:08,540 But imagine if your best friend is also best friend with you. 267 00:22:08,540 --> 00:22:10,580 You are basically referencing yourself. 268 00:22:10,580 --> 00:22:12,860 So, we have a circular definition here. 269 00:22:13,460 --> 00:22:18,960 But no need to check for the introspection and actually understand the structure of your target. 270 00:22:19,040 --> 00:22:22,820 GraphQL is vulnerable by default in the introspection schema. 271 00:22:22,820 --> 00:22:28,280 So, you can just do an introspection and actually DOS your target without understanding their data structure. 272 00:22:28,640 --> 00:22:30,220 That's insane. 273 00:22:31,680 --> 00:22:37,300 And so, there's another kind of technique called GraphQL batching that is pretty cool. 274 00:22:37,300 --> 00:22:43,580 Basically, the goal is to compile a lot of different requests in the same HTTP request. 275 00:22:43,580 --> 00:22:48,420 Again, this could be used to actually DOS your target. 276 00:22:48,420 --> 00:22:50,820 We're going to talk about this a little bit later. 277 00:22:51,260 --> 00:23:02,220 Something really similar to GraphQL batching, there is aliases where basically you can use different aliases for the same request, but also use different arguments. 278 00:23:02,260 --> 00:23:06,900 So, that also could be a huge attack vector for denial of service. 279 00:23:07,440 --> 00:23:13,460 So, quick tip for batching and aliases is to actually try to find gadget. 280 00:23:13,460 --> 00:23:27,780 What I call gadget, if it's the right definition, but what I call gadget for this specific vulnerability is to find a query in the structure of a target that takes already 200 milliseconds up to 500 milliseconds. 281 00:23:27,840 --> 00:23:29,240 Sometimes more. 282 00:23:29,660 --> 00:23:32,360 When you don't optimize anything, I guess. 283 00:23:33,000 --> 00:23:40,200 And use this specific query in every batching request that you do, or in every aliases. 284 00:23:40,200 --> 00:23:46,660 And this will allow you to send a lot of requests to maybe the disk operation that it does, the memory. 285 00:23:46,660 --> 00:23:50,060 It really depends on how the backend implemented it. 286 00:23:50,300 --> 00:23:57,700 But this could take you like a batching that takes five seconds per request up to five minutes per request. 287 00:23:57,700 --> 00:24:02,840 So, this is a good way to multiply and amplify your DOS. 288 00:24:04,080 --> 00:24:06,200 And there is this one. 289 00:24:06,200 --> 00:24:08,040 The GraphQL directives. 290 00:24:08,040 --> 00:24:09,780 So, what's a directive? 291 00:24:10,000 --> 00:24:19,600 It's a way for GraphQL to decorate a part of the schema and actually to do an operation on top of it or additional configuration. 292 00:24:20,140 --> 00:24:34,890 And there is a technique called GraphQL directive overloading, where basically you can just make that payload, repeat the at eight as many times as you like, and it will totally crash the server somehow. 293 00:24:35,600 --> 00:24:42,320 But we had a cool story on the Google console with evolving that. 294 00:24:42,320 --> 00:24:48,660 So, let's imagine that a directive could be used for, again, our type user. 295 00:24:48,660 --> 00:24:54,360 And you can query every user with the admin or user. 296 00:24:54,380 --> 00:24:58,820 So, that's the way that normally we could use a directive. 297 00:24:59,660 --> 00:25:05,300 But then Google was using the directive in a very, very strange way. 298 00:25:05,300 --> 00:25:15,280 Basically, you add the query list operation, for instance, and then you see that we have a directive at signature with bytes inside. 299 00:25:15,460 --> 00:25:24,500 And what they were doing, they were actually signing the body of the request from within the GraphQL request. 300 00:25:25,100 --> 00:25:32,300 And every time that we wanted to modify any variables or anything in the schema, we will get an error. 301 00:25:32,320 --> 00:25:38,520 So, you know, when we're trying to attack a backend, we really want to modify the request in our proxy. 302 00:25:38,520 --> 00:25:43,620 So, that was a huge bummer because it means that everything was totally signed. 303 00:25:43,620 --> 00:25:47,440 So, we tried to see if we could sign out our requests. 304 00:25:47,540 --> 00:25:52,000 But the problem is that they were outcoding everything in the JavaScript. 305 00:25:52,000 --> 00:25:55,960 So, generating everything on the build and putting this in the JavaScript. 306 00:25:56,100 --> 00:26:02,380 And so, they actually told us that they were using a secret that was a passphrase. 307 00:26:02,440 --> 00:26:05,280 And it was also outcoded inside the codebase. 308 00:26:05,280 --> 00:26:08,040 So, they awarded $1,000 for that. 309 00:26:08,180 --> 00:26:09,560 But that was a fun one. 310 00:26:09,560 --> 00:26:11,520 But nothing related to DOS. 311 00:26:11,900 --> 00:26:13,660 But there is something interesting. 312 00:26:13,820 --> 00:26:19,580 How they can sign the body and put the signature inside the body. 313 00:26:19,580 --> 00:26:25,520 This means that there is something in the GraphQL that is not being checked correctly, right? 314 00:26:25,520 --> 00:26:28,120 That is not inside the signature. 315 00:26:28,120 --> 00:26:31,420 And normally, it's just the signature itself. 316 00:26:31,420 --> 00:26:35,820 So, this means that we can add as many signatures as possible. 317 00:26:35,820 --> 00:26:41,940 And every time we had a signature, they were running the check of the entire body all over again. 318 00:26:42,400 --> 00:26:49,600 So, we wrote a script where we will add 10 directives, 500, 1,000, up to a million. 319 00:26:49,600 --> 00:26:52,880 And check the request every time. 320 00:26:52,900 --> 00:26:54,240 What happened? 321 00:26:54,240 --> 00:26:58,800 The first 10 directives, 0.9 seconds to answer. 322 00:26:58,800 --> 00:27:00,960 500 directives, one second. 323 00:27:01,100 --> 00:27:04,200 We had 5,000 directives, 2.7. 324 00:27:04,200 --> 00:27:05,440 10,000, 2.6. 325 00:27:05,440 --> 00:27:06,980 Don't know what happened here. 326 00:27:07,500 --> 00:27:13,180 50,000, 6.5, and then up to 1,109,000 seconds. 327 00:27:13,180 --> 00:27:18,280 So, we had 1 minute 40 per request, which is huge. 328 00:27:19,340 --> 00:27:25,500 This was found with Rezo and Google gave us a 6K for that. 329 00:27:25,500 --> 00:27:34,420 And I think that compared to the presence in the world, the impact is really high for that kind of stuff. 330 00:27:34,420 --> 00:27:40,520 And overall, for all the GraphQL DOS that we did in the back... oh, sorry. 331 00:27:40,760 --> 00:27:41,720 Pro tips. 332 00:27:41,860 --> 00:27:43,440 Yeah, this one is important. 333 00:27:44,120 --> 00:27:49,400 GraphQL exposes WebSockets, depending on the configuration and on the backend. 334 00:27:49,860 --> 00:27:58,140 But this WebSocket server usually do not have any WAF or any check, and people often forget that it exists. 335 00:27:58,140 --> 00:28:06,800 So, if you have rate limiting in place and you want to exploit any GraphQL DOS, you can just go to the WebSocket and there is no security anymore. 336 00:28:06,800 --> 00:28:18,440 And if you like actually GraphQL hunting, if you go to the WebSocket, you can also have introspection and other GraphQL configurations. 337 00:28:18,440 --> 00:28:21,740 So, it might actually give you a lot more attack surface. 338 00:28:21,740 --> 00:28:23,840 So, that's another GraphQL pro tip. 339 00:28:23,840 --> 00:28:29,960 And overall, with all the GraphQL services, we made 70K bounty. 340 00:28:30,180 --> 00:28:35,740 So, every time you see GraphQL, just say to yourself, we can take it down. 341 00:28:37,080 --> 00:28:37,800 Okay. 342 00:28:37,800 --> 00:28:42,900 I had to rush a little bit this presentation because we were having this HTML problem. 343 00:28:42,900 --> 00:28:45,020 So, let's go to the conclusion. 344 00:28:45,020 --> 00:28:50,020 Let's talk about the timeline of this entire dinner of service research. 345 00:28:50,020 --> 00:28:55,440 The first dinner of service that we found with Snorlax was in 2022. 346 00:28:56,140 --> 00:28:59,020 And the last one that we found was last week. 347 00:28:59,020 --> 00:29:05,920 But the main focus of the entire research was doing eight months last year. 348 00:29:05,920 --> 00:29:09,720 So, most of the bounties were made in a span of eight months. 349 00:29:10,460 --> 00:29:15,600 And so, how much bounty overall we made with this entire research? 350 00:29:16,840 --> 00:29:24,280 We made almost $150,000 in bounty, which is a lot. 351 00:29:24,280 --> 00:29:27,720 I would say for a technique that is out of scope. 352 00:29:27,720 --> 00:29:41,120 And something that is actually quite interesting is that I think that this could be a main vulnerability for a lot of bug hunters, but I would say it's better to use it as a side golden goose. 353 00:29:41,120 --> 00:29:51,900 So, for instance, if you like to find a lot of vulnerabilities and then at one point you have no ideas anymore, just look for a DOS, you'll find one, send it, make a quick bug out of it. 354 00:29:51,900 --> 00:29:54,280 I think it's a good way to do it. 355 00:29:54,980 --> 00:30:01,080 Before finishing this presentation, I needed to do a huge shoutout to Idnama. 356 00:30:01,080 --> 00:30:03,600 She's our graphical designer. 357 00:30:03,600 --> 00:30:10,480 When I asked her, hey, can you do this entire presentation for DEF CON, she was like, what do you want me to do again? 358 00:30:10,480 --> 00:30:13,380 2,000 memes, a lot of reference, a lot of things. 359 00:30:13,380 --> 00:30:15,220 I think she did an amazing job. 360 00:30:15,220 --> 00:30:17,560 So, huge shoutout to her. 361 00:30:18,280 --> 00:30:21,280 Thanks a lot, everyone, for attending this presentation. 362 00:30:21,280 --> 00:30:22,880 I hope you liked it. 363 00:30:22,880 --> 00:30:27,940 And if you have any questions later, I will be happy to answer them.