WEBVTT

00:00.000 --> 00:01.500
Morning everyone.

00:02.580 --> 00:04.460
Thank you so much for coming.

00:04.460 --> 00:09.220
I mean, I know this is the very first talk happening literally in every single screen out there.

00:09.220 --> 00:11.880
So really appreciate you making it out to ours.

00:12.220 --> 00:14.280
I'm Vivek Ramachandran.

00:14.380 --> 00:15.820
I have Shaurya with me.

00:16.080 --> 00:21.880
And we're going to talk about something very interesting, Sneaky Extensions, the MV3 escape artists.

00:22.140 --> 00:23.660
A little bit about me.

00:23.660 --> 00:26.040
I've been in cybersecurity 20 years.

00:26.040 --> 00:33.800
Very first DEF CON 2007 when I spoke, found multiple vulnerabilities, started multiple cybersecurity companies.

00:33.800 --> 00:37.600
Now we run SquareX, a browser native security company.

00:39.420 --> 00:40.380
Hello everyone.

00:40.380 --> 00:41.340
I'm Shaurya.

00:41.340 --> 00:44.100
I work as a principal software engineer at SquareX.

00:44.100 --> 00:52.220
My work mainly involves researching extensions, malicious extensions, and working on methods to actually tackle them.

00:52.220 --> 00:56.720
And we have Sasha from the Speaker Ops team.

00:57.720 --> 01:02.520
Okay, so browser extensions, I think almost everyone uses it.

01:02.520 --> 01:04.820
Anyone here doesn't use browser extensions?

01:04.940 --> 01:07.940
I'm guessing maybe in this audience, a few people are skeptical.

01:09.140 --> 01:13.940
But overall, I guess everybody uses browser extensions, good convenience feature.

01:14.180 --> 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.

01:24.960 --> 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.

01:42.960 --> 01:48.740
So, as I said, everybody uses extensions, Grammarly, 1Password, some of the more common ones.

01:48.740 --> 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?

01:59.440 --> 02:04.080
And then people just go about installing it, thinking they're getting free access.

02:04.080 --> 02:07.440
But many of those extensions are backdoored.

02:08.140 --> 02:12.060
Now, this problem is starting to compound.

02:12.060 --> 02:20.360
You know, some statistics from Forbes were over 280 million installs of extensions containing malware in just three years.

02:22.280 --> 02:27.820
Just 32 of them managed to go ahead and have a download count of over 75 million.

02:27.860 --> 02:33.500
I think a lot of folks think that the Chrome store does a lot of analysis, but it doesn't.

02:33.500 --> 02:37.440
It's very high level, very basic sanity checks and nothing more than that.

02:37.440 --> 02:42.400
And that's why this problem is starting to compound more and more year over year.

02:43.960 --> 02:46.940
So give it to Shourya to continue.

02:48.600 --> 02:52.760
So how many of you have ever written an extension before?

02:52.760 --> 02:53.760
Can you raise your hand?

02:54.900 --> 03:01.200
OK, so I'll just tell you all a little bit about how an extension code structure looks like.

03:01.200 --> 03:08.420
This will actually help us understand how the whole permission model is and how exactly people can leverage that against.

03:08.640 --> 03:11.560
So typically, any extension has these four things.

03:11.560 --> 03:13.020
So they have a manifest file.

03:13.020 --> 03:16.100
Then they have a service worker, which runs on the background.

03:16.100 --> 03:17.740
And then they have a content script.

03:17.740 --> 03:22.700
So content script is basically injected on whatever web page you're opening.

03:23.160 --> 03:28.000
Now, what all pages it is allowed to be present is specified in the manifest file.

03:28.000 --> 03:32.340
Lastly, some extensions also have an HTML page.

03:32.340 --> 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.

03:36.740 --> 03:38.200
So there's actually an HTML page.

03:38.680 --> 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.

03:49.960 --> 03:54.220
So this is what a typical extension structure looks like.

03:54.220 --> 04:00.480
Now, to understand how the whole permission model works, it's important to know two things.

04:00.540 --> 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.

04:12.200 --> 04:18.680
So your manifest.json file itself specifies that what kind of permissions your extension is going to ask for.

04:18.680 --> 04:21.020
And this actually helps a lot as well.

04:21.020 --> 04:27.080
Now, after this, we also have this, a small, you know, a snippet.

04:27.080 --> 04:29.020
This snippet is actually a manifest file.

04:29.020 --> 04:30.720
So this is how it typically looks like.

04:30.720 --> 04:34.640
If you see on the top, this is where you specify the manifest version.

04:35.000 --> 04:37.840
So the current latest version is version 3.

04:38.480 --> 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.

04:46.900 --> 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.

04:55.580 --> 04:57.180
But now it's much more clearer.

04:57.180 --> 05:02.960
So it's been broken up into further keys to bring much more clarity on how the permission is being handled.

05:03.460 --> 05:08.820
Now, if you look at the kind of permissions most of the extensions are asking for, here are some stats.

