1 00:00:00,000 --> 00:00:01,500 Morning everyone. 2 00:00:02,580 --> 00:00:04,460 Thank you so much for coming. 3 00:00:04,460 --> 00:00:09,220 I mean, I know this is the very first talk happening literally in every single screen out there. 4 00:00:09,220 --> 00:00:11,880 So really appreciate you making it out to ours. 5 00:00:12,220 --> 00:00:14,280 I'm Vivek Ramachandran. 6 00:00:14,380 --> 00:00:15,820 I have Shaurya with me. 7 00:00:16,080 --> 00:00:21,880 And we're going to talk about something very interesting, Sneaky Extensions, the MV3 escape artists. 8 00:00:22,140 --> 00:00:23,660 A little bit about me. 9 00:00:23,660 --> 00:00:26,040 I've been in cybersecurity 20 years. 10 00:00:26,040 --> 00:00:33,800 Very first DEF CON 2007 when I spoke, found multiple vulnerabilities, started multiple cybersecurity companies. 11 00:00:33,800 --> 00:00:37,600 Now we run SquareX, a browser native security company. 12 00:00:39,420 --> 00:00:40,380 Hello everyone. 13 00:00:40,380 --> 00:00:41,340 I'm Shaurya. 14 00:00:41,340 --> 00:00:44,100 I work as a principal software engineer at SquareX. 15 00:00:44,100 --> 00:00:52,220 My work mainly involves researching extensions, malicious extensions, and working on methods to actually tackle them. 16 00:00:52,220 --> 00:00:56,720 And we have Sasha from the Speaker Ops team. 17 00:00:57,720 --> 00:01:02,520 Okay, so browser extensions, I think almost everyone uses it. 18 00:01:02,520 --> 00:01:04,820 Anyone here doesn't use browser extensions? 19 00:01:04,940 --> 00:01:07,940 I'm guessing maybe in this audience, a few people are skeptical. 20 00:01:09,140 --> 00:01:13,940 But overall, I guess everybody uses browser extensions, good convenience feature. 21 00:01:14,180 --> 00:01:24,780 And that is really where I think our talk is about how easy it is for a browser extension to cause backdoors, a lot of attacks within your organization. 22 00:01:24,960 --> 00:01:42,540 And the grand finale is, we'll actually show you a browser extension which we've written, which can steal live calls on Google Meet, Zoom, and all of that while the call is happening, without having any indication that that MITM interception is going on. 23 00:01:42,960 --> 00:01:48,740 So, as I said, everybody uses extensions, Grammarly, 1Password, some of the more common ones. 24 00:01:48,740 --> 00:01:59,440 And now because of AI, every second day, you keep hearing about somebody offering a free extension, which gives you access to chat GPT premium, right? 25 00:01:59,440 --> 00:02:04,080 And then people just go about installing it, thinking they're getting free access. 26 00:02:04,080 --> 00:02:07,440 But many of those extensions are backdoored. 27 00:02:08,140 --> 00:02:12,060 Now, this problem is starting to compound. 28 00:02:12,060 --> 00:02:20,360 You know, some statistics from Forbes were over 280 million installs of extensions containing malware in just three years. 29 00:02:22,280 --> 00:02:27,820 Just 32 of them managed to go ahead and have a download count of over 75 million. 30 00:02:27,860 --> 00:02:33,500 I think a lot of folks think that the Chrome store does a lot of analysis, but it doesn't. 31 00:02:33,500 --> 00:02:37,440 It's very high level, very basic sanity checks and nothing more than that. 32 00:02:37,440 --> 00:02:42,400 And that's why this problem is starting to compound more and more year over year. 33 00:02:43,960 --> 00:02:46,940 So give it to Shourya to continue. 34 00:02:48,600 --> 00:02:52,760 So how many of you have ever written an extension before? 35 00:02:52,760 --> 00:02:53,760 Can you raise your hand? 36 00:02:54,900 --> 00:03:01,200 OK, so I'll just tell you all a little bit about how an extension code structure looks like. 37 00:03:01,200 --> 00:03:08,420 This will actually help us understand how the whole permission model is and how exactly people can leverage that against. 38 00:03:08,640 --> 00:03:11,560 So typically, any extension has these four things. 39 00:03:11,560 --> 00:03:13,020 So they have a manifest file. 40 00:03:13,020 --> 00:03:16,100 Then they have a service worker, which runs on the background. 41 00:03:16,100 --> 00:03:17,740 And then they have a content script. 42 00:03:17,740 --> 00:03:22,700 So content script is basically injected on whatever web page you're opening. 43 00:03:23,160 --> 00:03:28,000 Now, what all pages it is allowed to be present is specified in the manifest file. 44 00:03:28,000 --> 00:03:32,340 Lastly, some extensions also have an HTML page. 45 00:03:32,340 --> 00:03:36,740 So let's say you go ahead and click on an icon, you can see like a small pop-up will appear. 46 00:03:36,740 --> 00:03:38,200 So there's actually an HTML page. 47 00:03:38,680 --> 00:03:49,660 Similarly, some extensions can also have like a separate page, which you can access through your address bar by chrome-extension:// and specifying the extension ID. 48 00:03:49,960 --> 00:03:54,220 So this is what a typical extension structure looks like. 49 00:03:54,220 --> 00:04:00,480 Now, to understand how the whole permission model works, it's important to know two things. 50 00:04:00,540 --> 00:04:12,100 The first one is that, you know, in the extension, the very best thing that has been done is that you have to specify what all permissions are required, you know, upfront. 51 00:04:12,200 --> 00:04:18,680 So your manifest.json file itself specifies that what kind of permissions your extension is going to ask for. 52 00:04:18,680 --> 00:04:21,020 And this actually helps a lot as well. 53 00:04:21,020 --> 00:04:27,080 Now, after this, we also have this, a small, you know, a snippet. 54 00:04:27,080 --> 00:04:29,020 This snippet is actually a manifest file. 55 00:04:29,020 --> 00:04:30,720 So this is how it typically looks like. 56 00:04:30,720 --> 00:04:34,640 If you see on the top, this is where you specify the manifest version. 57 00:04:35,000 --> 00:04:37,840 So the current latest version is version 3. 58 00:04:38,480 --> 00:04:46,900 Now, you know, this has been actually a very, I would say, important transition as extensions are moving from version 2 to version 3. 59 00:04:46,900 --> 00:04:55,520 Because as you can see here, you know, earlier in the permissions, we had to specify a URL, like, you know, on this particular URL you have access to. 60 00:04:55,580 --> 00:04:57,180 But now it's much more clearer. 61 00:04:57,180 --> 00:05:02,960 So it's been broken up into further keys to bring much more clarity on how the permission is being handled. 62 00:05:03,460 --> 00:05:08,820 Now, if you look at the kind of permissions most of the extensions are asking for, here are some stats. 63 00:05:08,820 --> 00:05:20,340 So you can see that the third most is actually all URLs, which is quite, I would say, dangerous because most of your extension actually have access to modify any page if they want. 64 00:05:21,040 --> 00:05:26,000 Most people don't even read what the permission, you know, the prompt is saying to you. 65 00:05:26,520 --> 00:05:33,380 Now, the second important thing to know is how the whole process architecture inside the Chromium works like. 66 00:05:33,380 --> 00:05:37,160 So in Chromium, we have a multi-process architecture. 67 00:05:37,160 --> 00:05:41,500 So we have separate processes for doing separate things. 68 00:05:41,500 --> 00:05:49,060 For example, you know, if you have, like, a particular tab, so whatever you're seeing on the page is being done through a renderer process. 69 00:05:49,160 --> 00:05:53,700 Similarly, if there's a network call, it will actually happen through an entirely different process. 70 00:05:53,820 --> 00:06:01,340 So by having all these processes separated, you know, it really helps out in a security kind of point. 71 00:06:01,340 --> 00:06:13,790 The reason being that all these are basically isolated from the operating system point of view, because these cannot really, you know, interact at much other than the IPCs. 72 00:06:14,220 --> 00:06:17,700 Now, there is one more thing which is quite interesting. 73 00:06:17,720 --> 00:06:27,570 So every tab that you see is actually having a different renderer process, which actually further isolates them from interacting with each other. 74 00:06:28,170 --> 00:06:32,910 Now, you must be wondering, you know, what happens if there's an iframe on the page, right? 75 00:06:32,910 --> 00:06:37,530 So if a page has an iframe, it is further put in a different process. 76 00:06:37,730 --> 00:06:49,330 It's actually, I would say, a very big engineering milestone, because if you simply go to a web page and type, you know, a command F to find a text, it's actually searching that text across multiple processes. 77 00:06:49,510 --> 00:06:51,870 So it's quite an engineering feat, I would say. 78 00:06:52,770 --> 00:06:56,670 There are different terms for this, called a site isolation or site fission. 79 00:06:57,330 --> 00:07:01,170 Now, we'll come back to how the whole, you know, this architecture fits in. 80 00:07:01,170 --> 00:07:03,410 So this diagram basically shows it pretty well. 81 00:07:03,410 --> 00:07:10,310 So all the components which I showed you earlier, like extension pages, your content script, this is how the whole structure looks like. 82 00:07:10,630 --> 00:07:21,390 Now, content scripts are, I would say, the very first thing that we all should, you know, be careful about, because content scripts are injected on the web pages. 83 00:07:21,390 --> 00:07:29,730 Now, to see it in action, I'll actually show you a live code right now to see how exactly content scripts can modify a given page. 84 00:07:29,930 --> 00:07:32,230 So it's actually pretty straightforward. 85 00:07:33,270 --> 00:07:36,170 This is a typical extension. 86 00:07:36,170 --> 00:07:38,210 You can see, like, there's a manifest file. 87 00:07:38,450 --> 00:07:40,890 I'm just naming it test extension for now. 88 00:07:41,070 --> 00:07:44,610 And in this, I'm inserting a content.js file. 89 00:07:44,810 --> 00:07:50,870 So if you see here, there's a js file here, which is simply just going to write a text on the page. 90 00:07:51,390 --> 00:07:56,850 So, you know, if I go back to my browser, and let's say, you know, I try to load this specific extension. 91 00:08:01,670 --> 00:08:07,330 And if I disable it, now, if I try to access a website, let's say Google.com, it loads normally. 92 00:08:07,610 --> 00:08:18,110 But the moment I basically enable this test extension, and I try to open Google.com, it will get overwritten by whatever I have specified on the extension. 93 00:08:18,710 --> 00:08:23,990 Now, this is how basically content script works, like, you know, you have a way to inject something on the web page. 94 00:08:24,490 --> 00:08:30,570 Now, if you see this specific extension, there is no permission key here. 95 00:08:31,110 --> 00:08:42,730 And that's what makes it more dangerous, because, you know, I was able to modify a page, but I'm not actually asking for any explicit permission other than, like, in what pages I'm actually inserting the content script. 96 00:08:42,790 --> 00:08:49,950 So it's important not just to look at the permissions key, but also to look at, you know, in what particular pages the content script is being injected to. 97 00:08:50,470 --> 00:08:57,210 Now, coming back, one of the biggest problems that arise with this is actually remote code execution. 98 00:08:57,490 --> 00:09:08,090 So let's say, you know, I allow any of the extension to be installed on your browser, and later on, I'm sending some code from my server, which is definitely unmonitored. 99 00:09:08,090 --> 00:09:11,610 And I'm sending that code to execute on any random web page. 100 00:09:11,610 --> 00:09:13,330 Now, this is quite dangerous. 101 00:09:13,350 --> 00:09:17,410 So to avoid this, a lot of changes were done in the mv3 version itself. 102 00:09:17,410 --> 00:09:25,010 So we have these functions like eval, where, you know, you can specify, like, any kind of JavaScript code, and it executes on a given page. 103 00:09:25,010 --> 00:09:33,630 So all these things were banned in the mv3, at the same time also enforced to be blocked using the content security policy that is CSP. 104 00:09:33,970 --> 00:09:36,810 However, there are ways to bypass this as well. 105 00:09:37,250 --> 00:09:54,730 So, you know, just to give a small example of this, if I go back and look at the very same extension which I just showed you, and if I try this with, you know, just an eval, now this is how eval looks like, you know, you're sending a string, and this string is going to execute on the page. 106 00:09:55,070 --> 00:10:04,070 If I go back to my browser, and I try to, you know, reload my extension, and if I refresh now, the page will load normally. 107 00:10:04,170 --> 00:10:08,330 The reason being that it has been blocked because of the CSP policy. 108 00:10:08,930 --> 00:10:18,290 However, JavaScript is a funny language, so you can actually access the object, the functions, like normal arrays or objects as well. 109 00:10:18,510 --> 00:10:29,550 So if I go down and I write simply something like this, like, you know, so I specify my write within the square brackets, and the argument in a simple string, it'll actually work as well. 110 00:10:29,550 --> 00:10:38,250 So if I go back, and I, you know, basically try to refresh my extension, and if I go back, this will again show me back hello from extension. 111 00:10:38,770 --> 00:10:48,470 Now as you can see, all these two things were simple strings, and this can actually be leveraged to further send those strings from an external server as well. 112 00:10:49,210 --> 00:10:52,790 And this can also be used to in fact, you know, change the URL as well. 113 00:10:52,790 --> 00:10:57,770 So if you see the snippet here, this will simply change the location of a given page. 114 00:10:59,070 --> 00:11:04,250 Now, you know, the same thing can be extended by connecting this to a server as well. 115 00:11:04,250 --> 00:11:09,750 So if you see here, I have a simple Flask server, which just returns two things. 116 00:11:09,750 --> 00:11:13,090 One is a function name, and the other one is just an argument. 117 00:11:13,290 --> 00:11:28,780 So if I run this server right now, so I have my Flask server running, and I'll simply go back, and I will load the other extension, which has an integration with this API. 118 00:11:36,610 --> 00:11:43,990 Now, if I try to access a page, it still works, and you can see a hello from server is written there. 119 00:11:44,030 --> 00:11:56,830 Reason being, that if you look at the code of this extension, it is making an API call, getting what the function name is, getting what the argument is, and simply using it to change the content of the page. 120 00:12:01,850 --> 00:12:06,770 So, I think, you know, given the talk time is limited, we'll start with some demo videos as well. 121 00:12:06,770 --> 00:12:08,270 I think we have 10 minutes on the clock. 122 00:12:08,270 --> 00:12:09,090 10 minutes? 123 00:12:09,410 --> 00:12:10,030 Okay. 124 00:12:11,390 --> 00:12:25,110 So, the very first demo we want to show is, I mean, there are a bunch of them, is social engineering, where you could literally, once you install an extension, it could pretend to go ahead and let's say drop a Zoom update, right? 125 00:12:25,110 --> 00:12:28,550 Because it's so common that you try to access Zoom and it says, go update. 126 00:12:28,890 --> 00:12:30,490 And Shauri will show you that. 127 00:12:34,180 --> 00:12:41,700 So , we can see here that, you know, I'm simply opening the Zoom website, and it looks like, you know, a normal Zoom website, how it's supposed to be. 128 00:12:41,700 --> 00:12:51,580 If I go ahead and enable this malicious extension, it's simply using a content script to add another object on that specific page, which says, hey, there's an update now. 129 00:12:51,580 --> 00:12:54,440 And the moment you click on this, you download a file. 130 00:12:54,600 --> 00:12:58,880 And if you see here, the download we are triggering is actually a blog-based download. 131 00:12:59,100 --> 00:13:04,620 So, even if you go to the downloads and you look at the URL, you will see it as, you know, it's coming from zoom.us. 132 00:13:04,620 --> 00:13:07,300 But actually, it was shipped with the extension. 133 00:13:09,080 --> 00:13:12,860 Now, if we simply open that execute table, it might affect your computer. 134 00:13:13,320 --> 00:13:21,240 The key thing to realize over here is, extensions have the power to run in the context of whichever page that they're injecting into. 135 00:13:21,260 --> 00:13:30,460 So, if you install a random extension, which says it's a color picker, and then you open zoom.us, at that point, it can actually inject into that page. 136 00:13:30,500 --> 00:13:35,540 And anything which happens from the browser's perspective is in the context of the page. 137 00:13:35,540 --> 00:13:41,240 So, if a file download is triggered, you feel it's probably from, you know, the actual Zoom website. 138 00:13:41,240 --> 00:13:45,820 Now, one interesting demo he'll actually show you is something live. 139 00:13:46,980 --> 00:13:47,380 Okay. 140 00:13:47,380 --> 00:13:54,680 And while he's getting that ready, imagine you have an extension and now you're doing a video call, right? 141 00:13:54,680 --> 00:13:59,800 How many of you end up using the browser version of Zoom and Google Meets and whatnot? 142 00:13:59,960 --> 00:14:06,680 Now, you might actually imagine that when a Google Meet call is actually happening, nothing else can monitor. 143 00:14:06,680 --> 00:14:26,480 So, we'll show you a demo of an extension which we've created, which while a live call is happening, it can go ahead, do a side monitoring, and literally get the entire feed of the call live and send it wherever, with zero indication in the Google Meet session that something is intercepting or monitoring this. 144 00:14:27,380 --> 00:14:35,200 So, as you can see here, you know, I'm basically gonna open Google Meet. 145 00:14:40,530 --> 00:14:44,470 We hope the internet connection works, or else we'll show you a very quick video. 146 00:14:44,470 --> 00:14:46,890 Okay, we have five minutes on the clock while he's getting it. 147 00:14:46,970 --> 00:14:59,130 The key thing to realize is, you can actually host a Chromium extension or an Edge extension, much of the times there is barely any security checks, which are really happening. 148 00:14:59,650 --> 00:15:05,850 So, if you see a featured extension, it isn't that, you know, Google's team has looked at the code, run a bunch of tests. 149 00:15:05,850 --> 00:15:15,530 Unbelievably, even in the enterprise version, some of the basic stuff that they end up showing, doesn't really look at what that code could do. 150 00:15:15,570 --> 00:15:17,390 Now, here's the worst part. 151 00:15:17,630 --> 00:15:19,670 We all fear download and execs, right? 152 00:15:19,670 --> 00:15:24,590 Because you run the stub, get something, that's something extensions can do right off the box. 153 00:15:24,850 --> 00:15:30,110 Is the extension just loads, looks innocent, but it can actually bring back foreign code and run it. 154 00:15:30,110 --> 00:15:33,670 So, if you see here, we are starting a new Google Meet session. 155 00:15:37,390 --> 00:15:40,110 Now, the malicious extension is installed. 156 00:15:40,350 --> 00:15:45,970 So, we're going to simply open, you know, another window and open an extension page to see what's actually seen. 157 00:15:45,970 --> 00:15:51,470 And you can see, like, you know, the live feed from that particular Meet page is being transferred to the other page. 158 00:15:51,530 --> 00:16:02,470 And that shows a lot, because, you know, having a simple host permission, it was not even a specified permission, you were actually able to steal a live stream from a given Meet page. 159 00:16:03,750 --> 00:16:08,570 So, the key thing to realize is, you know, extensions have superpowers. 160 00:16:08,570 --> 00:16:17,330 Just like, you know, an endpoint security, you end up installing something in kernel mode and that has one privilege level above what user space processes have. 161 00:16:17,370 --> 00:16:21,570 Similarly, extensions are sitting one level above, you know, the page itself. 162 00:16:21,570 --> 00:16:22,030 Yeah. 163 00:16:22,030 --> 00:16:25,010 We'll also look at just two quick demos right now. 164 00:16:25,010 --> 00:16:28,030 Another one is called silent account hijacking. 165 00:16:28,030 --> 00:16:33,030 So, in this, what I'm going to do is I'll simply have a malicious extension installed. 166 00:16:33,230 --> 00:16:40,390 And what it's going to do is that in the background, it's going to log into your GitHub account, because extensions have a highly privileged. 167 00:16:40,390 --> 00:16:44,150 So, they have access to all HTTP only cookies as well. 168 00:16:44,370 --> 00:16:51,570 And if you're doing it from your service worker, that is from your background, you don't even have to ask for explicit permission for accessing cookie as well. 169 00:16:51,570 --> 00:16:55,230 If you're simply making a fetch call instead of, you know, just getting the cookie value. 170 00:16:55,750 --> 00:17:04,090 So, in this demo, we can see that we have a demo GitHub account and I have a private repo here. 171 00:17:05,490 --> 00:17:14,910 In this private repo, if we go to the settings and look at the collaborators, right now, there are no additional collaborators in this repo. 172 00:17:15,350 --> 00:17:19,890 Now, what I'll do is I'll simply go and start the malicious extension. 173 00:17:21,450 --> 00:17:29,290 Now, if you see, nothing really happened and for a very small moment, a small tab just opened and closed automatically. 174 00:17:29,570 --> 00:17:39,250 Now, if I go back and check that specific repo back again, go to the settings and see who all are the collaborators. 175 00:17:40,890 --> 00:17:44,830 Then I will see that there's one more collaborator added here now. 176 00:17:44,830 --> 00:17:52,290 So, this just shows, you know, how sneaky they can be and they can actually also take over your private repos. 177 00:17:52,850 --> 00:17:59,770 And the best way to think about it is think about any form of browser automation with things like Selenium, which some of you may have done. 178 00:17:59,770 --> 00:18:10,690 With an extension, it can just do literally everything in the background, act on your behalf, go through complex workflows, anything the, you know, author would have probably baked into it. 179 00:18:10,690 --> 00:18:14,450 And some of these can just download at payloads and happen at runtime. 180 00:18:14,650 --> 00:18:19,610 Doesn't need to be at, you know, extension, compile or upload time to the Chrome store. 181 00:18:21,010 --> 00:18:24,890 Yeah, now we look at one more, which is interference with password managers. 182 00:18:24,930 --> 00:18:30,190 So, many people often use extensions for, you know, using, saving their password and using them. 183 00:18:30,230 --> 00:18:33,910 So, actually other malicious extension can interfere with that as well. 184 00:18:33,910 --> 00:18:40,810 So, in this example, we can see that a user is using one of the password manager vendors. 185 00:18:41,190 --> 00:18:54,890 And if you go to, let's say, a random SaaS application where you were already using that specific password manager, we can see that the password manager works and a person is, you know, able to log in normally how it's supposed to be. 186 00:18:54,890 --> 00:19:07,790 However, the moment if we go back and enable the malicious extension, what this extension will do is that it will override what the default action of clicking on that icon was. 187 00:19:07,910 --> 00:19:10,970 So, if we can see here, it's still the password manager's icon. 188 00:19:10,970 --> 00:19:15,850 But the moment I click on this, it will take me to another login page. 189 00:19:15,850 --> 00:19:25,150 So, for the test purpose and for demonstration, we have just named our extension with a malware word so that you know that this page is actually, you know, a fake one. 190 00:19:25,290 --> 00:19:28,370 But, you know, looking at the URL, you can't really figure that out. 191 00:19:28,990 --> 00:19:36,050 So, here, a person will then, you know, think that they might have logged out of their password manager and they will end up ending their credentials. 192 00:19:36,430 --> 00:19:40,130 And the moment they do that, they will get phished. 193 00:19:40,130 --> 00:19:42,150 So, we've run out of time. 194 00:19:42,270 --> 00:19:48,290 I think if you're interested, all the source code, everything we have here, you can go to sqrx.com. 195 00:19:48,490 --> 00:19:49,870 We'll put all of that up. 196 00:19:49,870 --> 00:19:51,970 We'll also put up a much more detailed video. 197 00:19:51,970 --> 00:19:53,290 We only got 20 minutes. 198 00:19:53,510 --> 00:19:55,310 We have a lot of research. 199 00:19:55,590 --> 00:20:01,730 Now, the key summary is even known extensions on the Chrome store get bought out all the time. 200 00:20:01,730 --> 00:20:10,830 And what attackers have started doing is if an extension has 100,000 installs, they'll just offer $10,000 to the author and they can transfer over ownership. 201 00:20:11,110 --> 00:20:16,410 And that means, you know, extensions you trusted could now automatically be untrusted. 202 00:20:16,410 --> 00:20:21,930 And a bunch of other supply chain attacks which can kind of happen in the context of the Chrome store, right? 203 00:20:21,930 --> 00:20:23,350 Thank you so much. 204 00:20:23,410 --> 00:20:26,310 And, yeah, please visit sqrx.com for more. 205 00:20:26,310 --> 00:20:27,050 Thank you.