Next up, we have Nishant Sharma and Sourya Pratap Singh. Nishant is the Head of Cybersecurity Research at SquareX. And, yes, you can see SquareX over here. There you go. They are one of our sponsors. Sourya Pratap Singh is responsible for building SquareX's security-focused extension and works on researching methods to contract with web security risks. They will be speaking about plug-and-play, scanning, and scoring browser extensions. We'll get a walkthrough on how extensions are abused in the wild and how even well-known plugins can turn malicious, which also involves a live demo as well. So please bring it up for Nishant and Sourya. Hello, everyone. I hope I'm audible. Okay. So, we're going to talk about plug-and-play, scanning, and scoring browser extensions. So, before we start, a little bit of introduction. So, this is me. I work as a Principal Software Engineer at SquareX. And I mainly work in browser security space, specifically on web extensions. I have actually presented before at DEF CON last year at MainStage and also at the Creative Stage. This year, I'm also doing another MainStage talk. And, yeah, I've also presented my work before in Black Hat EU. And I've also conducted workshops at other conferences like the Texas Cyber Summit. Now, we have Nishant here. Good afternoon, everybody. I'm Nishant. I'm the Head of Cybersecurity Research at SquareX. I was in cybersecurity education for 10 years. I was VP of Labs and R&D at IME. You might know them, EGPT, and all of those certifications. Before that, I was with my desktop academy. So, you know, I have been coming to DEF CON and Black Hat for 6-7 years now. I've been doing trainings, workshops, and all of that. So, now the latest journey that I'm on is related to browser security and that's how we are also going to cover web extension security. So, yeah. Nice to have all of you here. I'll pass it back to Sharath, so we can continue. Yeah. So, I think before we start, I mean, a little bit about, like, what we do. So, as I said before, we are from a browser security company. So, browser security deals with everything that happens in your browser. You can see a couple of use cases here, broadly, like the browser detection and response which is, like, stopping attacks which are happening all by the browser. Then you have your use cases which are around, like, private access and things like that. And then you have, like, web DLP which happens by the browser, like the browser DLP. So, all these things are something that we work at Squarex. Okay. So, now starting with the main talk. So, what are extensions? I think most of you might be knowing what extensions are. Anyone here has never heard about extensions? Okay. Cool. So, just to give you a very small brief, extensions are, like, small applications that run on your browser. They achieve this generally by accessing the content of the page and then they can do some processing on the background as well. So, it's a mix of what you run on the page and also what you do on the background. Now, there are a couple of them, like, the most famous ones you can see here, like, you know, password managers. Then you have your ad blockers, you have Pocket and a couple of them. So, these are just canonical examples of what extensions could be. Now, why are extensions important? So, I think it's important to understand the definition of endpoint. So, earlier, the endpoint can be easily used for anything, which is the overall machine. But nowadays, like, more than 90% of the work that we do is actually by the browser. If we just exclude the developers, then it might be, like, 99%. Like, most departments would just use, like, maybe Outlook or Slack outside. But other than that, they're just spending all of their time on the browser. And that's how, you know, all the malicious actors are also evolving. So, earlier, there used to be, like, a lot of attacks via some, you know, malicious files on your endpoint. But now this endpoint has been shifted to the browser. So, you're seeing more things coming via the browser. And that's why extension is also one of those things that we all need to focus on to help, you know, protect against. Just a couple of, you know, differences. So, this is the one from 2024. We're just talking about how close to, you know, 280 million installs happened for Chrome extensions. Which led to, like, you know, a lot of people being affected. Google also, you know, constantly looks at how malicious things are coming in on the store. They keep on removing them as well. We can see, like, you know, close to 32 malicious extensions were removed in 2023. And which had a download count of 75 million. And that just shows, you know, how many endpoints, the new endpoint notion those malicious extensions have reached to. So, there are some couple of recent events as well. Like, you know, there were many... I would say spyware as a term for these kind of extensions as well. Because they're trying to spy on the data. There have also been supply chain attacks. So, there have been companies who have been compromised. And that... like, one example is this one. So, the extension itself was compromised. And since this extension was installed across multiple enterprise endpoints, all of them were, you know, it was distributed through all of them. So, a single mistake can lead to a lot of issues as well. So, before we understand how we can go ahead and analyze extensions, it's important to understand how an extension structure looks like. So, like I said before, an extension has a part that runs on every page. And then there is something that happens on the background. So, what you see here is those four components. The second one that you see here, service worker, is something that runs on the background. The third one is the content strip, which runs on every page. The first one that you see is called a manifest file. So, manifest file is a single JSON file, which is present inside every extension. So, if you go ahead and download an extension from any of the stores, for example, let's say you download it from a Chrome store, the format is a CRX file, right? So, this CRX file is nothing but a zip file. So, if you just run a simple unzip command on top of it, you can see the structure of whatever I'm talking about out there. Now, lastly, there is one more thing. So, sometimes extensions also have HTML pages. This could be like dedicated pages or something that appears when you click on the extension icon. So, those are the fourth point mentioned here, which is pop-up or HTML pages. So, these four components are there in almost every extension. Some can avoid a background process and some can avoid a content script as well. But this is what is there in most of the places. Now, the whole model of extensions is based upon pre-declared permissions. So, whatever permissions an extension requires, it needs to specify that in the manifest file. So, if you see here, this is an example of a manifest file and it is always located in the main project directory. And in that, you can see that you have your name, description, content script. So, in this example, it says that this is the content script which is going to get executed on this particular page. Not like all the pages. Now, talking about the extension architecture in general. So, what happens is that, as you can see here, there is a red line here. Like a red dotted line. This is what we call as an isolated world. So, your extension scripts and the scripts from your page, both of them can run at the same time on the page. And both of them can access the DOM. However, there is a risk here that, let's say, a website uses a variable A and your extension code also uses a variable A. There might be a bit of conflict. And people can make websites which can, let's say, modify those variables which could cause an extension to break as well. So, just to keep it separated, there is something called as an isolated world which is the default mode in which, like most extensions, content scripts run. So, by this, both the page's script and the script of the content script, both of them can access the DOM, but they will have separate JavaScript variables. They will not interfere with each other. This provides a bit of security for the extension itself. However, you have an option to run it in the main world as well. In that case, the dotted line will go away. Then we have the browser process and then we have an extension process. So, the browser itself divides all these things into different, different processes. So, let's say you run your own extension. So, the service worker and everything will go in your extension process. And what you see on the tab is going to be your renderer process. So, now, what I'm trying to show here is that if you have a piece of code written by an extension running on a tab, it will run on the same process as your tab's process. So, as you can see on the left side, the renderer process, this is what your tab process is. So, within that, there's just like a dotted, isolated layer, but it's running in the same process. So, if let's say you have something outside and it's trying to figure out which process is the extension contributing to, probably people can just look at the service worker side, but the content script will be difficult to distinguish because it's all running as part of the same process. So, how are extension permissions created? The whole notion is based on the principle of least privilege, PLP, and developers have to declare whatever permissions they need right there in the manifest.json file. However, I won't say that the structure there is perfect. So, if you look at any extensions out there, let's pick Grammarly as an example, it can literally run on every page. So, it just needs a host permission, which says I can do some modification and read the content of the page, modify something on the DOM. So, that permission is so common that most of the extensions have them. So, it's just very risky, or it would be a very broad way to look at just the permissions and take a decision. However, permission is a very good indicator as well. Like, let's say an extension is asking for cookies permission. That's like a risky permission. It means like an extension can extract even HTTP-only cookies from a given page. So, of course, the very first check that you can do is actually based on permission. And that's how we will begin our analysis. So, coming to the analysis piece, the very first thing we can check for is the permissions. So, as you can see here, there are some permissions that you can actually go ahead and justify. And when I say justify, the context of the extension itself is also important. You cannot just say like, hey, if it's a cookies permission, it's fine. But who is asking for this cookie permission? That's also really important to ask. Like, as an example, let's say there is a developer extension called Cookie Editor. Now, the purpose of the extension itself is to allow developers to edit cookies. So, in some cases, it might still be okay, because it makes sense, right? Like, you know, someone would want to edit their cookies as a developer. So, it makes sense. It depends on the organization, whether they want to allow it or not. However, if you have, let's say, an AI extension, which is just going ahead and helping you get some results on the page, why would that need a cookie permission? So, you also need to justify a particular permission is why it is needed by that particular use case. So, it's important not just to look at the severity of the permission, but also justification of why you really need it. The next one is about metadata, which I would like Nishant to explain further. So, as we discussed till now that extensions are the new viruses, and currently the way we analyze them, the way we assess them, the way we contain them, it is in the same phase where your malware containment and detection and mitigation was like 15 years back. People have just started to see extensions affecting things on a massive scale, and you have seen some of the news clipping. You have extensions where 100,000 downloads are there, installs are there. They were good all the time, and then something happened and it turned bad. And they're already there. There are policies across your enterprises which can let you block, control what kind of extensions your users can install. But if it is already installed, and if it goes bad, then what do you do? So there is no straight answer, just like Saurabh mentioned. Even with the permission analysis that you do, even if it is context aware, you are checking what this extension does. Does it really need this permission or not? That's just one pillar. And that is why you need a more complicated flow or assessment to see if something is benign, risky, and malicious. And as you can imagine, saying something is malicious obviously requires a proof. It's a big claim that you're making. Whereas risky is the place where it has a lot of power, it can go bad, it has the power to do real damage if it goes bad. So with that in mind, we are talking about five other things that we have built into this tool that we'll make available for the extension analysis. Second, obviously, is the metadata analysis. What does this mean? It has different levels. Easy one, obviously, is the number of installs, number of reviews. You can do sentiment analysis and keyword search on the reviews. And that will give some things away. Sometimes if you go on these very I'll say free extensions, and you'll see that in the reviews it says that it looks like what it is doing is not what is mentioned in the description. So by doing that, we are able to catch some things. Then there are second degree things. So for example, your extensions, most of your authors, they don't really provide you the address, the office address. If they are not providing that, that can be a factor. If they have provided it, we are plotting it on the graph as you can see here. We also analyze it. We try to analyze if there is a residential area where this office is located or if there is a commercial area where it is. If it is out of nowhere, then you know that something is going wrong. Same goes for the domain, the email address. So if you do a hoist on it, you'll know how old it is. So what is also happening now is in addition to takeovers, where you are hacking the person and then taking over their malicious extension, there is also a secondary market where you can buy and sell these extensions. So if you have a free extension which you have been supporting for 5 or 7 years, people are approaching these people and then taking it over. And the problem is that currently there is no way for you to know that the ownership has changed. So for that you need continuous delta analysis monitoring. That's what we call it. So yeah, you can do registration analysis if the domain has changed, if the domain is new, that is something to think about. Again, none of these factors alone can dictate if it is a malicious extension. But it can obviously contribute to a score that we are going to calculate, which will give you some idea. So this is the metadata analysis. Similarly, code analysis, we are living in the world of LLMs. We are living in the world of AI agents. So instead of just relying on your SAST tools, which are mainly done to check your own code, you can also involve AI agents and LLMs. You can pass them these files. So for example, what you are seeing here, as Shorter described, you have a structure of an extension. In that you have designated files. You have manifest file, which will have permissions. Then you have a background.js, which will run the service worker. And then obviously you have content.js, which you put into the webpage. Now when you pass these with context to an LLM, to an AI agent, by looking at it it is able to understand what it is doing, and then it is able to mark it. And that's precisely what we are doing here. So on the top, in the table you are seeing the entries for two different files. First one is the content one. Second one is the background file. And then you are also seeing the reasoning behind it. Because LLMs are kind of a brain. They can actually give a logical reasoning why they think something is like this. So yeah, that is the code analysis. So this is different from your static code analysis. It is more about understanding what the code does, and then accordingly give a verdict, which will again factor into a larger model. Third one is also the composition analysis, and why it is important. Because nowadays you have things like Wasm, so WebAssembly, where you can compile this code into this binary which can then run inside your browser. These things sometimes this code is obfuscated. So by looking at the composition of your extension, if a lot of it is coming from a binary which is obfuscated, that obviously is a risky thing. Why an extension, which is not doing anything wrong, want to hide stuff? Why it wants most of its code to be in a binary or to be in obfuscated form? So that is also something we are taking a look at. Same goes for the number of files, the kind of files we are analyzing those as well. And this is the most powerful part. This is the dynamic analysis using your AI agents. We all know, till the time you emulate something on the browser, if you just install an extension or if you just do a code analysis of it, you won't know what it is going to do on runtime. And it is very very easy to avoid a lot of these static analysis. So just to give you an example, suppose this extension has a URL, and on the runtime it is going to fetch the instructions from this URL, and that too is based on your DGCA or DDGA, the dynamically generated domain generation algorithms. We have seen them in malware and all other places. So things like that, your static analysis won't be able to do much about. If you talk about automated approaches of analyzing the URLs, you can't do that if it is protected behind a capture or something. If it keeps changing, how are you going to do that? So that is where the dynamic analysis comes in. So what we do in this case, currently your browser tools that are there in the browser just like you use them to debug the websites, there is not much that you can do for extensions. If you want to use your Chrome browser or your Firefox to see what exactly an extension is communicating, what kind of API it is calling, what kind of operation it is doing, there is no such tool. We have also covered the same in one of the initiatives that we run as a company, Year of Browser Bugs, where every month we talk about these things. So what we have done to tackle this, we have taken a Chromium fork, we have modified it to make it act as a MITM proxy. So when you do that, you are able to intercept all the API calls that extension is making. You are able to intercept all the responses and the requests that this extension is making. And because you are sitting in the browser, you really don't have to worry about the SSL interception and all of that. You can pretty much see everything. So what you are seeing on the screen is the API call log. And we also timestamp it so that we can do correlation. So this is for the API calls. Second one is for the network traffic. So it is seeing what kind of traffic it is sending, what kind of responses are coming back, and it is also timestamped. And then the third one is the emulation part. So we are using an AI agent which emulates some activity like a user will do. Because a lot of these extensions are very smart. A lot of them are designed in such a way that till the time a real user does something, it is not going to perform anything. It is not going to report anything. It is not going to go to any URL. So to make sure that we are catching that as well, what we do, we have an AI agent. We pass it the information about this extension so that it is context aware. It understands what this extension is supposed to do. And then accordingly it creates a dynamic profile. And that dynamic profile is run on the special browser that we have crafted. And then you get this log of what it does. So now you have three things. You have API logs, you have network logs, and then you have the actions that the AI agent is performing. You put them all in one timeline. You pass this to an LLM or an AI agent. And there you go. Now you can see what you did and what happened. Reaction to your actions. And that is where you can catch a lot of things which are generally missed in SAS and Static Analysis. And then when you pass this to the LLM, again it will give you a verdict. It will tell you why exactly it is going to do this. Now can we do this manually? Can we do it as a human? Can I take a look at this and say this? Obviously yes. But do you know how many extensions are there? In Chrome store alone we have 150,000 extensions. If you have to analyze all of them, and again they update. A lot of them update on a very regular period. Every single day you have like hundreds or thousands of these updating. So you also have to do the change tracking and the data analysis and that is the last nail in the coffin of these malicious extensions. So what we do as soon as any extension is updated, if you are tracking it, we will automatically go, take it, do a delta comparison and you know you guys all have used GitHub. You know that if you have two directories of code, you can pretty much do a depth on it. You will know what are the additions. And if you can put all of this into the AI agent, again you are hearing AI agent again and again and again. But I hope you are habitual to this. You have been to Black Hat. Everyone is talking about it. This is the new technology that everybody is leveraging to solve second order problems. So that's what we are doing here. You pass it to them and it gives you the verdict. And it will be able to catch very simple to complicated things depending on what kind of code is being used. And it can mark them in risky, malicious and benign. So these are the six pillars which we feel will be able to catch an extension mark it between risky and malicious and benign. Now, is it perfect? Obviously not. In cyber security, in security there is no silver bullet. It's a cat and mouse game. It's a whack-a-mole. We are fixing this. Obviously if someone will tailor their extension to bypass our framework , most probably they will be able to. So you can tailor made it. But this is what we are envisioning for the broader scale . Not all of your 150,000 extensions are going to do this. Not everyone is going to craft it. And even if they do, we can again play that game. So here is the scoring table. We are doing weightage scoring for it. So each of these modules that you saw it contributes to that score. And that score in the end tells us if this is a risky one, if it is a malicious one or if it is a genuine one. And now just a simple demo of the platform. So this is the analysis for one of the extensions. You can see the first page is focused on the metadata. You are able to see the extension permission on this side. It is also giving the justification why it feels it should be there or it should not be. So this is the first part. It also tells you what the extensions are because some people... there are like 50 plus of these. So you cannot remember, right? You can pretty much open up Google Earth. Obviously a very simple thing to do but comes handy when it is done for all the extensions. So you can pretty much see in some cases you are also able to do the street view. Then there is the code analysis part. You have passed most of these important ones to the LLM. You have this analysis and the reasoning for it. Then there is composition analysis. You can see what kind of files are there, what are the size, what are the numbers. Then there is dynamic analysis. So this is the API calls, then the network calls and then in case of agentic simulation you are also seeing the logs that the agent has created. And based on that you can see that this one was marked benign. So there are three kind of simulations that we do. First is zero simulation. Just install the extension and done nothing. Second one is static. The activity that we are performing is static. The third one is the agentic one where it is all tailor made to the extension. And then there is this delta analysis which tells you if the additions that are done, if this seems risky, if this seems malicious and you can pretty much see the change log as well. So what agent cannot find out, maybe we can find out it by taking a look at it. So we made it easy to go through the code, to search something, even mark the vulnerabilities that are being pointed out by these tools that we use in SAST and DevSecOps. So this is more for the developer side. And again you can see the code, quickly search around it. So that is the tool that is there, that is the platform that is going to be. Now in the second example we will show you how this dynamic analysis actually helped us cover one of the malicious extensions. So this is the one that was in the media. It was a very simple color picking extension which is used to select the color to get the hex code for it. And it was installed more than 100,000 times. It was all good, all benign and one day it went rogue. And when the modified version was uploaded, what it was actually doing, it was reporting all the pages you are opening to its master, to its CNC. And then it also had a functionality where the attacker can send a URL and it will open up that URL for the user, send the user there, and because it has contextual awareness, it knows the user is going on Facebook. So it can be that URL, right? And then the user can land there and fall for the thing. So here, in the network logs, and in the browser automation, the AI agent logs, you are seeing that the agent has opened GitHub and it is being reported by the extension. This is the benefit of your dynamic analysis. Second thing, the agent has opened Google. Again, the extension went ahead and also reported that Google is being used. So same way, when you pass all of this as a single timeline to an AI agent, it actually tells you that it is malicious, it's a spyware, it is spying on you. So yeah, that's all from our side, folks. If you have any questions, we will take those. Thank you for coming to the talk.