05:08.820 --> 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.

05:21.040 --> 05:26.000
Most people don't even read what the permission, you know, the prompt is saying to you.

05:26.520 --> 05:33.380
Now, the second important thing to know is how the whole process architecture inside the Chromium works like.

05:33.380 --> 05:37.160
So in Chromium, we have a multi-process architecture.

05:37.160 --> 05:41.500
So we have separate processes for doing separate things.

05:41.500 --> 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.

05:49.160 --> 05:53.700
Similarly, if there's a network call, it will actually happen through an entirely different process.

05:53.820 --> 06:01.340
So by having all these processes separated, you know, it really helps out in a security kind of point.

06:01.340 --> 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.

06:14.220 --> 06:17.700
Now, there is one more thing which is quite interesting.

06:17.720 --> 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.

06:28.170 --> 06:32.910
Now, you must be wondering, you know, what happens if there's an iframe on the page, right?

06:32.910 --> 06:37.530
So if a page has an iframe, it is further put in a different process.

06:37.730 --> 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.

06:49.510 --> 06:51.870
So it's quite an engineering feat, I would say.

06:52.770 --> 06:56.670
There are different terms for this, called a site isolation or site fission.

06:57.330 --> 07:01.170
Now, we'll come back to how the whole, you know, this architecture fits in.

07:01.170 --> 07:03.410
So this diagram basically shows it pretty well.

07:03.410 --> 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.

07:10.630 --> 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.

07:21.390 --> 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.

07:29.930 --> 07:32.230
So it's actually pretty straightforward.

07:33.270 --> 07:36.170
This is a typical extension.

07:36.170 --> 07:38.210
You can see, like, there's a manifest file.

07:38.450 --> 07:40.890
I'm just naming it test extension for now.

07:41.070 --> 07:44.610
And in this, I'm inserting a content.js file.

07:44.810 --> 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.

07:51.390 --> 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.

08:01.670 --> 08:07.330
And if I disable it, now, if I try to access a website, let's say Google.com, it loads normally.

08:07.610 --> 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.

08:18.710 --> 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.

08:24.490 --> 08:30.570
Now, if you see this specific extension, there is no permission key here.

08:31.110 --> 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.

08:42.790 --> 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.

08:50.470 --> 08:57.210
Now, coming back, one of the biggest problems that arise with this is actually remote code execution.

08:57.490 --> 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.

09:08.090 --> 09:11.610
And I'm sending that code to execute on any random web page.

09:11.610 --> 09:13.330
Now, this is quite dangerous.

09:13.350 --> 09:17.410
So to avoid this, a lot of changes were done in the mv3 version itself.

09:17.410 --> 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.

09:25.010 --> 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.

09:33.970 --> 09:36.810
However, there are ways to bypass this as well.

09:37.250 --> 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.

09:55.070 --> 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.

10:04.170 --> 10:08.330
The reason being that it has been blocked because of the CSP policy.

10:08.930 --> 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.

10:18.510 --> 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.

10:29.550 --> 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.

10:38.770 --> 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.

10:49.210 --> 10:52.790
And this can also be used to in fact, you know, change the URL as well.

10:52.790 --> 10:57.770
So if you see the snippet here, this will simply change the location of a given page.

10:59.070 --> 11:04.250
Now, you know, the same thing can be extended by connecting this to a server as well.

11:04.250 --> 11:09.750
So if you see here, I have a simple Flask server, which just returns two things.

11:09.750 --> 11:13.090
One is a function name, and the other one is just an argument.

11:13.290 --> 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.

11:36.610 --> 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.

11:44.030 --> 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.

12:01.850 --> 12:06.770
So, I think, you know, given the talk time is limited, we'll start with some demo videos as well.

12:06.770 --> 12:08.270
I think we have 10 minutes on the clock.

12:08.270 --> 12:09.090
10 minutes?

12:09.410 --> 12:10.030
Okay.

12:11.390 --> 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?

12:25.110 --> 12:28.550
Because it's so common that you try to access Zoom and it says, go update.

12:28.890 --> 12:30.490
And Shauri will show you that.

12:34.180 --> 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.

12:41.700 --> 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.

12:51.580 --> 12:54.440
And the moment you click on this, you download a file.

12:54.600 --> 12:58.880
And if you see here, the download we are triggering is actually a blog-based download.

12:59.100 --> 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.

13:04.620 --> 13:07.300
But actually, it was shipped with the extension.

13:09.080 --> 13:12.860
Now, if we simply open that execute table, it might affect your computer.

13:13.320 --> 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.

13:21.260 --> 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.

13:30.500 --> 13:35.540
And anything which happens from the browser's perspective is in the context of the page.

13:35.540 --> 13:41.240
So, if a file download is triggered, you feel it's probably from, you know, the actual Zoom website.

13:41.240 --> 13:45.820
Now, one interesting demo he'll actually show you is something live.

