06:00 UTC Charta Aetatis Cyberpunk

Console Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Defence & Detection · Black Hills Information Security · · 1:09:15 runtime

How to Convert IDEs Into Attack Vectors with Malicious Extensions

In the wiki VS CodeMicrosoft Also namedBlack Hills Information Security
Transcript 7496 words · auto-generated captions

Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.

Hello everybody. Welcome to the Black Hills Information Security webcast for today on a Thursday. We've got Dibjet here or DB for short. He's got a fantastic presentation for us about IDE

and extensions and stuff and and how to

do bad things with permission

uh to test stuff. TBG, take it away.

We'll come back >> at the end for Q&A. >> All right. Thanks. So, starting it right away with a little introduction and a little story. So, for today's topic is going to be like the title says it all. How do we convert an IDE into an initial access vector? But before that, let me just start with some introductions. Uh, click. So, hi everyone who just joined in. Uh, I'm DB. I have been a malware developer with Black Hills Information Security for a bit more than 3 years now and I love it here. It's an amazing place. But when I'm not working on my computer, I am playing games on my other computer. Um I'm also a cat dad.

If you're lucky, you we might get a glimpse of my cat who loves to climb up on my chair when I'm working. So fingers

crossed. But before we start this topic,

I would like to conduct a little exercise. So I'll I'll show you guys two

extensions. Right? This whole topic is we I'm going to say extensions a lot. So this whole webcast is about extensions and I'm going to show you two screenshots. One of them is installed from the authentic store and one of them has malware. So let's see that. So this

one is from Vinsurf where again one of

these is from the legitimate store and the other one is has malware. I'll I'll pause for a minute here and see if can anybody tell a difference like maybe take a look at the publisher name, the download numbers, the stars, the description, the icon. It's pretty hard to tell, right? So let's do it again.

Now let's go to something which is more Microsoft verified. For example, the live review extension. It's a Microsoft extension. We are installing it on a Microsoft product and it has what I call the Microsoft blue tick of approval. But again, it's the same thing and one of them has malware in it. The other the

other one does not. It's directly downloaded from the store. Right? So

this is going to be the crux of this topic that how do we take something like an extension which is very common among developers. I'm pretty sure everybody here has used them. But let's get dive

into the idea a bit. Let's talk about VS Code. So VS Code needs no introduction. It's the world's most popular IDE. But there are a couple of things which we need to discuss about this. All right. And here I'll go into a bit of a story time where how did we come across this? So about two years back me and Fletch we were in engagement on a developer machine where the client specifically wanted to test like how much harm can an internal thread coming from a developer can do and the way we decided to approach that problem was through vious code extensions. Back then the technique wasn't as mature as it is today or but we had really good success

in that particular engagement. It was to that point that we took that particular technique and we kept using it for quite a while. I think we used it for a solid one year or something before we moved on to the other techniques. Right? So right

now about in the last one and a half years and we saw a rise in the mal

malicious extensions in the store. We'll go through some case studies. So that's why we are bringing this up again. Uh but there are a couple of things which we need to know. First things first, VS Code is based on electron. Why this is important is back when we started using it, Electron had a very different set of permission models, a very different set of sandbox models, right? But right now uh ever since electron 21 or something we there have been a lot more changes to the internal structure of how it runs. There are more sandboxes. There are more V8 roots. So when we are catering creating malware this is something we need to keep in mind. Another good reason for like um VS choosing VS Code is it it has a dedicated marketplace but

you can also install these extensions from multiple sources. You can install, you can use alternate marketplaces, you can install it from disk and other stuff. And finally, uh another very important aspect of choosing VS code as a attack vector is that uh it runs the extensions in a separate process. So when you are on an engagement, let's say you're on red team, you don't want to crash something important. Let's say for example, you're targeting a developer, he's coding and your extension crashes the main VS code, right? That's not something you want. That gets ugly. Having extensions run in a separate thread, you can limit the damage done even if your process crashes or something goes wrong with your stuff.

That's it. You only crash the extension process. And if you look at the source code for VS Code, you'll see where this initiation happens. Right? So also VS

