start	end	text
0	1500	Morning everyone.
2580	6900	Thank you so much for coming. I mean, I know this is the very first talk happening
6900	11880	literally in every single screen out there. So really appreciate you making it out to ours.
12220	15820	I'm Vivek Ramachandran. I have Shaurya with me.
16080	21880	And we're going to talk about something very interesting, Sneaky Extensions, the MV3 escape artists.
22140	26040	A little bit about me. I've been in cybersecurity 20 years.
26040	30680	Very first DEF CON 2007 when I spoke, found multiple vulnerabilities,
31220	37600	started multiple cybersecurity companies. Now we run SquareX, a browser native security company.
39420	44100	Hello everyone. I'm Shaurya. I work as a principal software engineer at SquareX.
44100	52220	My work mainly involves researching extensions, malicious extensions, and working on methods to actually tackle them.
52220	56720	And we have Sasha from the Speaker Ops team.
57720	64820	Okay, so browser extensions, I think almost everyone uses it. Anyone here doesn't use browser extensions?
64940	67940	I'm guessing maybe in this audience, a few people are skeptical.
69140	73940	But overall, I guess everybody uses browser extensions, good convenience feature.
74180	80300	And that is really where I think our talk is about how easy it is for a browser extension to cause
81520	84780	backdoors, a lot of attacks within your organization.
84960	90120	And the grand finale is, we'll actually show you a browser extension which we've written,
90120	97420	which can steal live calls on Google Meet, Zoom, and all of that while the call is happening,
97420	102540	without having any indication that that MITM interception is going on.
102960	108740	So, as I said, everybody uses extensions, Grammarly, 1Password, some of the more common ones.
108740	116060	And now because of AI, every second day, you keep hearing about somebody offering a free extension,
116060	119440	which gives you access to chat GPT premium, right?
119440	124080	And then people just go about installing it, thinking they're getting free access.
124080	127440	But many of those extensions are backdoored.
128140	132060	Now, this problem is starting to compound.
132060	140360	You know, some statistics from Forbes were over 280 million installs of extensions containing malware in just three years.
142280	147820	Just 32 of them managed to go ahead and have a download count of over 75 million.
147860	153500	I think a lot of folks think that the Chrome store does a lot of analysis, but it doesn't.
153500	157440	It's very high level, very basic sanity checks and nothing more than that.
157440	162400	And that's why this problem is starting to compound more and more year over year.
163960	166940	So give it to Shourya to continue.
168600	172760	So how many of you have ever written an extension before?
172760	173760	Can you raise your hand?
174900	181200	OK, so I'll just tell you all a little bit about how an extension code structure looks like.
181200	188420	This will actually help us understand how the whole permission model is and how exactly people can leverage that against.
188640	191560	So typically, any extension has these four things.
191560	193020	So they have a manifest file.
193020	196100	Then they have a service worker, which runs on the background.
196100	197740	And then they have a content script.
197740	202700	So content script is basically injected on whatever web page you're opening.
203160	208000	Now, what all pages it is allowed to be present is specified in the manifest file.
208000	212340	Lastly, some extensions also have an HTML page.
212340	216740	So let's say you go ahead and click on an icon, you can see like a small pop-up will appear.
216740	218200	So there's actually an HTML page.
218680	229660	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.
229960	234220	So this is what a typical extension structure looks like.
234220	240480	Now, to understand how the whole permission model works, it's important to know two things.
240540	252100	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.
252200	258680	So your manifest.json file itself specifies that what kind of permissions your extension is going to ask for.
258680	261020	And this actually helps a lot as well.
261020	267080	Now, after this, we also have this, a small, you know, a snippet.
267080	269020	This snippet is actually a manifest file.
269020	270720	So this is how it typically looks like.
270720	274640	If you see on the top, this is where you specify the manifest version.
275000	277840	So the current latest version is version 3.
278480	286900	Now, you know, this has been actually a very, I would say, important transition as extensions are moving from version 2 to version 3.
286900	295520	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.
295580	297180	But now it's much more clearer.
297180	302960	So it's been broken up into further keys to bring much more clarity on how the permission is being handled.
303460	308820	Now, if you look at the kind of permissions most of the extensions are asking for, here are some stats.
308820	320340	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.
321040	326000	Most people don't even read what the permission, you know, the prompt is saying to you.
326520	333380	Now, the second important thing to know is how the whole process architecture inside the Chromium works like.
333380	337160	So in Chromium, we have a multi-process architecture.
337160	341500	So we have separate processes for doing separate things.
341500	349060	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.
349160	353700	Similarly, if there's a network call, it will actually happen through an entirely different process.
353820	361340	So by having all these processes separated, you know, it really helps out in a security kind of point.
361340	373790	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.
374220	377700	Now, there is one more thing which is quite interesting.
377720	387570	So every tab that you see is actually having a different renderer process, which actually further isolates them from interacting with each other.
388170	392910	Now, you must be wondering, you know, what happens if there's an iframe on the page, right?
392910	397530	So if a page has an iframe, it is further put in a different process.
397730	409330	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.
409510	411870	So it's quite an engineering feat, I would say.
412770	416670	There are different terms for this, called a site isolation or site fission.
417330	421170	Now, we'll come back to how the whole, you know, this architecture fits in.
421170	423410	So this diagram basically shows it pretty well.
423410	430310	So all the components which I showed you earlier, like extension pages, your content script, this is how the whole structure looks like.
430630	441390	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.
441390	449730	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.
449930	452230	So it's actually pretty straightforward.
453270	456170	This is a typical extension.
456170	458210	You can see, like, there's a manifest file.
458450	460890	I'm just naming it test extension for now.
461070	464610	And in this, I'm inserting a content.js file.
464810	470870	So if you see here, there's a js file here, which is simply just going to write a text on the page.
471390	476850	So, you know, if I go back to my browser, and let's say, you know, I try to load this specific extension.
481670	487330	And if I disable it, now, if I try to access a website, let's say Google.com, it loads normally.
487610	498110	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.
498710	503990	Now, this is how basically content script works, like, you know, you have a way to inject something on the web page.
504490	510570	Now, if you see this specific extension, there is no permission key here.
511110	522730	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.
522790	529950	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.
530470	537210	Now, coming back, one of the biggest problems that arise with this is actually remote code execution.
537490	548090	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.
548090	551610	And I'm sending that code to execute on any random web page.
551610	553330	Now, this is quite dangerous.
553350	557410	So to avoid this, a lot of changes were done in the mv3 version itself.
557410	565010	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.
565010	573630	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.
573970	576810	However, there are ways to bypass this as well.
577250	585910	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,
585910	588690	and if I try this with, you know, just an eval,
589490	594730	now this is how eval looks like, you know, you're sending a string, and this string is going to execute on the page.
595070	604070	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.
604170	608330	The reason being that it has been blocked because of the CSP policy.
608930	618290	However, JavaScript is a funny language, so you can actually access the object, the functions, like normal arrays or objects as well.
618510	625370	So if I go down and I write simply something like this, like, you know, so I specify my write within the square brackets,
625370	629550	and the argument in a simple string, it'll actually work as well.
629550	638250	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.
638770	648470	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.
649210	657770	And this can also be used to in fact, you know, change the URL as well. So if you see the snippet here, this will simply change the location of a given page.
659070	664250	Now, you know, the same thing can be extended by connecting this to a server as well.
664250	673090	So if you see here, I have a simple Flask server, which just returns two things. One is a function name, and the other one is just an argument.
673290	688780	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.
696610	703990	Now, if I try to access a page, it still works, and you can see a hello from server is written there.
704030	716830	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.
721850	729090	So, I think, you know, given the talk time is limited, we'll start with some demo videos as well. I think we have 10 minutes on the clock. 10 minutes?
729410	745110	Okay. 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?
745110	750490	Because it's so common that you try to access Zoom and it says, go update. And Shauri will show you that.
754180	761700	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.
761700	771580	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.
771580	787300	And the moment you click on this, you download a file. And if you see here, the download we are triggering is actually a blog-based download. 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. But actually, it was shipped with the extension.
789080	792860	Now, if we simply open that execute table, it might affect your computer.
793320	821240	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. 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. And anything which happens from the browser's perspective is in the context of the page. So, if a file download is triggered, you feel it's probably from, you know, the actual Zoom website.
821240	825820	Now, one interesting demo he'll actually show you is something live.
826980	830060	Okay. And while he's getting that ready,
831020	846680	imagine you have an extension and now you're doing a video call, right? How many of you end up using the browser version of Zoom and Google Meets and whatnot? Now, you might actually imagine that when a Google Meet call is actually happening, nothing else can monitor.
846680	866480	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.
867380	875200	So, as you can see here, you know, I'm basically gonna open Google Meet.
880530	886890	We hope the internet connection works, or else we'll show you a very quick video. Okay, we have five minutes on the clock while he's getting it.
886970	899130	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.
899650	905850	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.
905850	915530	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.
915570	924590	Now, here's the worst part. We all fear download and execs, right? Because you run the stub, get something, that's something extensions can do right off the box.
924850	930110	Is the extension just loads, looks innocent, but it can actually bring back foreign code and run it.
930110	933670	So, if you see here, we are starting a new Google Meet session.
937390	940110	Now, the malicious extension is installed.
940350	945970	So, we're going to simply open, you know, another window and open an extension page to see what's actually seen.
945970	951470	And you can see, like, you know, the live feed from that particular Meet page is being transferred to the other page.
951530	962470	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.
963750	968570	So, the key thing to realize is, you know, extensions have superpowers.
968570	977330	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.
977370	981570	Similarly, extensions are sitting one level above, you know, the page itself.
981570	985010	Yeah. We'll also look at just two quick demos right now.
985010	988030	Another one is called silent account hijacking.
988030	993030	So, in this, what I'm going to do is I'll simply have a malicious extension installed.
993230	1000390	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.
1000390	1004150	So, they have access to all HTTP only cookies as well.
1004370	1011570	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.
1011570	1015230	If you're simply making a fetch call instead of, you know, just getting the cookie value.
1015750	1024090	So, in this demo, we can see that we have a demo GitHub account and I have a private repo here.
1025490	1034910	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.
1035350	1039890	Now, what I'll do is I'll simply go and start the malicious extension.
1041450	1049290	Now, if you see, nothing really happened and for a very small moment, a small tab just opened and closed automatically.
1049570	1059250	Now, if I go back and check that specific repo back again, go to the settings and see who all are the collaborators.
1060890	1064830	Then I will see that there's one more collaborator added here now.
1064830	1072290	So, this just shows, you know, how sneaky they can be and they can actually also take over your private repos.
1072850	1079770	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.
1079770	1090690	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.
1090690	1094450	And some of these can just download at payloads and happen at runtime.
1094650	1099610	Doesn't need to be at, you know, extension, compile or upload time to the Chrome store.
1101010	1104890	Yeah, now we look at one more, which is interference with password managers.
1104930	1110190	So, many people often use extensions for, you know, using, saving their password and using them.
1110230	1113910	So, actually other malicious extension can interfere with that as well.
1113910	1120810	So, in this example, we can see that a user is using one of the password manager vendors.
1121190	1134890	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.
1134890	1147790	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.
1147910	1150970	So, if we can see here, it's still the password manager's icon.
1150970	1155850	But the moment I click on this, it will take me to another login page.
1155850	1165150	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.
1165290	1168370	But, you know, looking at the URL, you can't really figure that out.
1168990	1176050	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.
1176430	1180130	And the moment they do that, they will get phished.
1180130	1188290	So, we've run out of time. I think if you're interested, all the source code, everything we have here, you can go to sqrx.com.
1188490	1193290	We'll put all of that up. We'll also put up a much more detailed video. We only got 20 minutes.
1193510	1201730	We have a lot of research. Now, the key summary is even known extensions on the Chrome store get bought out all the time.
1201730	1210830	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.
1211110	1216410	And that means, you know, extensions you trusted could now automatically be untrusted.
1216410	1221930	And a bunch of other supply chain attacks which can kind of happen in the context of the Chrome store, right?
1221930	1227050	Thank you so much. And, yeah, please visit sqrx.com for more. Thank you.