13:46.980 --> 13:47.380
Okay.

13:47.380 --> 13:54.680
And while he's getting that ready, imagine you have an extension and now you're doing a video call, right?

13:54.680 --> 13:59.800
How many of you end up using the browser version of Zoom and Google Meets and whatnot?

13:59.960 --> 14:06.680
Now, you might actually imagine that when a Google Meet call is actually happening, nothing else can monitor.

14:06.680 --> 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.

14:27.380 --> 14:35.200
So, as you can see here, you know, I'm basically gonna open Google Meet.

14:40.530 --> 14:44.470
We hope the internet connection works, or else we'll show you a very quick video.

14:44.470 --> 14:46.890
Okay, we have five minutes on the clock while he's getting it.

14:46.970 --> 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.

14:59.650 --> 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.

15:05.850 --> 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.

15:15.570 --> 15:17.390
Now, here's the worst part.

15:17.630 --> 15:19.670
We all fear download and execs, right?

15:19.670 --> 15:24.590
Because you run the stub, get something, that's something extensions can do right off the box.

15:24.850 --> 15:30.110
Is the extension just loads, looks innocent, but it can actually bring back foreign code and run it.

15:30.110 --> 15:33.670
So, if you see here, we are starting a new Google Meet session.

15:37.390 --> 15:40.110
Now, the malicious extension is installed.

15:40.350 --> 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.

15:45.970 --> 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.

15:51.530 --> 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.

16:03.750 --> 16:08.570
So, the key thing to realize is, you know, extensions have superpowers.

16:08.570 --> 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.

16:17.370 --> 16:21.570
Similarly, extensions are sitting one level above, you know, the page itself.

16:21.570 --> 16:22.030
Yeah.

16:22.030 --> 16:25.010
We'll also look at just two quick demos right now.

16:25.010 --> 16:28.030
Another one is called silent account hijacking.

16:28.030 --> 16:33.030
So, in this, what I'm going to do is I'll simply have a malicious extension installed.

16:33.230 --> 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.

16:40.390 --> 16:44.150
So, they have access to all HTTP only cookies as well.

16:44.370 --> 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.

16:51.570 --> 16:55.230
If you're simply making a fetch call instead of, you know, just getting the cookie value.

16:55.750 --> 17:04.090
So, in this demo, we can see that we have a demo GitHub account and I have a private repo here.

17:05.490 --> 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.

17:15.350 --> 17:19.890
Now, what I'll do is I'll simply go and start the malicious extension.

17:21.450 --> 17:29.290
Now, if you see, nothing really happened and for a very small moment, a small tab just opened and closed automatically.

17:29.570 --> 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.

17:40.890 --> 17:44.830
Then I will see that there's one more collaborator added here now.

17:44.830 --> 17:52.290
So, this just shows, you know, how sneaky they can be and they can actually also take over your private repos.

17:52.850 --> 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.

17:59.770 --> 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.

18:10.690 --> 18:14.450
And some of these can just download at payloads and happen at runtime.

18:14.650 --> 18:19.610
Doesn't need to be at, you know, extension, compile or upload time to the Chrome store.

18:21.010 --> 18:24.890
Yeah, now we look at one more, which is interference with password managers.

18:24.930 --> 18:30.190
So, many people often use extensions for, you know, using, saving their password and using them.

18:30.230 --> 18:33.910
So, actually other malicious extension can interfere with that as well.

18:33.910 --> 18:40.810
So, in this example, we can see that a user is using one of the password manager vendors.

18:41.190 --> 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.

18:54.890 --> 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.

19:07.910 --> 19:10.970
So, if we can see here, it's still the password manager's icon.

19:10.970 --> 19:15.850
But the moment I click on this, it will take me to another login page.

19:15.850 --> 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.

19:25.290 --> 19:28.370
But, you know, looking at the URL, you can't really figure that out.

19:28.990 --> 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.

19:36.430 --> 19:40.130
And the moment they do that, they will get phished.

19:40.130 --> 19:42.150
So, we've run out of time.

19:42.270 --> 19:48.290
I think if you're interested, all the source code, everything we have here, you can go to sqrx.com.

19:48.490 --> 19:49.870
We'll put all of that up.

19:49.870 --> 19:51.970
We'll also put up a much more detailed video.

19:51.970 --> 19:53.290
We only got 20 minutes.

19:53.510 --> 19:55.310
We have a lot of research.

19:55.590 --> 20:01.730
Now, the key summary is even known extensions on the Chrome store get bought out all the time.

20:01.730 --> 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.

20:11.110 --> 20:16.410
And that means, you know, extensions you trusted could now automatically be untrusted.

20:16.410 --> 20:21.930
And a bunch of other supply chain attacks which can kind of happen in the context of the Chrome store, right?

20:21.930 --> 20:23.350
Thank you so much.

20:23.410 --> 20:26.310
And, yeah, please visit sqrx.com for more.

20:26.310 --> 20:27.050
Thank you.