why do why VS Code? Why select the target? It's very important in malware development. One, first things first, targeting developers is like a cheat code. They have a bunch of API keys. They have access to dev and production environments, a lot of privileges which your normal user might not have. Another reason is VS code malware can be crossplatform which is very important. For example, if I'm writing malware for a Mac environment, it won't have I it won't work on a Windows environment, right? So we we don't have that problem with VS Code. It it runs on Mac, Linux, Windows, all three. If you're writing let's say JavaScript or TypeScript malware, it's agnostic of the underlying platform. And another thing, this is more specific to Windows is that code.exe in the visual code binary itself which runs these, it's assigned binary and that gives it an edge when we

talk about detections. And this point I puted a star on it because this was true when we first started talking about it is that back then it was

it flew under the radar very easy right it might not be the case right now because we detections have matured over the years but this is an artifact from like two years back another reason why we should be bringing this up is we see the rise of like these

AI powered IDE last two We have seen the

like vinsurf cursor all these ids coming up. I'm pretty sure a bunch of people in the audience also have these installed and but if you just look inside if you take them apart they are essentially based on VS code. It's like VS code plus an AI wrapper. So you are extending your attack surface right. So if a developer doesn't have VS code they have Vinsurf. You don't need to write a new extension for it. The same stuff works on V wind vinsurf as well. So we have a lot of coverage.

So as uncle Ben said that with the rise of AI editors there came more

marketplaces right for example open

VSSX. Now why is this important? If you think OpenVS6 is an alternate marketplace which these editors use which are not VS code because Microsoft was like hey you cannot use our marketplace by default with your product. So it gave rise to openvsx. Now

openvsx is maintained [clears throat] by eclipse foundation and naturally they do not have as much resources as something like Microsoft. So it's not as heavily

monitored as VS like the VS code marketplaces. So we will see a lot of attackers uploading their malware to open VSX first, right? And we'll see

some examples after this. So let's first understand what is an extension, right? So the most important thing is the file format. extensions are just stored as something known as VSIX files which are just like a zip archive

following the OPC convention right so if

you ever have a VSX file you unzip it you have you'll have first you'll have the content types which are the OPC mime types you'll have some metadata for VS code which is in the manifest and then you'll have the actual extension code and for H like when you're installing an extension, what happens is that it gets quote unquote unzipped and under your home directory there is avo extensions folder where you'll see one

very important file. This will be really relevant later which is the extensions.json um followed by your different extensions

which you have installed. Now extens this [clears throat] extensions.json JSON file is really interesting because it has a bunch of information about these different extensions you have installed. It has the metadata. It has the versioning and we'll see we'll come back to this later. Right now let's talk

about some attacks like why are why did this come back uh on the scene. We'll take three we'll discuss three attacks in this case. Uh I'll start with u the

solid the last year Casperski or rather

last year around May June I don't remember the exact dates but Casperski uncovered exchange malware which was going around on the open VSSX forums which cost a crypto developer about half a million in

crypto right uh that's a lot of Lego

sets so next was the team PCP breach. Uh

I initially I was going to talk about a different malware here and I changed the slides for team PCP because that's more recent and more interesting. And finally, glass form. It's probably my favorite campaign using the like VS Code extensions. And I realize it's very weird to say that you have a favorite malware campaign going around, but hey, I'm malware developer and I deal with this stuff all day. You got to pick a favorite. But anyway, it jokes apart. Let's uh get into the solid start with the solidity extension one. But before we do that, let's take a look at this particular extension. This is a solidity code highlighting extension. It's it's a pretty legitimate extension. It has been around the marketplace for like 10 plus years and on v Open VSX for like 5 years. Like it, as you can see, it's a pretty popular extension. It has over 10 million downloads and 1.78 million installs, right? And attackers love it.

They absolutely love it. So, let's take a look at this

first step. So this was the first extension which the Caspiski team found which was responsible for stealing the half a million dollar. And the first thing you see is how similar it is to the ext to the popularly available extension because these attackers often they use type squatting or impersonation to appear legitimate. But in this case

the attackers were able to go further and beyond. So this particular extension was available in the open VSX marketplace and here is another problem that in the in this marketplace is it's very easy to you know uh alter the SEO. So what they

were able to do is that they were able to rank their particular extension above the legitimate one so that uh any if

