1 00:00:08,360 --> 00:00:13,140 Hi everyone, thank you for attending our talk, 000 Day. 2 00:00:13,180 --> 00:00:21,520 I don't know if you've heard or saw the news, it got a little bit of coverage, but this is the first time that we're actually disclosing the technical details. 3 00:00:21,620 --> 00:00:25,680 It's going to be fun, it's going to be risky, and let's start. 4 00:00:25,680 --> 00:00:29,660 So, I'm Gal, I'm the co-founder and CTO of Oligo Security. 5 00:00:29,660 --> 00:00:32,860 With me is Avi, our number one ninja. 6 00:00:32,860 --> 00:00:37,660 And really quickly about ourselves, before we start and begin. 7 00:00:39,580 --> 00:00:44,940 Hi, I'm Avi, I'm an AI security researcher in the city office of Oligo. 8 00:00:44,980 --> 00:00:51,760 I have around 10 years of experience in research and development, mostly researching AI these days. 9 00:00:51,760 --> 00:00:57,020 And I love to climb mountains, so if you want to join me on the trip, let me know. 10 00:00:57,500 --> 00:01:00,040 And with me is my awesome CTO. 11 00:01:00,560 --> 00:01:06,440 Thank you, Avi, I'm paying you to say good things about me, so keep up with that. 12 00:01:06,440 --> 00:01:13,320 So, I'm the founder and CTO of Oligo, I have 10 years of experience, checkpoint, hacking, breaking stuff, since I remember myself. 13 00:01:13,460 --> 00:01:22,620 And not like Avi, I'm famous for being handsome or thinking like that, and I'm really good at looking at mountains in my Windows computer. 14 00:01:22,820 --> 00:01:38,860 So, a quick agenda, what we're going to discuss today, what is the concept of port scanning and how it all started from 18 years ago, a very old issue that just keeps on recurring and recurring along the years, and we're going to deep dive into the history. 15 00:01:38,860 --> 00:01:52,460 What is the actual private network access, this try to do a standout when all of the browsers should be using, but we'll see along the years what actually happened. 16 00:01:52,460 --> 00:02:09,360 And then we're going to deep dive into the actual details of the 0000 day internals itself, and then we're going to demonstrate how we're leveraging that in order to RCE private internal applications that today are considered private. 17 00:02:09,360 --> 00:02:21,280 And in the end, we're going to really deep dive into how each and every browser actually was dealing with that and the responsible disclosure and where we are right now with that. 18 00:02:21,280 --> 00:02:29,360 So in order to really start, I'm going to pass it on to Awesome Avi, because he's the actual smart guy that did all of that. 19 00:02:29,440 --> 00:02:31,420 And let's start. 20 00:02:33,140 --> 00:02:35,240 Amazing, so thank you. 21 00:02:36,100 --> 00:02:38,180 So client port scanning. 22 00:02:38,240 --> 00:02:41,200 Who remembers this headline on Hacker News? 23 00:02:41,840 --> 00:02:44,840 Yeah, so why is this website port scanning me? 24 00:02:45,260 --> 00:02:47,080 Very good question. 25 00:02:47,080 --> 00:02:55,040 Apparently eBay, not some script kiddie but a real company, tried to port scan their visitors as soon as they visit the website. 26 00:02:55,300 --> 00:02:58,700 So how did they do it exactly? 27 00:02:58,720 --> 00:03:06,560 And by the way, you will get this recording and we will share the presentation with you, so please try to be concentrated on the presentation. 28 00:03:07,740 --> 00:03:14,460 Basically what they did is they used Glocalhost and they checked many types of ports. 29 00:03:14,460 --> 00:03:23,160 I don't know if it's for monetization, for fingerprinting or for security reasons, but we really don't care because it should never happen, right? 30 00:03:23,160 --> 00:03:27,780 Browsers should not communicate with Glocalhost if they're under a .com domain. 31 00:03:27,820 --> 00:03:30,180 It's that simple, in my opinion at least. 32 00:03:30,720 --> 00:03:40,100 So this is exactly what private network access, and I'll simply use PNA, and this is what it tries to solve at the end of the day. 33 00:03:40,100 --> 00:03:47,360 So we have this notion of differentiating three distinctive networks. 34 00:03:47,480 --> 00:03:58,800 The public network, which is the internet as we refer to the internet, which is a top-level domain like a .com, everything that's on the public internet. 35 00:03:58,900 --> 00:04:05,800 Then there is the private network, which is the office, home network that we're connected to. 36 00:04:05,860 --> 00:04:09,600 And finally there is the local device, so it is Glocalhost. 37 00:04:09,600 --> 00:04:12,440 This figure is taken from Google's blog about PNA. 38 00:04:12,440 --> 00:04:14,020 You should go read about it. 39 00:04:14,020 --> 00:04:20,220 It's a really great initiative, and we'll understand why we need it these days more than ever. 40 00:04:21,140 --> 00:04:24,740 Now, there are many ways to run a server, right? 41 00:04:24,740 --> 00:04:32,940 We have the default, we have 0.0.0.0, or we simply have the Glocalhost bind address. 42 00:04:33,020 --> 00:04:38,340 So they actually result in different behaviors, but I'm going to focus on the last two. 43 00:04:38,340 --> 00:04:49,300 So whenever I'm referring to a local service, I'm referring to the last two figures, which are the 100.7.0.0.1, or literally the Glocalhost string. 44 00:04:49,300 --> 00:04:57,420 So we have a service that listens on the machine's local network, the Lubec interface, and that's it. 45 00:04:57,420 --> 00:04:59,840 Basically, we have many ways of running a server. 46 00:05:00,400 --> 00:05:12,100 And to understand how we found everything, so let's jump back 18 years ago to understand why PNA is needed and why it was so hard to solve to this day. 47 00:05:12,900 --> 00:05:15,980 So it all begins with a lack of standardization. 48 00:05:15,980 --> 00:05:20,460 There is no real standard to follow, at least 18 years ago. 49 00:05:20,500 --> 00:05:23,840 There was no HTTPS, like simply HTTP. 50 00:05:24,520 --> 00:05:36,180 And this guy posted on Mozilla's forum on their security program the following headline that says that websites are trying to attack my router. 51 00:05:36,500 --> 00:05:41,280 It's really weird, like as soon as I'm visiting the website, they try to attack my router. 52 00:05:41,560 --> 00:05:45,080 And it's been happening for the last 18 years. 53 00:05:45,260 --> 00:05:48,400 It's still open, as you can see, the issue is still open. 54 00:05:48,400 --> 00:05:52,540 It is being updated, but without the ability to comment or anything, it's still there. 55 00:05:53,760 --> 00:06:00,520 The idea is that the RFC should not, like, it claims that it should not behave this way. 56 00:06:00,560 --> 00:06:06,900 And for some reason, browsers are being able to pass and dispatch HTTP requests to the local network. 57 00:06:07,320 --> 00:06:11,400 And after a while, it says that it's being actively exploited in the wild. 58 00:06:11,400 --> 00:06:13,940 Some of you might also remember that. 59 00:06:14,600 --> 00:06:19,600 Real attacks, like targeting home routers, this is how they did it. 60 00:06:19,600 --> 00:06:23,460 It's called drive-by-farming, great publication by Synopsys. 61 00:06:23,460 --> 00:06:27,560 And the ability to load the script as soon as the website loads. 62 00:06:27,880 --> 00:06:31,980 So this might sound really odd to you, like, this should never work today, right? 63 00:06:31,980 --> 00:06:37,240 But 18 years ago, routers did not have HTTPS or self-signed certificates. 64 00:06:37,760 --> 00:06:44,840 And the first figure, actually, would alter the DNS server of your home network using a simple HTTP request. 65 00:06:45,400 --> 00:06:47,040 And it simply worked. 66 00:06:47,040 --> 00:06:58,620 And not only it worked, it affected, like, thousands of, hundreds of thousands of home and office routers in large-scale attacks that targeted localhost. 67 00:06:58,620 --> 00:07:06,640 And at the end of the day, you can see that all of those are using localhost or, like, internal interfaces. 68 00:07:08,860 --> 00:07:15,880 And then Firefox tried to come up with a list of IPs. 69 00:07:15,880 --> 00:07:21,460 IP segments and address spaces that are considered private. 70 00:07:21,620 --> 00:07:23,360 It makes a lot of sense, right? 71 00:07:23,360 --> 00:07:25,800 Now, do you notice something weird on this list? 72 00:07:28,060 --> 00:07:34,320 So we'll get to that in a second, but someone mentioned that it's not Firefox-specific bug. 73 00:07:34,320 --> 00:07:35,520 And he's probably right. 74 00:07:35,520 --> 00:07:38,780 But he mentioned that it's not a vulnerability or an issue. 75 00:07:38,780 --> 00:07:41,860 It's maybe a security enhancement and nothing more than that. 76 00:07:41,860 --> 00:07:46,740 And then they understood that they also forgot 0.0.0.0. 77 00:07:47,260 --> 00:07:54,160 And sadly, they added it, but nothing happened since that day. 78 00:07:54,160 --> 00:08:00,560 So we're jumping back to eight years ago when Google started with a course, cross-origin resource sharing. 79 00:08:00,560 --> 00:08:09,200 It's actually defining how websites should behave and how browsers should act when requesting resources from other domains. 80 00:08:09,940 --> 00:08:23,100 And Google started this initiative to try to define the behavior of how browsers should or should not dispatch requests to these private network addresses. 81 00:08:23,500 --> 00:08:27,460 So PNA is a standard that is still under ideation. 82 00:08:27,460 --> 00:08:29,500 It's not finalized yet. 83 00:08:30,040 --> 00:08:34,700 It's being led by Google, and as you can see, it's a draft community report. 84 00:08:34,700 --> 00:08:44,660 And therefore, Firefox is waiting for this standard and targets it as depends-on-private-network-access, which is still not implemented in Firefox. 85 00:08:45,340 --> 00:08:52,380 And basically, they wait for Chrome and the Chromium team to define the standard, make it stable in Chrome. 86 00:08:52,380 --> 00:08:56,500 And only then they will adopt it to Firefox following a certain standard. 87 00:08:56,500 --> 00:09:01,400 But they don't want to do it randomly or trusting on some gut feeling. 88 00:09:01,400 --> 00:09:03,340 They want to implement a real standard. 89 00:09:04,220 --> 00:09:08,100 Now, let's understand what is still allowed. 90 00:09:09,100 --> 00:09:11,120 So they started PNA. 91 00:09:11,120 --> 00:09:12,840 It took a long time to roll. 92 00:09:12,840 --> 00:09:16,280 It's still not a mainstream component in Chrome. 93 00:09:16,400 --> 00:09:22,740 It should have been available until Chrome 126. 94 00:09:22,740 --> 00:09:25,700 But it got delayed several times. 95 00:09:26,520 --> 00:09:32,180 And they even had to revert it at some point because they broke a lot of websites. 96 00:09:32,180 --> 00:09:34,180 But their aim is very clear. 97 00:09:34,180 --> 00:09:39,880 They want to mitigate CSRF attacks and DNS rebinding attacks to local addresses. 98 00:09:41,660 --> 00:09:46,260 Now, they still have not decided how to treat 0.0.0.0. 99 00:09:46,560 --> 00:09:48,180 This is the standard, by the way. 100 00:09:48,180 --> 00:09:48,620 It's on GitHub. 101 00:09:48,620 --> 00:09:49,780 You can look it up. 102 00:09:51,060 --> 00:09:55,460 And they had to roll back some changes, as I said. 103 00:09:55,460 --> 00:10:05,260 You can see that between some Chrome versions, they had to revert and then apply it back because many websites simply break within a night. 104 00:10:05,260 --> 00:10:11,860 So the next time they did it, Google, they did it gradually and very carefully. 105 00:10:13,200 --> 00:10:18,300 And as I said, they had to make some exceptions to 0.0.0.0. 106 00:10:18,320 --> 00:10:27,240 So even although it was in defiance of specs, it was not a part of the RFC, developers must have wanted it and requested this behavior. 107 00:10:27,680 --> 00:10:32,060 So as you can see, it's in defiance of specs, but seemingly common. 108 00:10:32,940 --> 00:10:36,120 But what is this weird IP address anyway? 109 00:10:36,120 --> 00:10:41,140 So if I'll ask two different people in this room, I'll probably hear two different answers. 110 00:10:41,280 --> 00:10:43,780 And as you can see, it can have multiple uses. 111 00:10:45,200 --> 00:10:49,940 So typically, it simply means this host on this network. 112 00:10:51,200 --> 00:10:55,720 It should never be used as a destination IP address, according to the RFC. 113 00:10:55,820 --> 00:10:56,880 You'll see it in a bit. 114 00:10:56,880 --> 00:11:05,360 But a real use case of 0.0.0.0 is when we're doing a DHCP handshake and we still don't have an IP address. 115 00:11:05,720 --> 00:11:11,420 And before the dynamic allocation, we want to identify ourselves somehow, so we have to use some IP. 116 00:11:11,500 --> 00:11:18,980 But this is really the only use as an IP address, like handshakes and stuff like this, before you have a dynamically allocated IP. 117 00:11:20,640 --> 00:11:25,840 And as I said, it should not be used as a target IP anywhere. 118 00:11:26,180 --> 00:11:33,220 And by the way, Windows, I know we all have given them a hard time, but they were actually blocking it at the operating system level. 119 00:11:33,220 --> 00:11:36,600 This is why it affects only macOS and Linux. 120 00:11:37,220 --> 00:11:44,360 But this is basically a misunderstanding of the RFC or some non-correlative behavior. 121 00:11:45,180 --> 00:11:52,320 So Chromium decided to add counters to Chrome to understand how many websites use this IP address. 122 00:11:52,720 --> 00:11:58,560 So it was relatively small at first place, but we've seen it increasing with time. 123 00:11:59,680 --> 00:12:07,140 This is the percent of pages that use 0.0.0.0 in AJAX or other mechanisms. 124 00:12:07,340 --> 00:12:18,780 And basically, you can see that it's on the rise, maybe ten times, doubled itself ten times in under two years, or slightly more than two years. 125 00:12:18,780 --> 00:12:22,240 But it is on the rise, and it should concern us all. 126 00:12:22,680 --> 00:12:28,080 So this is the really interesting part of the presentation. 127 00:12:28,420 --> 00:12:30,260 All of these are blocked. 128 00:12:30,260 --> 00:12:38,080 Private network access tries to prevent us from accessing these domains where we have a .com domain. 129 00:12:38,760 --> 00:12:47,340 But when we use 0.0.0.0, we manage to bypass all of those restrictions and access localhost and lubec. 130 00:12:47,340 --> 00:12:49,480 So it's that simple. 131 00:12:49,480 --> 00:12:52,600 It should be hard. 132 00:12:52,600 --> 00:12:57,420 It should be terminated in the request level before it is being dispatched. 133 00:12:57,420 --> 00:13:01,940 But we can access localhost and 107.0.0.1. 134 00:13:02,860 --> 00:13:20,220 Now, everything that is HTTP that runs on these services, including port forwarding to Kubernetes, like some of us are developers, including myself, we all use HTTP port forwarding when working with remote pods and stuff like that, including operating system services, 135 00:13:20,220 --> 00:13:24,040 so everything that runs on localhost on your machine is accessible. 136 00:13:24,220 --> 00:13:29,000 There are plenty of default or non-default developer tools that use localhost. 137 00:13:29,000 --> 00:13:45,240 And it also enables us to use the VPN, literally every network interface that is connected to the machine, which was used in the past for DNS rebinding to localhost, so you can use 0.0.0.0 instead of localhost, and DNS rebinding would still work. 138 00:13:45,240 --> 00:13:46,480 We'll see it in a bit. 139 00:13:47,420 --> 00:13:59,480 So to target it, we wanted to see how it behaves and whether it's really possible, so we've built a port scanner written in WebAssembly, but it uses JavaScript API, so it doesn't really matter. 140 00:13:59,640 --> 00:14:10,280 And the idea is that it was able to see the open ports on my machine just by the error code that the browser returns to the JavaScript context. 141 00:14:10,280 --> 00:14:13,280 So if it's a connection refused, you know nothing is there. 142 00:14:13,280 --> 00:14:16,220 If there's an error, you know something is listening. 143 00:14:16,240 --> 00:14:17,620 It's very simple. 144 00:14:18,780 --> 00:14:27,640 And we use 0.0.0.0, but you can see in the sniffing with the wire shark that it's being redirected to localhost. 145 00:14:28,220 --> 00:14:31,940 And here's the DNS rebinding notion. 146 00:14:31,940 --> 00:14:50,300 So you have a subdomain that is being mapped to 0.0.0.0, so we've seen a lot of attacks in the history that used 127.0.0.1, but it is possible once again using 0.0.0.0. 147 00:14:52,560 --> 00:14:55,280 Now, this gets me to ShadowRay. 148 00:14:55,280 --> 00:14:58,620 This is the real reason we started with this research. 149 00:14:58,620 --> 00:15:15,440 So after we've published ShadowRay, which was an attack campaign in the wild targeting AI workloads in a lot of big companies, it leverages a default behavior in Ray, if any of you know it. 150 00:15:15,740 --> 00:15:17,960 Ray is like Kubernetes for AI. 151 00:15:17,960 --> 00:15:21,980 So it enables you to scale and run Python applications. 152 00:15:21,980 --> 00:15:24,620 I'm an early developer and a doctor myself. 153 00:15:24,620 --> 00:15:26,800 I really love it. 154 00:15:26,840 --> 00:15:32,080 And even OpenAI say out loud that they use it to train CGPT and their biggest models. 155 00:15:33,540 --> 00:15:46,780 So in late 2023, we've seen this report by AnyScale, the developers and maintainers of Ray, and we've seen four CVEs that were taken care of and one disputed CVE, which is very, very interesting. 156 00:15:46,780 --> 00:15:57,700 It simply discusses the ability of Ray to run arbitrary code because it's like an inherited part of Ray. 157 00:15:57,700 --> 00:15:59,640 It is a desired capability. 158 00:15:59,640 --> 00:16:05,220 It must have this capability to function because it's a job running library. 159 00:16:06,060 --> 00:16:15,940 And therefore, they disputed the vulnerability that enables remote code execution because it's necessary and it's kind of by design, the way Ray is designed. 160 00:16:15,940 --> 00:16:22,600 And Attacker leveraged it to run arbitrary code on clusters that are exposed to the Internet. 161 00:16:23,240 --> 00:16:26,260 It got amazing coverage as well. 162 00:16:26,260 --> 00:16:27,820 It was on Forbes. 163 00:16:27,820 --> 00:16:30,560 And we asked ourselves the following question. 164 00:16:30,560 --> 00:16:34,020 We know that Ray lacks authorization and authentication. 165 00:16:34,300 --> 00:16:39,080 We know that it is usually running on local hosts when developers use it. 166 00:16:39,080 --> 00:16:53,860 And we try to understand whether our browser can load an external public website, which then can communicate with this local Ray cluster or service that is running locally on local host. 167 00:16:55,020 --> 00:17:01,720 So we need to install Ray and have it running in the default constellation, no special flags or anything. 168 00:17:01,720 --> 00:17:10,360 Then we have to visit the website and the website will invoke a post HTTP request to the API, triggering remote code execution. 169 00:17:10,760 --> 00:17:12,980 And get this. 170 00:17:12,980 --> 00:17:14,700 You only need to dispatch the request. 171 00:17:14,700 --> 00:17:15,980 We don't care about the response. 172 00:17:15,980 --> 00:17:20,480 And this is the whole idea of private network access. 173 00:17:20,720 --> 00:17:34,320 So, of course, the cross-origin resource sharing was dealing mostly with which headers the response has and whether should I propagate it to the current context of JavaScript and load it under the current domain. 174 00:17:34,320 --> 00:17:38,460 But we're really emphasizing the ability to dispatch requests. 175 00:17:38,460 --> 00:17:42,540 And a single HTTP request is enough to trigger remote code execution. 176 00:17:43,640 --> 00:17:47,180 Also important to mention that it's not limited to Ray. 177 00:17:47,180 --> 00:17:48,280 It's only one use case. 178 00:17:48,280 --> 00:17:52,320 We've seen many remote code execution vulnerabilities on local host. 179 00:17:52,320 --> 00:17:56,660 But for the sake of time, we're only showing this on the presentation. 180 00:17:56,880 --> 00:17:58,960 But there is the full blog at the end. 181 00:17:59,080 --> 00:18:01,320 So I have a phishing email. 182 00:18:01,320 --> 00:18:03,400 Not the most successful one. 183 00:18:03,400 --> 00:18:07,320 But I'm clicking here and being redirected to this website. 184 00:18:07,980 --> 00:18:12,460 Now, this is the JavaScript that targets the remote code execution. 185 00:18:12,460 --> 00:18:14,560 You can see that there's a net cut. 186 00:18:15,800 --> 00:18:20,840 Socket that is being opened to a remote server, which is the attacker-controlled server. 187 00:18:21,060 --> 00:18:28,560 It is being used with mode no calls, which sends the request and will simply return an opaque response. 188 00:18:28,560 --> 00:18:30,620 So I cannot see the response. 189 00:18:30,620 --> 00:18:32,280 But as we said, we don't really care. 190 00:18:32,280 --> 00:18:35,580 We just want to send it and trigger remote code execution. 191 00:18:36,500 --> 00:18:39,080 And finally, we get a response. 192 00:18:39,080 --> 00:18:40,320 It looks like an error. 193 00:18:40,320 --> 00:18:42,600 But you can see that it's 200 okay. 194 00:18:43,220 --> 00:18:45,880 So apparently the job really ran. 195 00:18:45,980 --> 00:18:48,840 And you'll see it in a second. 196 00:18:48,840 --> 00:18:50,560 But this is all it takes. 197 00:18:50,960 --> 00:18:54,140 Just one HTTP request to reach the server. 198 00:18:54,140 --> 00:18:55,740 We don't care about the response. 199 00:18:55,740 --> 00:18:57,840 And it's more than enough. 200 00:18:58,460 --> 00:19:08,580 So every time you visit the page, it will trigger this specific payload, which just prints the environment variables and prints exploited to the screen. 201 00:19:08,660 --> 00:19:13,380 But here is a reverse shell that is being opened as soon as I'm clicking on an email. 202 00:19:13,820 --> 00:19:16,040 So on the right, I have Ray running. 203 00:19:16,040 --> 00:19:20,640 I'm importing it and running Ray.init without any special parameters. 204 00:19:20,640 --> 00:19:23,360 This is how developers usually use Ray. 205 00:19:23,360 --> 00:19:26,300 And you can see that it binds on localhost. 206 00:19:28,260 --> 00:19:30,360 There is a Ray's dashboard. 207 00:19:30,380 --> 00:19:33,660 And it should reflect the jobs that are currently running. 208 00:19:34,360 --> 00:19:38,380 Now, on the left, I'll open a socket. 209 00:19:39,400 --> 00:19:46,340 And listen for connection on the certain port that matches the payload of the attack. 210 00:19:47,520 --> 00:19:59,880 Now, as soon as I'm clicking on this link, you can see that a reverse shell is opened to the left terminal, which gives me access to the local machine from VPS somewhere on the Internet. 211 00:20:00,880 --> 00:20:03,660 You can see that the Netcat is really running in Ray. 212 00:20:03,760 --> 00:20:09,640 And I use it to run arbitrary commands on my personal computer. 213 00:20:11,460 --> 00:20:12,920 And that's it, basically. 214 00:20:12,920 --> 00:20:14,700 It got a lot of coverage. 215 00:20:14,700 --> 00:20:17,240 So remote execution with a single click. 216 00:20:17,400 --> 00:20:19,260 And as I said, it's not limited to Ray. 217 00:20:20,580 --> 00:20:24,000 But it got a lot of coverage. 218 00:20:24,120 --> 00:20:25,460 And for a reason. 219 00:20:26,120 --> 00:20:29,860 Now, we did a responsible disclosure with the browsers. 220 00:20:30,200 --> 00:20:33,360 And they had to introduce breaking changes. 221 00:20:33,360 --> 00:20:35,460 Some of them are doing it more gradually. 222 00:20:35,560 --> 00:20:41,680 But the idea is that we've actually managed to coordinate all the browsers together. 223 00:20:41,680 --> 00:20:47,020 So they will not zero day each other by releasing a fix ahead of others. 224 00:20:47,920 --> 00:20:50,260 Here's the proof on each of the browsers. 225 00:20:50,520 --> 00:20:54,880 So the same payload can be used in each and every one of them. 226 00:20:58,540 --> 00:21:00,120 And let's begin with Safari. 227 00:21:00,120 --> 00:21:02,500 So Safari did an amazing job. 228 00:21:02,500 --> 00:21:03,980 All of them did an amazing job. 229 00:21:03,980 --> 00:21:10,900 But Safari simply mitigated it in the browser level before PNA is actually implemented in Safari. 230 00:21:11,900 --> 00:21:13,980 You all know WebKit, I guess. 231 00:21:13,980 --> 00:21:17,140 So WebKit is open source that Safari is based on. 232 00:21:17,140 --> 00:21:19,120 And they changed 23 files. 233 00:21:19,120 --> 00:21:20,780 They added a lot of tests. 234 00:21:20,780 --> 00:21:25,020 And they did an amazing job on blocking it in Safari's level. 235 00:21:25,020 --> 00:21:26,580 But not limited to Safari. 236 00:21:26,580 --> 00:21:31,360 But actually every WebView on watchOS or iPad, it doesn't matter. 237 00:21:31,360 --> 00:21:32,700 It's all WebKit based. 238 00:21:32,700 --> 00:21:34,880 So they did a really amazing patch here. 239 00:21:34,880 --> 00:21:36,160 And great job. 240 00:21:36,920 --> 00:21:42,440 And you can see that they literally checked that the address contains only zeros. 241 00:21:42,440 --> 00:21:43,760 They have this property. 242 00:21:43,760 --> 00:21:49,040 So sorry, but we added like an if clause on every HTTP request in the world. 243 00:21:49,280 --> 00:21:52,320 Not proud of it, but it's the way it is. 244 00:21:52,820 --> 00:21:54,960 And there's Chromium. 245 00:21:55,160 --> 00:21:59,220 Chromium, as I said, they are the leaders of private network access. 246 00:22:00,320 --> 00:22:07,440 So they proposed a long time ago, even when it's only started, to add these headers to the backend services. 247 00:22:08,300 --> 00:22:14,320 And later on, these headers can be used in the server level to mitigate those attacks. 248 00:22:14,320 --> 00:22:22,880 But they decided to deprecate 000 before private network access completely rolls out to the browser. 249 00:22:22,920 --> 00:22:24,460 And there's even our report here. 250 00:22:24,460 --> 00:22:28,100 And they literally say that it can be used for DNS rebinding attacks. 251 00:22:28,200 --> 00:22:33,820 And PNA protection can be bypassed using this special IP address on macOS and Linux. 252 00:22:33,860 --> 00:22:36,040 And it should never be used in practice. 253 00:22:36,040 --> 00:22:38,160 It should never be used. 254 00:22:39,160 --> 00:22:49,320 And as I said, they added the counters and they say out loud that malware leverages this attack to specific developer toolkits. 255 00:22:49,460 --> 00:22:51,120 And again, our bug. 256 00:22:53,060 --> 00:22:54,300 And there's Firefox. 257 00:22:54,300 --> 00:22:56,660 Firefox also did an amazing job. 258 00:22:57,040 --> 00:23:01,440 They don't add PNA right away because it's not standardized yet. 259 00:23:01,440 --> 00:23:02,440 It's not ready. 260 00:23:02,440 --> 00:23:06,600 But when it will be, they're definitely positive towards adding PNA. 261 00:23:06,620 --> 00:23:10,100 And they did block it in fetch level. 262 00:23:10,100 --> 00:23:12,020 Like, who knows fetch in JavaScript? 263 00:23:12,020 --> 00:23:14,500 It's the way to do HTTP requests. 264 00:23:14,640 --> 00:23:16,960 They literally changed the RFC. 265 00:23:17,460 --> 00:23:23,300 And they proposed to block 000 whenever a target IP is 000. 266 00:23:23,300 --> 00:23:27,640 Simply drop the HTTP request. 267 00:23:27,660 --> 00:23:30,920 And then browsers will have to comply with a new fetch standard. 268 00:23:30,920 --> 00:23:32,400 And this is the way things work. 269 00:23:33,700 --> 00:23:35,660 Now, what can we expect? 270 00:23:36,240 --> 00:23:43,520 So, I expect that many open source maintainers and developers will add PNA headers to their services. 271 00:23:43,520 --> 00:23:46,740 So, they won't be attacked from this attack vector. 272 00:23:47,140 --> 00:23:50,400 Eventually, this IP address will be blocked in all browsers. 273 00:23:51,040 --> 00:23:57,320 And I think that now people, at least I hope, will treat localhost as not really local anymore. 274 00:23:57,320 --> 00:24:01,840 We can make these assumptions of being executed in a trusted environment. 275 00:24:01,840 --> 00:24:09,000 Because as we've seen, a browser can have routing capabilities and can reach our localhost interfaces. 276 00:24:09,280 --> 00:24:15,320 So, HTTPS, core, CSRF tokens, authorization, all of those are a must also in local projects. 277 00:24:15,320 --> 00:24:17,080 So, please don't make those assumptions. 278 00:24:18,340 --> 00:24:19,720 Now, we're almost done. 279 00:24:19,720 --> 00:24:21,480 But a cool thing I wanted to share. 280 00:24:21,480 --> 00:24:25,240 So, you know these port scanners online that scan certain websites? 281 00:24:25,240 --> 00:24:29,920 So, if you use, like, loopback or localhost, it will fail. 282 00:24:29,920 --> 00:24:33,960 But you can make them port scan themselves using 0.0.0.0. 283 00:24:36,040 --> 00:24:36,840 Yeah. 284 00:24:36,840 --> 00:24:39,300 Many people forget about this special IP, as we said. 285 00:24:39,300 --> 00:24:41,760 A lot of different use cases. 286 00:24:42,920 --> 00:24:44,980 And that's it, basically. 287 00:24:45,640 --> 00:24:48,980 And it gets me to the conclusion, which I'll hand back to Gal. 288 00:24:48,980 --> 00:24:50,660 And thank you so far. 289 00:24:54,050 --> 00:24:55,630 He deserves it. 290 00:24:58,830 --> 00:25:00,590 So, let's conclude what we see. 291 00:25:00,590 --> 00:25:03,510 First of all, Avi is awesome, right? 292 00:25:03,690 --> 00:25:09,610 He's breaking the browsers, making them actually talk to each other, and start to actually build the standard. 293 00:25:09,610 --> 00:25:22,170 We saw how an 18-year-old bug that people thought is actually already over, DNS rebinding, stuff that we all thought are actually, like, dead already, are actually being actively used. 294 00:25:22,170 --> 00:25:25,010 I don't know if you saw this 100,000 website. 295 00:25:25,010 --> 00:25:28,990 I can tell you, honestly, that probably 100% of them are malicious. 296 00:25:29,370 --> 00:25:46,010 And this whole concept that we've been trying to do for years, and, like, calls and all of those mitigations, in the end, by a simple, super logical bug that just enables everything once again, we can see that those attacks will keep on occurring. 297 00:25:46,010 --> 00:25:50,830 And this is why we think this is a subject that needs to be called out. 298 00:25:50,830 --> 00:26:01,470 People should be aware that no matter if they do have a WAF or a firewall of a false sense of safety, that our application is actually secured behind a private network. 299 00:26:01,470 --> 00:26:07,070 This is where we come and show, look, attackers are also looking for those type of things. 300 00:26:07,070 --> 00:26:12,430 They are really enjoying from the fact that there isn't one standard, and it can be abused. 301 00:26:12,510 --> 00:26:26,570 And this is why we will keep seeing those stuff again, and why we should all, as a community, really look for other ways and other mitigations on the application itself, not trusting the old ways that we saw. 302 00:26:27,110 --> 00:26:38,210 And, of course, we're going to have some Q&A, but, again, feel free to reach out on whatever, like, Twitter, whatever, Elon will call it tomorrow morning. 303 00:26:38,250 --> 00:26:43,070 We would love to answer anything you might have. 304 00:26:43,070 --> 00:26:46,010 And, again, this is just one example. 305 00:26:46,070 --> 00:26:55,830 And you've seen how big companies abused it for financial reasons, or attackers have been leveraging that to hack internal networks. 306 00:26:55,830 --> 00:27:05,890 But the whole concept of just one packet that can hack any internal application, it's a really risky thing, and this is why we are here to really mention it out. 307 00:27:05,890 --> 00:27:09,710 So, again, thank you very much, everyone, for attending this talk. 308 00:27:09,710 --> 00:27:11,790 We will share everything online. 309 00:27:11,790 --> 00:27:14,490 And, again, happy DEF CON. 310 00:27:14,490 --> 00:27:15,390 Thank you, everyone.