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