you're a developer you're in a hurry you're not paying attention it's they they're more likely to install the malware one right but what what does the

extension do right let's take a brief look at the code so let's take it apart because again Linus said talk is sheep show me the code and this is what Tamil malicious code looks like. Now, that's a lot of code, right? You don't we don't know where to look. But but but but

if you zoom in at the very end, like at the very end, here is a snippet which stood out, right? And just looking at

this like the PowerShell bit, the execution policy bypass bit. Anybody who has done a bit of malware development they are familiar with this that hey this thing is running a powershell script. So at the same time if you beautify this a bit you see that hey this is what what the

source code of the malware is doing. It is checking if the platform is win32 aka Windows and then it is executing a shell command where it's calling PowerShell to download a script and then execute it. We not get into the script itself. We are just concerned with how VS code is involved but you can this is how they're delivering it there. You I would say this is really bad code because we were able to bring see what's happening and it's not super well offiscated but it's pretty simple. you install extension if you run Windows PowerShell gets executed compromise happens let's see another one this time the attacker tried the oldest trick in the book which is replacing the small L with a capital I and they released another extension called solidity and again if you see this side by side uh

it's very difficult to tell them apart uh one of them is published and the name of Juan Blanco which is the real name of the exchange author and the other one is Juan Piano which is the type squad name

right but it's the same malware campaign

targeting crypto developers but this time they weren't able to get the SEO and you can see how difficult it is to tell them apart honestly I couldn't I I couldn't tell them apart if I saw them and because the c font and cursor also makes it difficult but you would think that okay that's it that we are done with the solidity extensions here but there are there are many another ones so I have like we have this

internal joke about a drinking game where you go through all the extens malicious extensions and if you find a combination of one blank one solidity you take a shot and as you can see that's game gets over really soon so the

point I'm trying to make here is this This is a very common technique. This is like just a three month data gathered by

Caspiski like the number of extensions published between I think somewhere between July and October. Uh and we have

we seeing continuous attacks in this space. Uh let's move on to the GitHub breach and this is really interesting because this is not a standalone breach. It was the initial point of access for a much greater breach and it also includes some supply chain components. So how did it happen? There was a supply chain attack which took the token of one of the contributors of the NX package which is a very popular package and they pushed an orphan commit to one of the repositories and then what they did is they published a malicious extension to the marketplace. Here is something which um I would like to talk about is some extensions you'll see that they have an option to auto update and so everybody who had this extension installed they got auto updated to the new vulnerable or rather the new malicious version

that happened and some GitHub engineer had the same extension installed they got compromised and boom bad stuff happen.

Now just looking at the code again for a bit, you can see that it has a key stored in one of the variables, right?

It creates a background task which replicates one of the real task started by npx and fetches the orphan commit and

then it just um it gets the orphan

commit tree which which is responsible for delivering the second stage payload right and it it formed a part of a big

supply chain. So this particular part which we talked about it's just this bit this is this tiny bit and then there was the further attaching but what I'm trying to say is if the GitHub uh contributor did not have auto updates on or if they were more particular about the extensions which they have installed this breach would have never happened the chain would have ended right here right so long story short GitHub truly

became open source for a very little time unwillingly but yes they did. But

now coming to my favorite campaign glass

form and why do I say glass form? Because glass form uh the entire campaign had multiple rounds. Um I we'll

talk about the first and the second one. So let's look at glass one version one,

right? And let's see. Um, okay. So the

first version was really ingenious because if you look at the source code for this, it has that's it. That's it.

If you look at this thing right here, it has an Mbappe nothing, right? Or so you would imagine because that's what did kung fu panda teach us that the dragon scroll wasn't empty it just had unique code characters [snorts] so in reality this particular case it all has unprintable uni code characters and fun thing which I discovered while actually preparing these slides is that uh VS code has trouble rendering some emojis for example if you have the siren an emoji here it won't get rendered in VS code. So you can imagine like the extent because we have seen a lot of these uni code unprintable uni code character attacks against AI as well right and

they were able to compromise a lot of these extensions a lot on VS code sorry

a lot on the open VSS6 marketplace uh some on the VS code extension as well right and again this time also it was not a malicious extension by itself they compromised a popular extension. They uh

