Hello, everyone. Hi, everyone. Thank you for attending our talk, 0000 Day. 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. It's going to be fun. It's going to be risky. And let's start. So, I'm Gal. I'm the co-founder and CTO of Oligo Security. With me is Avi, our number one ninja. And really quickly about ourselves before we start and begin. Hi, I'm Avi. I'm an AI security researcher in the city office of Oligo. I have around 10 years of experience in research and development, mostly researching AI these days. And I love to climb mountains, so if you want to join me on the trip, let me know. And with me is my awesome CTO. Thank you, Avi. I'm paying you to say good things about me, so keep up with that. So, I'm the founder and CTO of Oligo. I have 10 years of experience, checkpoint hacking, breaking stuff since I remember myself. 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. 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. 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. And then we're going to deep dive into the actual details of the 000 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. 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. 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. And let's start. Amazing. So thank you. So client port scanning, who remembers this headline on Hacker News? So why is this website port scanning me? Very good question. Apparently eBay, not some script kiddie, but a real company, tried to port scan their visitors as soon as they visit the website. So how did they do it exactly? 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. Basically what they did is they used localhost and they checked many types of ports. 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? Browsers should not communicate with localhost if they're under a .com domain. It's that simple, in my opinion at least. 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. So we have this notion of differentiating three distinctive networks. 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. Then there is the private network, which is the office, home network that we're connected to. And finally there is the local device, so it is localhost. This figure is taken from Google's blog about PNA. You should go read about it. It's a really great initiative, and we'll understand why we need it these days more than ever. Now, there are many ways to run a server, right? We have the default, we have 0.0.0.0, or we simply have the localhost bind address. So they actually result in different behaviors, but I'm going to focus on the last two. 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. So we have a service that listens on the machine's local network, the Lubec interface, and that's it. Basically we have many ways of running a server. 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. So it all begins with a lack of standardization. There is no real standard to follow, at least 18 years ago. There was no HTTPS, like simply HTTP. 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. It's really weird, like as soon as I'm visiting the website, they try to attack my router. And it's been happening for the last 18 years. It's still open, as you can see, the issue is still open. It is being updated, but without the ability to comment or anything, it's still there. The idea is that the RFC should not, like, it claims that it should not behave this way. And for some reason, browsers are being able to pass and dispatch HTTP requests to the local network. And after a while, it says that it's being actively exploited in the wild. Some of you might also remember that. Real attacks, like targeting home routers, this is how they did it. It's called drive-by-farming, great publication, by Synopsys. And the ability to load the script as soon as the website loads. So this might sound really odd to you, like, this should never work today, right? But 18 years ago, routers did not have HTTPS or self-signed certificates. And the first figure, actually, would alter the DNS server of your home network using a simple HTTP request. And it simply worked. And not only it worked, it affected hundreds of thousands of home and office routers in large-scale attacks. That targeted localhost. And at the end of the day, you can see that all of those are using localhost or internal interfaces. And then Firefox tried to come up with a list of IPs. IP segments and address spaces that are considered private. It makes a lot of sense, right? Now, do you notice something weird on this list? So, we'll get to that in a second. But someone mentioned that it's not a Firefox-specific bug. And he's probably right. But he mentioned that it's not a vulnerability or an issue. It's maybe a security enhancement and nothing more than that. And then they understood that they also forgot 0.0.0.0. And sadly, they added it, but nothing happened since that day. So, we're jumping back to eight years ago when Google started with the course, cross-origin resource sharing. It's actually defining how websites should behave and how browsers should act when requesting resources from other domains. 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. So, PNA is a standard that is still under ideation. It's not finalized yet. It's being led by Google. And as you can see, it's a draft community report. And therefore, Firefox is waiting for this standard and target it as depends on private network access, which is still not implemented in Firefox. And basically, they wait for Chrome and the Chrome team to define the standard, make it stable in Chrome. And only then they will adopt it to Firefox following a certain standard. But they don't want to do it randomly or trusting on some gut feeling. They want to implement a real standard. Now, let's understand what is still allowed. So, they started PNA. It took a long time to roll. It's still not a mainstream component in Chrome. It should have been available until Chrome 126. But it got delayed several times. And they even had to revert it at some point because they broke a lot of websites. But their aim is very clear. They want to mitigate CSRF attacks and DNS rebinding attacks to local addresses. Now, they still have not decided how to treat 000. This is the standard, by the way. It's on GitHub. You can look it up. And they had to roll back some changes, as I said. 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. So, the next time they did it, Google, they did it gradually and very carefully. And as I said, they had to make some exceptions to 000. 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. So, as you can see, it's in defiance of specs, but seemingly common. But what is this weird IP address anyway? So, if I'll ask two different people in this room, I'll probably hear two different answers. And as you can see, it can have multiple uses. So, typically, it simply means this host on this network. It should never be used as a destination IP address, according to the RFC. 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. And before the dynamic allocation, we want to identify ourselves somehow, so we have to use some IP. But this is really the only use as an IP address during handshakes and stuff like this before you have a dynamically allocated IP. And as I said, it should not be used as a target IP anywhere. 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. This is why it affects only macOS and Linux. But this is basically a misunderstanding of the RFC or some non-correlative behavior. So Chromium decided to add counters to Chrome to understand how many websites use this IP address. So it was relatively small at first place, but we've seen it increasing with time. This is the percent of pages that use 000 in AJAX or other mechanisms. 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. But it is on the rise and it should concern us all. So this is the really interesting part of the presentation. All of these are blocks, right? Private network access tries to prevent us from accessing these domains when we are under a .com domain. But when we use 000, we manage to bypass all of those restrictions and access localhost and lubec. So it's that simple. It should be hard. It should be terminated in the request level before it is being dispatched. But we can access localhost and 107.0.0.1. 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, so everything that runs on localhost on your machine is accessible. There are plenty of default or non-default developer tools that use localhost. 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. We'll see it in a bit. 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. 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. So if it's a connection refused, you know nothing is there. If there is an error, you know something is listening. It's very simple. And we use 000, but you can see in the sniffing with the wire shark that it's being redirected to loopback, to localhost. And here's the DNS rebinding notion. So you have a subdomain that is being mapped to 000. 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. Now, this gets me to ShadowRay. This is the real reason we started with this research. 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. Ray is like Kubernetes for AI. So it enables you to scale and run Python applications. I'm an early developer and a doctor myself. I really love it. And even OpenAI say out loud that they use it to train CGPT and their biggest models. 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. It simply discusses the ability of Ray to run arbitrary code because it's like an inherited part of Ray. It is a desired capability. It must have this capability to function because it's a job running library. 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. And Attacker leveraged it to run arbitrary code on clusters that are exposed to the internet. It got amazing coverage as well. It was on Forbes. And we asked ourselves the following question. We know that Ray lacks authorization and authentication. We know that it is usually running on local hosts when developers use it. 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. So we need to install Ray and have it running in the default constellation. No special flags or anything. Then we have to visit the website and the website will invoke a post HTTP request to the API triggering remote code execution. And get this, you only need to dispatch the request. And this is the whole idea of private network access. 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. But we are really emphasizing the ability to dispatch requests and a single HTTP request is enough to trigger remote code execution. Also important to mention that it's not limited to Ray. It's only one use case. We've seen many remote code execution vulnerabilities on local host. But for the sake of time, we're only showing this on the presentation. But there is the full blog at the end. So I have a phishing email, not the most successful one. But I'm clicking here and being redirected to this website. Now this is the JavaScript that targets the remote code execution. You can see that there's a netcat, a socket that is being opened to a remote server, which is the attacker-controlled server. It is being used with mode no calls, which sends a request and will simply return an opaque response. So I cannot see the response. But as we said, we don't really care. We just want to send it and trigger remote code execution. And finally, we get a response. It looks like an error, but you can see that it's 200 OK. So apparently the job really ran. And you'll see it in a second. But this is all it takes. Just one HTTP request to reach the server. We don't care about the response. And it's more than enough. 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. But here is a reverse shell that is being opened. As soon as I'm clicking on an email. So on the right, I have Ray running. I'm importing it and running Ray.init without any special parameters. This is how developers usually use Ray. And you can see that it binds on localhost. There is a Ray's dashboard, and it should reflect the jobs that are currently running. Now, on the left, I'll open a socket. And listen for connection on the certain port that matches the payload of the attack. 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. You can see that the Netcat is really running in Ray. And I use it to run arbitrary commands on my personal computer. And that's it, basically. It got a lot of coverage. So remote code execution with a single click. And as I said, it's not limited to Ray, so therefore all the buzz. But it got a lot of coverage and for a reason. Now, we did a responsible disclosure with the browsers. And they had to introduce breaking changes. Some of them are doing it more gradually. But the idea is that we've actually managed to coordinate all the browsers together. So they will not zero-day each other by releasing a fix ahead of others. Here is the proof on each of the browsers. So the same payload can be used in each and every one of them. And let's begin with Safari. So Safari did an amazing job. All of them did an amazing job. But Safari simply mitigated it in the browser level before PNA is actually implemented in Safari. You all know WebKit, I guess. So WebKit is open source that Safari is based on. And they changed 23 files. They added a lot of tests. And they did an amazing job on blocking it in Safari's level. But not limited to Safari. But actually, every web view on watchOS or iPad, it doesn't matter. It's all WebKit-based. So they did a really amazing patch here. And great job. And you can see that they literally checked that the address contains only zeros. They have this property. Sorry, but we added an if clause on every HTTP request in the world. Not proud of it, but it's the way it is. And there's Chromium. Chromium, as I said, they are the leaders of private network access. So they proposed a long time ago, even when it only started, to add these headers to the backend services. And later on, these headers can be used in the server level to mitigate those attacks. But they decided to deprecate 000 before private network access completely rolls out to the browser. And there's even our report here. And they literally say that it can be used for DNS rebinding attacks. And PNA protection can be bypassed using this special IP address on macOS and Linux. And it should never be used in practice. It should never be used. And as I said, they added the counters. And they say out loud that malware leverages this attack to specific developer toolkits. And again, our bug. And there's Firefox. Firefox also did an amazing job. They don't add PNA right away because it's not standardized yet. It's not ready. But when it will be, they are definitely positive towards adding PNA. And they did block it in fetch level. Like, who knows fetch in JavaScript? It's the way to do HTTP requests. They literally changed the RFC. And they propose to block 000 whenever a target IP is 000. Simply drop the HTTP request. And then browsers will have to comply with a new fetch standard. This is the way things work. Now, what can we expect? So, I expect that many open source maintainers and developers will add PNA headers to their services. So they won't be attacked from this attack vector. Eventually, this IP address will be blocked in all browsers. And I think that now people, at least I hope, will treat localhost as not really local anymore. We can make these assumptions of being executed in a trusted environment. Because as we've seen, a browser can have routing capabilities and can reach our localhost interfaces. So HTTPS, core, CSRF tokens, authorization, all of those are a must also in local projects. So please don't make those assumptions. Now, we're almost done, but a cool thing I wanted to share. So you know these port scanners online that scan certain websites? So if you use, like, loopback or localhost, it will fail. But you can make them port scan themselves using 000. Yeah, many people forget about this special IP, as we said. A lot of different use cases. And that's it, basically. And it gets me to the conclusion, which I'll hand back to Gal, and thank you so far. He deserves it. So let's conclude what we've seen. First of all, Avi is awesome, right? He's breaking the browsers, making them actually talk to each other, and start to actually build a standard. 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. I don't know if you saw this 100,000 website. I can tell you, honestly, that probably 100% of them are malicious. 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. And this is why we think this is a subject that needs to be called out. 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. This is where we come and show, look, attackers are also looking for those type of things. They are really enjoying the fact that there isn't one standard, and it can be abused. 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. 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. We would love to answer anything you might, like, have. And, again, this is just one example. And you've seen how big companies abused it for financial reason, or attacker been leveraging that to hack internal network. 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. So, again, thank you very much, everyone, for attending this talk. We will share everything online, and, again, happy DEF CON. Thank you, everyone.