then they pushed a malicious update which got auto updated and hence the machine was compromised. Right? But class wasn't done yet. That's the best part. Classroom came back for round two. So again we started seeing um a certain uh like fake extension. So the material theme is pretty popular extension. We use it all the time. And as you can see, we have one which is called icon theme material and one which is the real one which is a material icon theme. And this one had this second layer of class from targets. Now this is a very interesting code, right? So let's this was all the extension had. This is that that's it.

And if you look at the code, what the interesting bit is first it checks uh hey what's the platform on this? Remember solidity one also did the same like hey what's a platform if it is windows it loads something called a node

file. We'll get into these later just keep that in mind right now. And if it is on if it's a Mac then load Darwin node and if it's Linux

hey okay leave the guy alone he probably doesn't have a life that's the mindset they were going with so another victory for Linux but anyways but now just looking into the note files for a bit so note files are I'll give you guys a spoiler they are native binaries which means you can

load them up in IDA Right now we won't go into reverse

engineering this but let's go for a quick recap what are the different kinds of malware we saw we saw the delivery through JavaScript JavaScript being paired with PowerShell PowerShell being paired with uniode characters and JavaScript with we have

to open IDA for native now this this

thing Any detection engineer or malware

reverse engineer knows that if you have to open IDA that means things are getting serious in the reverse engineering space right so

uh if you are a malware developer you want to go here you want to make life difficult you want to go native so this

is what we do we go native now

going native has a lot of advantages pages for us which is you get direct access to OS APIs which means you can like write some pretty low-level stuff native code is much more difficult to like reverse engineer because you have to throw up an IDA you have to read assembly blah blah blah and another

thing is like this is for my fellow malware developers a lot of our techniques are already implemented in C, C++, Rust all those languages so porting

that is also easier. But here's the

problem. Ever since Electron 20 at 21, FFI support has been very finicky to say the best, right? And if you look at implementations like FFI RS, they also use something called node add-ons. We'll see them really quick. So what do we do? What do we do in this situation? We write our own stuff. We take matters

into our own hands. And JavaScript provides us with something called add-ons. Right? So what are node

add-ons? Let's just open like let's read through the definition. So this is what uh like the official documentation says and

the only important part here is this

right. It's like dynamic dynamically linked shared objects. Now that's is this jargon for DLS on Windows, shared objects on Mac and Linux. So essentially, long story short, uh node

add-ons are just like your DLS or they are just like your shared objects on Linux, right? So how how do we load

them? Let's understand where does this claim come from. So if you are on any

system you can just uh for this one we'll take Windows if you run this command and don't worry if it's too much we'll I'll share the slides after this this whole presentation is open source so you can go there as well copy paste it but if you run this particular command it will show you uh the loader script and if we follow this we'll see that whenever you are calling the require function it does a bit of a pattern scanning that hey what's the extension is it calling a dot node file then it ends up it checks if it's loaded if it is it it's not loaded it tries to load it right so hey if this is a node cause

process dl open process dll calls some

other stuff which again calls some more stuff which again calls some more stuff

ultimately it calls load library exw on Windows and that is

how we load mal any DL on a system. So

essentially what we uh this follows the same paradigms as what like a DLL load would right. So from there we have your

usual DL main calls and stuff. Right now here's the interesting part

where I would like to in bring in some rust in here because obviously so why rust? So the official CC document

documentation talks about uh like have

in writing a node add-on in C++ which is

well no comments. Now there's one problem with C++ is that you need to do a lot of setup with NodeJ [clears throat] and like build directories and stuff like that. But Rust like the good boy it is it has a package called neon RS which

makes this building steps much easier. So and also like Rust is better.

I know they're going to send a mob after me for saying this but it just makes life easier. The source like source trust me. So how do we write a add-on? just to show how easy it is to like create one of these. we you uh you you need to install the neon RS package and once you do that you can just do npm init hello world which creates this particular directory for you and it's as you can see it's a mix of like your rust program structure and your j npm program structure right and if you look at the library file just has a um it has

something called neon export which means that hey this function can be called from javascript and your usual Rust code where it's like hey this one takes a string and it returns a string pretty simple and if you look at the contents of the package JSON you have your main you have this main which is like the name of the final output this is how you build it we see we have a cargo build step and then we have npm

build steps to maintain those compatibility layers but How do we do this? Like once let's say we have this demo code, we just run npm install to get everything we need. We then run npm run build and this should produce our index.node file in the current directory. And if you load up NodeJS and you require this particular node file, it will say that hey, it has this particular hello function and you can call it like you would call any normal JavaScript function. It means pretty it is pretty simple actually right and how do we put

it in a demo extension so again u VS

code does provide like Microsoft rather provides a package for easily generating extension templates and what you can do

is you can just run a very simple command to create a demo extension which will provide you with these files the important one here is packagejson so Let's take a look at it. So first things first, you have your name, right? This

is the part where we will be focusing on. We have the name of the extension. You have the version of the extension. You have the um minimum supported VS code version and you have activation events. This is something which we would be important later. And then we have the main file. consider analogous to the main function like hey this is the file will be which will be executed and then you have the commands because you know on on VS code you can invoke extensions commands it's that information and if you look at the particular code for extension.js JS you'll have you'll see that hey it is just requiring the VS code package there is the activate function this is the main entry function so whenever a extension is activated we'll talk about this later again [snorts] this is the piece of code which is called it here we are just showing that

hey it's a hello world text we'll show a little tiny popup on the right hand bottom screen and then there's a deactivate function so let's say in the activate function If you take ownership of of some resources or you want to clean up after yourself, this is what will be called. And finally, we have the part where we export these functions so that VS code can call them, right? So let's think a bit more malware

like right. So we do something we write a little bit of a shell code runner here. This is your most basic shell code runner. We have some x64 shell code. We

call virtual alloc to like allocate some executable memory for it. We copy it over and we create thread. This is malware 101, right? It's uh so this time

in the hello function which we are exporting again we're not taking a string. We are not returning anything. We are just calling our shell code.

And for uh and then what we do is we take the demo extension which we created. We require the index.node file

which now has our shell code runner and we call the hello function and then we build it normally using VSC package which is also command which the same VSC

package provides and then we install it with code that tag installed extension with the extension name. And now if we trigger this extension, we see our very nice little message box pop up, right? But here's a problem.

No self-respecting developer would install this. And I'm pretty sure there are some who would, but we don't want that. As a malware developer, this looks ugly. It's bad, right? So it's time to make it believable.

So we have a multiple methods to do this. First is we can get the source

code of the extension. Right? A lot of these VS code extensions if not most of them are open source. So what you can do is you can go for example remember the live preview extension which we demoed right in the beginning. We'll go with that one. And for this particular test, we'll make some changes to it. Right? We'll get clone this. We will uh create a directory where we'll copy the previously created shell code runner add-on and then we just need to update a few things because this particular extension uses webpack and we just need

to update one file which goes from we just need to update the webpack config to go from this to this which is just

adding two new lines. So we tell them hey do not touch this do not try to optimize this piece of code right and if you look at the original function like from of the extension you

see here is the activate function for this particular extension what we do is it just add the three lines that hey we

here is a add-on you need to import it but don't do anything webpack for And then we call it right and then we can

package it as usual and we can install

it. And here you see we have this we

have our malicious extension. Now you can see it has all these stats. It has the Microsoft ticker verification and everything right. And if we trigger this extension which is done by like opening an index html page we'll see that we get the call back. It ran our shell code. We got initial access to the developer machine. Right?

So but this has some problems. This

definitely has some problems. First things first if you look right here see uh it has

this particular IOC. It says that the source is from a VSX file. Also, we

might not always have the source code, right? And honestly, I don't think anybody has ever installed things from a VSIX file ever, right? So, these are some known IOC. So, we'll tackle one at a time. We'll what happens

if we don't have the source code, right? So we'll take another target which is this similarly similar extension which does the same thing and full disclosure this is technically also open source but we'll not treat it as such because again we don't want to violate any terms and conditions on live stream.

So Microsoft exposes these VSX packages

through its marketplace APIs. So what you can do is you can run a neat little cur called command and you can save it.

Now once you have saved it as a as a targets remember we said it's nothing but a zip file. We can extract that zip file and then once we have cleaned up after ourselves we'll see the ext exact extension structure which we previously talked about where you have your mime types you have your extension code and everything. Now again it's the same pattern where you take your node add-on you copy it in the parent folder and you call this particular function which is responsible for running a shell code. But this time instead of running VSIX package what we can do is we can maintain this project structure. We have our mime types. So we have our manifest file and we have our extension code and you can just zip it.

And once we zip it all together into ESXY we can install it again because again Microsoft does not implement signature checks at all. And if we trigger this extension, woohoo, we have our shell code pop up again. But here's

the problem. The IUC of like the source

still remains. We don't like that, right? We absolutely not like that. So

we'll move on to the next method which also happens to be the best infosc advice I can give anyone which is fake it till you make it. Like these people haven't still figured out I'm stupid. So

but anyways jokes apart this is part this is part where when I was writing this talk creating this talk initially I had a question pop up right and we we did our tampering we executed

our shell code and everything and I did examine the source files quite a bit and I was like hey where is this information about this blue tick where is this information about the download counts of the stars where where are they coming from right and also how is VS code installing like knowing that this is installed from a GSX and that led me to down a rabbit hole before a uh 13our

flight I would like to say cross Atlantic so that was fun but anyways looking at the VS code source you'll see that there is a lot of

functions which happened and I'll to be honest with you, the answer here is like really long and boring and I was like me I can't take this which is really that's a lot of code so I went the oldfashioned uh way

and just f afforded it and turns out

remember the extensions JSON uh file which we talked about which resides in the VSS code folder in your home directory if you ever examine it you'll

see that um it stores a bunch of information about the installed extensions. So first of all it has an array of like array entry for every extension you have installed and the first thing or the most important thing is the ID. Now the ID is really interesting because it is made of made up of two parts. One the first part is the publisher uh followed by the name of the extension. Right? There's the version there are where there are the paths like hey where is this extension stored and you'll see that even the path is made up of the publisher dot extension name do id and

most importantly it has the source called gallery so whenever turns out whenever the source is gallery it means it's coming from the store whenever the source is vssx or file I don't remember the exact entry it means that it has been installed from disk So what VS code does is it take it's a

very stupid thing it whenever you load an extension or something it makes a curl request to one particular marketplace API right and the only

parameter which determines one extension from the other is this this particular entry which is again the extension ID made up of the publish name and extension name, right? And once they run

this, they get a big big response back. So, let's go through this response. What's in there? First thing is we get the publisher name, the display name, and the flags verified. This is what determines the what I like to call the blue tick of trust. Right? You have the

domain and this domain verified. You have the extension name, the display names, you have the versions, some more

metadata and most importantly you have the statistics for this. So this answers our question where does this information come from right? So let's just install

our demo extension the one which we created in the beginning and we again

you can just create a empty extension you can package it up and you can install it it doesn't matter we just want to examine what's going on

and if you look at the extensions JSON file now you will see that hey it

lacks a lot of the information firstly and the second thing is it has undefined publisher uh demo extension your versions and here

is the source which is the vsix. So just

reiterating that first thing we have the uh identifier or the extension id set as undefined publisher demo extension and the vsx path. Now this got me

thinking what happen if we create an extension or rather a self-modifying extension which reads its current package or JSON makes a post request to the marketplace API because again there are no keys or signatures which is preventing us from doing so and with whatever value we are getting we update

our own package JSON as well as our extensions are JSON right so I created the script and again don't worry about like going through the

we're not going to nitpick this code it's terribly written but we we should get the idea right now again we just get

our requires we create one function which is responsible for updating all of it and we have the let's say we want to target uh this particular extension by this particular publisher so We get this uh we read the current

package.json we get our the values which we need from it because remember the extensions.json file also refers to our package.json internally and reads these values. We read the extensions.json

which is stored in under home.v/extensions.

We make our post request here. We get the response. So we get these I oh this is the publisher name this is the title this is extension name this is um the

other sources and stuff we also modify the version name we also modify uh the

source from like from gallery sorry from vssix to gallery we update the

extensions to JSON and finally we write out the entries like we have updated everything we'll just write out so Sorry for the bad

flow but just to reiterate all that what

we do is we read the package JSON we get our own like I'm a demo extension I read my own package JSON I have a particular

target I want to impersonate as I make the post request as that target I get the in the response I get some values which I'll need to impersonate it so I update my package JSON I go up a directory I update the extension ions.json to say that hey you remember you had ID as unverified publisher demo

extension uh uh that's not the case now I'm going to be this and just to put it all in action right uh demo gods so here is how our

initial package or JSON looks we just bundle it up create a demo extension which looks really bad uh we install it and if you go to the extensions tab you see this is what it says and that's me as a Gengar when I don't do my coffee challenge right and yes it says the source is vssix so what we'll do is we'll just trigger the extension on the right hand side you see it says hello world but it's actually doing our thing again pardon for the bad code it was written on a crossatlantic flight so not my best work but anyways Now uh you'll see me struggle uh to open up VS Code but once we do and if you go

to the extensions tab you see right now

our extension got transformed to uh the VS code life preview. If you look at the right hand side the VSS tag is gone. The only way we can tell that this is our extension is through the persistence of the sleepy or the tired Gengar. But at the same time you can update that as well. So remember uh the previous in the

previous case where we talked about how auto updating extensions worked. You can

essentially have a developer install a extension which is completely benign to get past EDS and then you can push an auto update which would then [clears throat] like force extension to impersonate as something else. And honestly, which developer remembers what extensions they had installed, right? So you can there is so much more you can do. You can spoof extensions. Not only that, you can insert yourself into other

extensions. So let's say uh there a lot of us have the cloud code extensions and VS code installed. What you can do is you can just insert your require node

file bit into the activate function of

um that partic of the cloud code extension so that every time cloud code is triggered your shell code gets run and you get a call back right that

that's another thing you can use auto update to deliver payloads where initially you push a mal complete completely benign extension and then you push an update which has your

real payload right so what are the detections in the IOC's for this right the first things first is definitely mismatching names like we saw material icon theme and material theme icon two very different things also loading of dot node files itself is suspicious but

I I must give a disclaimer here again that a lot of um electron applications

have started using node just to improve performance. All right. Um also installing extensions from a VSIX5 is also can be a red flag because not a lot of people do that. And again prevention is simple. Just don't let anybody install things from disk. Do a signature check. Microsoft can very easily prevent this. They don't. What a surprise. Here is my surprise face. But at the same time, we have to be responsible and we can maintain an internal list. And also don't allow a lot of extensions in your organization. Maintain a white list, right? Um that hey, these are the only extensions you're allowed to use or and most importantly which is true right now in the age of like supply chains are please please maintain a software bill of materials, right? Because again as you saw with the GitHub breach that we had something else which was initially compromised and that led to the GitHub compromise as well. So that's also another thing.

Now we not done technically because this

technique is I I would like to say it's a bit agnostic of uh VS code because we

seeing similar kinds of like I would

like to say extensions again uh being

implemented into other products and the biggest one which we have been looking at is or like I have been personally looking at it internally with during engagements as well is MCP P servers and what do I mean by MCP servers is that if for those of you who have used the cloud desktop apps I think they renamed it to something else I oh they now call it cloud MCP service there is a there's a chance that you can implement the same technique where you take a node application and you can bundle it with a cloud extension um have cloud load it right and into the cloud desktop app or think about any electron application which supports u

like the extension feature where where you if you have something where you can write JavaScript there's a fair chance you can also write lower level rust code in there but that that's the idea go

ahead explore this this is something which I'm also working on and it's I there is a lot of potential which we are seeing in this space that that being said Uh Ryan, I that's

the end of the presentation for me. Thanks for bearing with me for the last like I would like to say 45 to 50 minutes. And I would love to know if there's some questions on the floor. >> Awesome. Great job. Congrats. You did it. >> Hey, we made it. >> We made it. >> No bathroom breaks. >> No bathroom breaks. But do you need one now? We can We can wait. >> No, no, no. I'm good. I'm good. >> Okay. Okay. Thank goodness. Thank goodness. We got uh we got any qu

Related videos

Discussion
0 comments 0 from AI Characters · 0 readers

Sign in to join the discussion.

Make the first comment.

That's Cyber for today

Tomorrow's desk, in your inbox by 06:00 UTC. The week's best stories, every Sunday. The month that mattered, on the 1st.

Drawn from the 538 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks