WEBVTT

00:00.000 --> 00:01.300
My name is Paul McCarty.

00:01.360 --> 00:06.840
I am currently the head of safety... sorry, head of research at Safety.

00:06.840 --> 00:11.360
Safety is a small supply chain security company based in Vancouver.

00:11.480 --> 00:12.700
That's not why I'm here, though.

00:12.700 --> 00:19.840
I'm here to talk about open source malware and why it's invading our security toolings.

00:19.840 --> 00:22.080
I have worked for a lot of large organizations.

00:22.080 --> 00:23.860
I've worked for a lot of startups.

00:23.920 --> 00:28.640
And the problem is the same for both of those sizes, regardless.

00:28.640 --> 00:30.840
Just a different scale.

00:32.940 --> 00:37.580
So... I like to write a lot of open source tools.

00:37.580 --> 00:38.320
I'm a very prolific...

00:41.000 --> 00:43.380
yeah, anyhow, I do a lot of open source stuff.

00:43.380 --> 00:45.160
The stuff on the left is all my tooling.

00:45.160 --> 00:46.360
These are things I've written.

00:46.700 --> 00:53.000
I'm actually really super excited about Gimme Pats, Super Confused, and Malice.

00:53.000 --> 00:54.540
I haven't even dropped Malice yet.

00:54.540 --> 00:56.980
It's got zero stars on GitHub right now.

00:56.980 --> 01:07.380
Malice, basically what it is, it helps you identify malicious open source packages in the NPM ecosystem or the PyPy ecosystem.

01:07.900 --> 01:10.460
And I'm going to be officially kind of launching that next week.

01:10.460 --> 01:12.640
But all the stuff on the left is mine.

01:12.640 --> 01:19.260
The stuff on the right are projects that I hack on, that I like working on.

01:19.800 --> 01:29.480
And in particular, I want to call out the fact that who here has used the OpenSSF's malicious packages repository or osv.dev?

01:30.440 --> 01:31.040
All right.

01:31.040 --> 01:31.520
Dope.

01:31.520 --> 01:32.200
Sweet.

01:33.260 --> 01:44.580
I was the top contributor for the last six months to the malicious packages repository, but a guy from AWS has now overtaken me, so I'm number two.

01:47.220 --> 01:48.180
Oh, I'm going the wrong way.

01:48.180 --> 01:48.840
Sorry.

01:50.200 --> 01:50.740
All right.

01:50.740 --> 01:53.620
Here's the takeaways that I wanted to come away with today.

01:53.940 --> 01:58.480
How does open source malware evade security tool detection?

01:58.560 --> 02:04.980
Basically, part of the weird thing about open source malware is that it's not just the source code itself.

02:04.980 --> 02:15.820
It's the source code and the package ecosystem and all the things wrapped around it that combine together to make this amazing malware experience that we see.

02:15.820 --> 02:19.640
It's very different from kind of traditional binary based malware.

02:20.640 --> 02:24.320
It targets developers in CICD pipelines.

02:24.320 --> 02:25.360
Why does it do that?

02:25.380 --> 02:28.480
Because there's not many security tools there, right?

02:28.480 --> 02:33.060
What are the number one and two exclusions for EDR tooling?

02:33.620 --> 02:42.420
Like when an organization, when an enterprise has EDR tooling, who are the two personas in the organization that have the most exclusions?

02:42.460 --> 02:43.060
Anybody?

02:44.220 --> 02:44.700
Developers?

02:44.700 --> 02:45.480
Who else?

02:46.320 --> 02:47.560
Yep, very good.

02:47.560 --> 02:49.400
Oh, my gosh, you guys have been reading my notes.

02:50.380 --> 02:51.100
Yeah, that's right.

02:51.100 --> 02:53.660
Executive suite and developers.

02:55.100 --> 02:56.800
So why do we think that they're targeted?

02:56.800 --> 02:57.720
Well, there you go.

02:58.300 --> 03:03.560
And the reality is that there's not many good security tools that address this space.

03:03.900 --> 03:07.000
Software engineers think that they've got coverage from SCA products.

03:07.300 --> 03:11.240
Security teams think they've got coverage from EDR and other security tools.

03:11.340 --> 03:12.940
In fact, neither is true.

03:12.960 --> 03:16.760
And finally, the reality is that security teams don't understand the threat.

03:16.760 --> 03:23.240
Engineering teams maybe theoretically understand it, but security teams just don't understand the threat.

03:23.240 --> 03:25.120
And that's based on my personal experience.

03:25.340 --> 03:29.160
So why, we're here, we only have 25 minutes today, right?

03:29.160 --> 03:30.980
Why are we here to talk about NPM?

03:30.980 --> 03:33.560
Well, bad guys love NPM.

03:33.900 --> 03:35.220
Why do they love NPM?

03:36.140 --> 03:45.140
Well, NPM, first and foremost, it was built in a time, 2011, 2012, it was built in a time before, I call it before security.

03:46.380 --> 03:55.020
If you look at the original notes and documentation from NPM, you'll see that security, right, wasn't something they were actively thinking about.

03:55.020 --> 04:00.480
And that's not a criticism, it's just an observation of the reality.

04:01.440 --> 04:13.220
In a similar way, the founding people of the NPM ecosystem, in JavaScript itself, and especially Node, had this concept of no batteries included.

04:13.220 --> 04:14.640
Have you guys heard this before?

04:14.640 --> 04:16.840
The idea of JavaScript no batteries included?

04:17.260 --> 04:23.120
It's actually, if you go and look at the original documentation from the Node team, they talk about this a lot.

04:23.120 --> 04:27.520
Basically the idea here is that we don't want JavaScript to do anything itself internally.

04:27.520 --> 04:28.400
Now that's different.

04:28.400 --> 04:34.820
In 2025, JavaScript now has a bunch of internal commands and you don't need to pull in all these libraries like you used to.

04:34.820 --> 04:44.000
But by definition, it was built to basically require you to use things like left pad and is even and is odd and all these ridiculous things, right?

04:44.100 --> 04:46.340
And that's part of the problem, it was built to do that.

04:46.340 --> 04:50.680
And you'll see in a slide in a few minutes why this comes back to haunt us.

04:51.420 --> 04:54.400
All right, next, why is NPM so crazy insecure?

04:54.880 --> 05:02.440
Brian Fox from Sonosype calls the install scripts in NPM, he calls that RCE by design.

05:03.020 --> 05:10.660
And the reality is that the post and pre-install scripts in NPM were perfectly built to deploy your JavaScript.

05:10.660 --> 05:16.920
So basically there's a pre-install script that you can call, not every package.json calls it, but if it does, guess what?

05:16.920 --> 05:20.320
Before the package contents get installed, it does this thing.

05:20.320 --> 05:25.540
Similarly, if there's a post install script, after it's installed, it does a thing.

05:25.540 --> 05:32.820
So imagine a scenario where somebody writes some super sweet malicious content and then the post install script goes ahead and runs it for them.

05:32.820 --> 05:36.420
It's like the perfect RCE pipeline.

05:36.760 --> 05:39.020
Next, the barrier to entry is low.

05:39.180 --> 05:52.160
When I did my four-hour workshop yesterday, before I started the class, I timed myself to see how long it took me to create a new Gmail account, a new GitHub account and a new NPM account and it took me less than five minutes.

05:52.680 --> 05:56.840
The ease of onboarding those ecosystems is amazing.

05:56.840 --> 06:02.080
So that means that somebody can create an NPM account in a minute and immediately publish packages.

06:02.100 --> 06:10.800
And then they can use some of the other things that we're going to talk about here in a second to make themselves look better, to make themselves look like they're more realistic and legit.

06:11.020 --> 06:13.320
Anyone can claim a namespace .

06:13.320 --> 06:20.920
Not only can you create an account really quickly, but anybody, if at Microsoft and NPM is available, guess what?

06:20.920 --> 06:21.820
You can take it.

06:21.820 --> 06:23.680
You don't have to prove that you're from Microsoft.

06:23.680 --> 06:27.720
You don't have to prove that your email address ends in Microsoft.com.

06:27.720 --> 06:29.560
If it's available, you can take it.

06:29.720 --> 06:40.640
And the way that attackers use this is when there's some new hot thing, the first thing they do is they go and grab the at scope for the thing, like at immutable or at Solana or whatever the hell it is.

06:41.220 --> 06:42.900
Anybody can grab a namespace.

06:42.980 --> 06:45.280
Package metadata can be faked.

06:45.720 --> 06:46.720
This is crazy.

06:46.720 --> 06:48.300
Like this still blows my mind.

06:48.580 --> 06:53.760
Package metadata in NPM, about half of those fields can be faked.

06:53.760 --> 06:57.760
And what I mean by that is the author field, you can put anything in there you want to.

06:57.760 --> 07:00.960
You can put Linus Torvalds, you can put anything in there you want to.

07:01.360 --> 07:03.420
Similarly, you can do the same thing with the git repo.

07:03.420 --> 07:05.840
You can point at any git repo you want to.

07:07.160 --> 07:09.080
All right, so we've got some more people coming in.

07:09.180 --> 07:10.720
Sorry, yo, I started early.

07:11.320 --> 07:12.000
But that's okay.

07:12.000 --> 07:13.280
You're here for the good stuff.

07:15.540 --> 07:26.500
So this makes it really easy to make like really legit looking lookalike packages because you can literally take the original package, reuse it, it points at the original legitimate author.

07:28.460 --> 07:31.380
The only thing that changes is the NPM user.

07:32.220 --> 07:32.920
All right.

07:33.200 --> 07:35.760
Account takeover in NPM is really easy.

07:36.140 --> 07:43.560
Still to this day, it doesn't require you to NPM doesn't require you to use 2FA or MFA.

07:44.060 --> 07:49.200
It does if you're one of those super important maintainers.

07:49.460 --> 07:51.940
But still doesn't require if you create an account.

07:52.120 --> 07:59.340
And unfortunately it takes a long time to remove malicious NPM packages from the registry.

07:59.680 --> 08:06.040
In fact, I found one in December, late December of 2024.

08:06.460 --> 08:08.320
I let NPM know about it.

08:08.420 --> 08:11.460
And when do you think that got removed from the NPM registry?

08:12.420 --> 08:13.200
I like it.

08:13.200 --> 08:13.880
It hasn't.

08:13.880 --> 08:15.080
I like that guy.

08:15.380 --> 08:16.620
That's the winner right there.

08:16.620 --> 08:18.000
No, they took it out in May.

08:18.120 --> 08:18.900
May.

08:19.120 --> 08:20.960
December to May.

08:21.080 --> 08:23.060
So just say this out loud.

08:23.340 --> 08:28.920
I let them know it was vetted malicious in December of 2024.

08:28.920 --> 08:30.340
And it was still in the registry.

08:30.340 --> 08:35.580
You could download it and get pwned by it until May of 2024.

08:35.900 --> 08:37.520
Frankly, it's a shit show.

08:38.880 --> 08:40.960
GHSA and NPM don't track.

08:40.960 --> 08:42.940
So GHSA is GitHub security advisory.

08:42.940 --> 08:44.820
NPM is NPM.

08:44.820 --> 08:47.720
They don't track malware data.

08:47.720 --> 08:56.200
So for example, they don't track when they mark, when GHSA marks something as malicious, all they do is add this tag to a malware.

08:56.280 --> 08:57.940
There's no mention of the author.

08:58.200 --> 09:00.820
There's no mention of any other important information.

09:00.820 --> 09:01.940
Doesn't even say what it does.

09:01.940 --> 09:04.400
It just says that package is malicious.

09:04.860 --> 09:11.260
Now why that's a problem is I can't then pivot from the author into other packages that author has created, right?

09:11.260 --> 09:12.520
And that's a real problem.

09:13.260 --> 09:14.460
We doing good so far?

09:14.760 --> 09:15.980
Not going too fast?

09:16.020 --> 09:16.780
All right, sweet.

09:16.820 --> 09:17.580
Like this.

09:19.080 --> 09:19.700
All right.

09:19.860 --> 09:23.760
So remember how I said you can get a name space and all those other things?

09:23.900 --> 09:30.780
Well, according to a sonotype study, 98.5% of all malicious packages they took a look at exist in NPM.

09:30.780 --> 09:34.700
Less than one percent is in PyPy.

09:34.700 --> 09:40.260
Although PyPy is growing, all you Python fans, don't worry, your malware day in the sun will come.

09:40.480 --> 09:46.360
The reality is that most of the malicious packages exist in NPM for all the reasons we're going to talk about today, right?

09:46.480 --> 09:48.400
98.5%.

09:48.400 --> 09:53.840
Now couple that with, boom, this is data from GitHub.

09:54.000 --> 09:56.500
What this shows, my bag is in the way so I apologize.

09:56.740 --> 10:09.640
What this shows is the little black columns on the left represent how many direct dependencies a particular language package in GitHub has.

10:09.640 --> 10:11.600
So let me say this a different way.

10:11.680 --> 10:25.540
GitHub basically took a look at all the repositories in their ecosystem and said when I find a JavaScript package, sorry, project, not package, project, how many direct dependencies does it have versus how many transitive dependencies does it have.

10:25.540 --> 10:27.080
So let's look at PHP.

10:27.260 --> 10:27.920
Nine.

10:27.920 --> 10:30.580
Nine direct dependencies.

10:30.900 --> 10:34.680
Seventy indirect or transitive dependencies.

10:34.680 --> 10:43.020
JavaScript, ten direct dependencies, 683 indirect or transitive dependencies.

10:43.020 --> 10:54.200
The reason this is so important is because this idea of no batteries included means that the average JavaScript package pulls in more transitive dependencies than all the other languages.

10:54.200 --> 10:58.640
If you were to add all those transitive dependency numbers up, still not as big as JavaScript.

10:59.360 --> 11:05.680
This is how the problem inside of NPM and inside the JavaScript ecosystem is compounded.

11:05.740 --> 11:07.140
I need some water, yo.

11:14.140 --> 11:15.340
All right, I'm good.

11:16.520 --> 11:21.020
So how does open source malware invade security tools?

11:21.020 --> 11:27.540
First, let's start by talking about the fact that most open source malware is an interpreted language.

11:27.540 --> 11:29.820
It's JavaScript, Python, Go, what have you.

11:29.820 --> 11:36.200
And sure, Go can be compiled, but the reality is that most of these malicious packages are just source code.

11:36.200 --> 11:37.700
They're just JavaScript, right?

11:37.700 --> 11:46.040
Because 98.5% of the malicious packages, roughly speaking, are malicious, that are malicious, are in the NPM ecosystem and are JavaScript.

11:46.160 --> 11:49.300
That means that you're not really looking for binaries anymore.

11:49.300 --> 11:52.040
You're dealing with interpreted source code.

11:52.600 --> 12:01.400
And a lot of the common techniques, the muscle memory that malware analysis reverse engineers have just does not apply, right?

12:01.400 --> 12:09.460
So if you spent many years reversing malware, many of those skills just don't apply when you start doing this for open source malware.

12:11.120 --> 12:17.000
Also, the reality is that the payloads, because they're packages, are highly, highly iterative.

12:17.080 --> 12:27.760
So for example, you'll see later on, actually I don't know if that slide's in this one, but the point is that bad guys can change their payloads from one version to the next in the space of just a couple of minutes, right?

12:27.760 --> 12:41.820
So for example, if version 1.0 has a C2 of this IP address, the bad guy, if somebody burns that IP address, bad guy can push out a brand new version of it and has a different C2, has a different hard-coded IP.

12:41.820 --> 12:53.460
They can change everything so quickly, we are so used to dealing with a binary and we know that that binary does these things and it takes a while for the bad guys to push out a new version of that.

12:53.460 --> 12:56.040
With open source malware, they are iterating often.

12:56.060 --> 13:01.980
I looked at one particular package that had been around for about two months and it had 19 versions.

13:01.980 --> 13:11.620
And in those 19 versions, it had three or four major different changes in both the payload structure, how it encoded the payload, and the C2 that it called out to.

13:11.880 --> 13:19.900
And finally, I'm sorry, but anybody that works at some of these sandboxes company, you're not doing a lot for me from a JavaScript perspective, right?

13:19.940 --> 13:25.020
For the free versions of these products, I can't even call a node to run interpreted JavaScript.

13:25.340 --> 13:30.660
So using these kind of traditional sandboxes like any run in Joe's, those are great things.

13:30.660 --> 13:35.300
I use them all the time, but they don't really do a lot for JavaScript or interpreting languages.

13:36.120 --> 13:36.580
Oops.

13:39.140 --> 13:40.080
All right, cool.

13:40.380 --> 13:42.360
There we go.

13:43.000 --> 13:43.500
Obfuscation.

13:43.840 --> 13:47.620
I heard somebody at RSA on stage say obfuscation equals malicious.

13:47.620 --> 13:51.220
If you see obfuscated code inside of a package, it's malicious.

13:51.220 --> 13:52.340
That's just not true.

13:52.340 --> 13:53.940
It's just not true.

13:53.940 --> 14:03.740
There's lots of reasons that people obfuscate their source code now, and I'm going to guess that you guys have an answer, but what's one good reason that somebody would obfuscate their JavaScript?

14:06.300 --> 14:07.060
What was that?

14:08.240 --> 14:09.000
That's right, yeah.

14:09.000 --> 14:11.080
They just don't want to disclose it, right?

14:11.200 --> 14:16.500
And the reality is most of the time that's they've put business logic that they don't want to expose in the JavaScript, right?

14:16.500 --> 14:18.520
And so they obfuscate it for that reason.

14:18.580 --> 14:26.360
Totally legitimate, but that means that you can't, if you see obfuscation, you can't just assume that equals malware.

14:26.360 --> 14:28.520
You can't assume that it's malicious, right?

14:29.080 --> 14:38.280
And the problem is there are some malicious detection engines out there that will see obfuscation and label it as malicious, and that's just wrong, right?

14:38.280 --> 14:42.440
That's a bad assumption of intent.

14:42.960 --> 14:46.140
There's lots of very legitimate reasons to have obfuscation.

14:46.140 --> 14:59.940
Now, here's a problem is that there's lots of different obfuscation techniques, and bad guys have really gotten good at layering those different obfuscation techniques on top of each other to make very, very difficult to comprehend code.

14:59.940 --> 15:09.800
I don't have enough time today to go into all those obfuscation techniques, but control flow flattening and control flow reordering is a very, very difficult obfuscation technique to deal with.

15:09.800 --> 15:16.500
It's basically where you take kind of a logical order of the source and you flip it around using a bunch of conditionals and stuff.

15:16.500 --> 15:27.780
So basically when you look at it, especially after you use identifier renaming or variable renaming, it just makes it so you can't understand the kind of context and order of the code.

15:27.780 --> 15:29.820
It's very, very productive.

15:30.160 --> 15:42.160
And because there are so many obfuscation techniques, we're seeing some crazy weird techniques now where people are using, they're encoding everything to emojis and all kinds of stuff, and then they're layering other obfuscation techniques on top of that.

15:42.160 --> 15:47.620
It just makes it super crazy hard to figure out what's going on.

15:47.700 --> 15:58.820
Luckily, now I'm a bit of an AI skeptic, but I'm going to say that Gemini lately has been doing a really, really good job of helping me understand what this code is doing.

15:58.820 --> 16:00.920
You can't trust implicitly what it says.

16:00.920 --> 16:07.900
You have to verify, but the reality is this is one of the few places where I see LLMs really kicking ass and taking names.

16:07.920 --> 16:11.400
It's understanding what the source code is doing and then translating it for you.

16:11.500 --> 16:18.520
And finally, obfuscation, typically, LLMs aside, typically it means that a human being has to get involved.

16:18.700 --> 16:20.680
And that slows down the process.

16:20.680 --> 16:23.420
That makes it really hard for you to figure out what's going on.

16:23.420 --> 16:24.920
Because you're trying to identify.

16:24.920 --> 16:26.880
You're trying to figure out, there's some signals here.

16:26.880 --> 16:30.060
It makes me look like it's maybe bad, but I don't know.

16:30.100 --> 16:30.460
Right?

16:30.460 --> 16:31.140
I don't know.

16:31.140 --> 16:33.960
And you have to spend time figuring that out.

16:34.180 --> 16:34.620
All right.

16:34.620 --> 16:37.740
What's great about JavaScript is it runs in the browser.

16:38.000 --> 16:42.460
A lot of the malware nowadays is targeting specifically to run in a browser.

16:42.460 --> 16:49.780
The most common example right now is our malicious packages that are targeting crypto developers.

16:49.800 --> 16:54.840
So basically what they want you to do is they want you to import their malicious package into your web app.

16:54.840 --> 16:56.500
You're building this crypto thing.

16:56.500 --> 16:59.460
They want you to import that library into your web app.

16:59.640 --> 17:01.720
And then it does what it says it does.

17:01.720 --> 17:06.680
It logs crypto events or whatever the hell it does.

17:06.680 --> 17:08.160
But it also does the bad thing.

17:08.160 --> 17:08.600
Right?

17:09.120 --> 17:15.100
The reality is that the browser is an attack surface that we really don't have an answer for.

17:15.260 --> 17:15.700
Right?

17:15.920 --> 17:17.560
We really don't.

17:18.040 --> 17:19.640
JavaScript is also flexible.

17:19.680 --> 17:24.740
Obviously you can target devs in the front end and kind of targeting the apps that they're building.

17:24.740 --> 17:26.820
But it can also target the back end.

17:26.820 --> 17:28.080
And that's the thing about JavaScript.

17:28.080 --> 17:29.340
It's a very flexible language.

17:29.340 --> 17:31.340
By the way, I'm not a big fan of JavaScript.

17:31.360 --> 17:33.160
So you might think that I am up here talking about it.

17:33.160 --> 17:35.500
But the reality is it is a very flexible language.

17:35.500 --> 17:37.100
Can be used in multiple ways.

17:37.440 --> 17:42.200
And those, when you are targeting the developer of crypto or what have you, what are you doing?

17:42.200 --> 17:45.200
You're trying to target, you know, wallet files.

17:45.200 --> 17:48.080
You're trying to target cookies, access tokens.

17:49.040 --> 17:52.320
It's just a very, very rich environment.

17:52.320 --> 17:54.100
And I'm now saying malicious packages.

17:54.340 --> 17:58.660
Like, for example, the North Koreans for a long time there were specifically looking for Solana tokens.

17:58.660 --> 18:01.740
And they were very specific, very targeted about what they were looking for.

18:01.900 --> 18:04.180
Now, they have got conditional logic.

18:04.180 --> 18:06.480
They say, hey, do you see any Solana stuff?

18:06.480 --> 18:06.780
Nope.

18:06.780 --> 18:08.420
Do you go and see some ton stuff?

18:08.420 --> 18:08.720
Nope.

18:08.720 --> 18:11.600
Do you see some, you know, they're looking for things.

18:11.600 --> 18:13.880
And if they find it, then they go further.

18:13.880 --> 18:19.280
It's becoming a lot smarter and able to be used in more looking for more stuff.

18:19.320 --> 18:22.600
And finally, our friend browser extensions.

18:22.600 --> 18:23.020
Right?

18:23.680 --> 18:25.920
The pain of our existence.

18:25.920 --> 18:28.140
I'm still, in this browser, I'm not using any.

18:28.140 --> 18:34.920
But, yeah, the reality is that bad guys are able to use open source malware via browser extensions.

18:34.960 --> 18:36.820
And this is a growing threat really quickly.

18:36.920 --> 18:40.700
Open source malware targets developers and the dev environments.

18:40.760 --> 18:41.820
How does it do that?

18:42.100 --> 18:43.260
I'm sorry, why does it do that?

18:43.260 --> 18:44.340
It does that for two reasons.

18:44.340 --> 18:46.740
It does that to deploy the malware itself.

18:46.800 --> 18:51.960
But it also does it, targets the developers to take over their accounts.

18:52.780 --> 19:00.120
Why would you build this complex attack chain when you can just phish a developer and get their creds and take over all their shit?

19:00.440 --> 19:06.840
Why would I spend that time doing that when I could just, you know, build a much simpler path?

19:07.260 --> 19:10.080
Security tools, I can't stress this enough.

19:10.660 --> 19:14.100
Security tools, app set tools, are absolutely viable.

19:14.100 --> 19:17.580
They address the accidental vulnerabilities that we all know.

19:17.580 --> 19:20.340
The top ten vulnerabilities that we know.

19:20.360 --> 19:24.980
But they are not built, I'm sorry, they're not built to detect malicious behavior.

19:25.120 --> 19:36.880
In my workshop yesterday, I gave copious examples of how static analysis and SCA platforms just don't find this stuff.

19:36.880 --> 19:37.960
They just don't.

19:38.320 --> 19:45.600
The reality is that, as we talked about earlier, developers have a lot of exclusions from EDR, but most of the time they just don't run security tools.

19:45.600 --> 19:47.020
They're just not running an EDR agent.

19:47.020 --> 19:49.800
Not that it would actually, you know, catch much of this stuff.

19:49.800 --> 19:56.120
But there's just this history of developers not having to run security tooling, and there you go.

19:56.320 --> 20:03.440
And developers use a lot of browser extensions, so that's another area that you can get to them.

20:03.440 --> 20:06.280
And finally, my favorite, all this AI stuff.

20:06.280 --> 20:17.780
I'll talk about this a little bit later, but the reality is bad guys right now, for a while there, if there was a package on Python that talked about MCP, there was probably a 50% likelihood that that was malicious.

20:17.840 --> 20:21.980
It was just crazy how much the bad guys were targeting MCP specifically.

20:22.380 --> 20:25.160
But all the AI tooling right now is being targeted.

20:26.100 --> 20:39.900
Bad guys like to target CICD pipelines, so in that scenario a second ago, we're talking about targeting a developer on their individual laptop, but now let's talk about, we don't want to target a human, we want to target something that's going to get reused a lot of times in a CICD pipeline.

20:39.900 --> 20:45.080
Well, first and foremost, security tools are never running in those CICD pipelines.

20:46.240 --> 20:55.520
The pipelines themselves call these libraries and these containers again and again and again, hundreds of thousands, millions of times with no oversight.

20:55.640 --> 21:06.860
If you're using GitHub, the free version of GitHub, your CI logging goes away in 90 days, so you can't even go back and look and see if there was a bad event after 90, you know, 91st day, you're SOL.

21:07.660 --> 21:17.560
The amount of logging and the understanding of what logging is there is just not there, so unfortunately it's really easy for these events to get missed in the CI pipelines.

21:17.560 --> 21:24.300
And finally, continuous integration, these pipelines, it's where two really important things come together.

21:24.300 --> 21:29.040
First is your core intellectual property, your source code, it's there.

21:29.040 --> 21:44.780
And the next thing is a shit ton of access, API keys, AWS access tokens and all kinds of other stuff, prolexity keys, NPM tokens, the combination of those two makes the area a super rich place for bad guys to be and that's why they are there.

21:52.380 --> 21:53.460
All right.

21:54.340 --> 21:59.900
All right, so you want to really, really try as a bad guy, let's pretend you guys are all bad guys, right?

21:59.900 --> 22:01.480
Do we have anybody that wants to admit that?

22:01.480 --> 22:04.660
Are you offensive security and operate in this environment?

22:04.660 --> 22:05.840
Anybody want to admit that?

22:06.360 --> 22:07.380
All right, we got one.

22:07.380 --> 22:07.920
Me too.

22:07.920 --> 22:08.840
Me and you, bro.

22:09.340 --> 22:10.520
Me and you against the world.

22:11.280 --> 22:25.920
The reality is that much of the malicious package detection that platforms use happens in GitHub security advisory or OSV, the open SSF malicious packages repository.

22:26.440 --> 22:31.840
Many security vendors use those two things to determine if something is malicious.

22:31.840 --> 22:35.920
I've proven this again and again and again for sneaking a whole bunch of other tools out there.

22:36.500 --> 22:44.100
So here's the thing, if you can keep your malware out of, especially out of GHSA, you're good.

22:44.480 --> 22:56.840
And so if you're a bad guy and you see somebody like me or one of my friends who finds a malicious package and we turn it into OSV, OSV marks it as malicious.

22:57.040 --> 23:08.600
But if you then as a bad guy go and remove that package from NPM, you're self-removing yourself, it's never going to get into the GHSA.

23:08.740 --> 23:10.220
And so you now have saved yourself.

23:10.220 --> 23:16.140
You can reuse that name for that package again in the future and you can also not burn that capability.

23:16.140 --> 23:17.860
So how do you not get detected?

23:17.860 --> 23:28.100
If somebody finds you, if some smart person like me finds you, pull your package immediately out of NPM and sit tight and you'll be able to come back like a phoenix.

23:28.920 --> 23:33.340
That's a little tip for all you offensive security practitioners out there.

23:33.480 --> 23:35.780
And finally, malware doesn't go boom.

23:35.820 --> 23:39.860
We have this idea of when you detonate malware, a binary .

23:39.860 --> 23:43.500
The reality is the kind of malware I look at doesn't go boom.

23:43.600 --> 23:59.340
One of the craftiest open source malware packages that I looked at recently was a library that basically copied the world's most commonly used web 3 event logging library.

23:59.340 --> 24:02.360
It did everything that this web 3 package did.

24:02.360 --> 24:03.920
So it did what it was supposed to.

24:03.920 --> 24:10.080
It just also took every single event that was logged and sent it to the bad guys, right?

24:10.940 --> 24:17.020
Now the thing is that the only reason you would get pwned by that is if you imported that library.

24:17.020 --> 24:18.680
It wasn't using post install scripts.

24:18.680 --> 24:20.160
It wasn't using install scripts.

24:20.160 --> 24:30.580
You had to actually import that into a working web application that then wanted to, you know, send events, web 3 events somewhere and then they would just grab them.

24:30.580 --> 24:34.800
But you would never see that malicious behavior unless you knew to take a look in that library.

24:34.800 --> 24:39.800
And so that library stayed on NPM for months and months and months doing all kinds of bad stuff.

24:39.800 --> 24:42.020
The reality is that this stuff is interpreted.

24:42.020 --> 24:45.540
It's not, you know, it doesn't blow up like traditional stuff does.

24:45.540 --> 24:47.680
It doesn't look like the normal stuff does.

24:47.680 --> 24:50.080
And that's why InfoSec really has left it alone.

24:50.080 --> 24:52.700
There's not a lot of people building solutions for this.

24:52.760 --> 24:58.060
And like I said earlier, part of the problem is the source code itself combined with the shit show that is NPM.

24:58.060 --> 25:00.680
You put those two things together and get this amazing grenade.

25:01.400 --> 25:10.640
The good stuff, the good bad guys, the nuanced bad guys, the nation state actors, they never use, they almost never, somebody corrected me yesterday.

25:10.660 --> 25:11.640
If you're in the audience, I'm sorry.

25:11.640 --> 25:12.660
I won't do it again.

25:13.880 --> 25:18.900
Almost never use install scripts instead they use import.

25:19.460 --> 25:20.160
All right.

25:20.320 --> 25:23.020
So bad guys like to target what's hot.

25:23.020 --> 25:25.340
And so right now I just did it really quickly.

25:25.860 --> 25:28.180
Basically this is just me doing some hot data tape.

25:28.180 --> 25:35.840
But basically the three areas that I see bad guys concentrating are from top to bottom right now are, I don't even know how to say that.

25:35.840 --> 25:36.200
Vite?

25:36.200 --> 25:36.860
Is that how I say it?

25:37.440 --> 25:37.820
Vite?

25:37.820 --> 25:38.480
Vite?

25:38.700 --> 25:44.680
Anything vite right now in NPM or PyPy, spend some extra time looking at it, right?

25:45.620 --> 25:50.760
Anything MCP, oh my God, take the time to look at it because bad guys are all over it.

25:50.760 --> 25:58.560
And finally Solana, I swear to God, like 60 plus percent of the stuff I looked at talks about Solana is like probably more than that.

25:59.020 --> 26:01.600
I'm going to go on a limb and say it's probably more than 60 percent.

26:01.600 --> 26:02.820
It's just straight up.

26:02.880 --> 26:03.780
It's going to gank you.

26:03.780 --> 26:04.660
It's just malicious.

26:05.540 --> 26:11.160
So basically the point there of that slide is to say bad guys are going to target what's hot, you know?

26:11.160 --> 26:14.460
Stuff that's hot, yeah, I see a lot of phones going up here, yeah.

26:14.900 --> 26:17.420
You guys all owe me 900, no.

26:18.120 --> 26:19.680
I'm not going to go through every single one.

26:19.760 --> 26:21.080
Actually, how much time do I got?

26:22.180 --> 26:24.720
Yeah, I don't have time to go through every single one of these.

26:24.720 --> 26:28.520
But if I was a bad guy trying to, wow, that's a lot of phones.

26:30.040 --> 26:31.540
I wish I could take a picture of that.

26:31.540 --> 26:32.360
That would be sick.

26:33.420 --> 26:41.440
But if I was a bad guy building open source malware and I didn't want to get caught, this is what I would do.

26:42.180 --> 26:43.880
And a couple highlights here.

26:45.180 --> 26:46.300
And I see this right now.

26:46.300 --> 26:47.320
We'll talk about this in a second.

26:47.400 --> 26:50.080
Actually, I'm just going to jump ahead to the threat actors.

26:50.080 --> 26:54.040
We're going to talk about actual bad guys that are actually making malicious packages.

26:54.240 --> 26:58.060
Because I started a little bit early, I can go through all three of these.

26:58.140 --> 27:01.100
So first, let's talk about our friends in North Korea.

27:01.920 --> 27:04.140
Lazarus Group, you might have heard of them, right?

27:04.980 --> 27:05.760
No?

27:05.760 --> 27:06.720
Oh, sorry.

27:06.720 --> 27:07.760
Okay, my bad.

27:08.500 --> 27:14.840
They are actually, I just saw a report yesterday saying that they finally are now doing espionage.

27:14.840 --> 27:15.900
Did anybody else see this?

27:15.900 --> 27:20.440
Because they've been so singularly focused on stealing crypto.

27:20.440 --> 27:24.880
They've stolen over $2 billion worth of crypto in the last 18 months that we know about.

27:25.000 --> 27:30.740
They're 100% concentrating on it and they've come up with all kinds of crazy ways to do that.

27:31.440 --> 27:41.460
One of the biggest that we've seen is it targets people working in the crypto space, developers working in the crypto space, on LinkedIn and on GitHub and all kinds of places.

27:41.760 --> 27:48.640
I have a friend, he's Armenian, he's been in Web3 for years, he's a developer, and so he gets hit up with these all the time.

27:48.760 --> 27:53.240
And so he's constantly, probably like once a week or once every two weeks, he sends me a new one.

27:53.240 --> 27:59.900
And so I just get all this juicy, brand new North Korean, I mean, I don't call it North Korean until somebody else has attributed it.

27:59.900 --> 28:01.840
So just to be clear, yep, 10-4.

28:02.260 --> 28:04.160
I don't do the attribution, other people do.

28:04.160 --> 28:10.880
But anyhow, they are flooding NPM right now, and to a lesser extent, PyPy, with dependency confusion and typosquatting.

28:10.880 --> 28:17.480
So basically, they put the dependency confusion and typosquatting things there to then use in other parts of their campaign.

28:17.480 --> 28:23.040
So then when they hit you up on GitHub or LinkedIn, they can then call those malicious packages.

28:23.420 --> 28:30.920
Typically, it used to be that they were very, very specific, they were looking for a specific type of wallet file, and if it didn't find it, it wouldn't do anything.

28:30.940 --> 28:35.700
But now, they're starting to be a little bit more, they're using conditional logic, they're looking for stuff.

28:36.360 --> 28:40.620
They do like to use obfuscation , they also like to use filler code.

28:40.620 --> 28:47.520
So basically, filler code is where they just drop hundreds or thousands of extra JavaScript files in there, and they just just make it really hard for you to find stuff.

28:48.280 --> 28:57.520
And the only time that I've actually seen the enterprise find this stuff is looking at egress outbound from their enterprise when they saw the calls out to the C2.

28:58.600 --> 29:00.640
And by the way, these are singular events, right?

29:00.640 --> 29:04.060
This is why EDR has such a hard time finding this stuff, because it's a singular event.

29:04.060 --> 29:10.720
It's not like ransomware or other things where you can look for these multiple like heuristics and then tie them together, look at those singles and tie them together.

29:10.860 --> 29:16.480
This is a literally a singular like curl or the equivalent calls out to them.

29:17.260 --> 29:22.240
Socket just came out with a report that talks about a tiny portion of this, but I've been tracking these guys for like two or three months.

29:22.240 --> 29:25.880
Basically, I call these guys the Liren gang, they're Indonesians.

29:25.960 --> 29:30.260
For some reason, they've all kind of decided we're going to pretend to be Vietnamese women.

29:30.260 --> 29:31.520
I don't know why, but whatever.

29:32.400 --> 29:34.860
So you can and their OPSEC is shit.

29:34.860 --> 29:35.400
I mean, it's terrible.

29:35.400 --> 29:36.760
You can go and find these guys.

29:36.900 --> 29:44.740
Like, if you go and search for Vaylin, and you'll find a bunch of the other threat actors involved in this campaign, and you can ultimately find them all the way.

29:44.740 --> 29:47.360
There's a bunch of them that are high schoolers in Indonesia, right?

29:47.360 --> 29:48.740
Their OPSEC is terrible.

29:48.780 --> 29:49.580
And why?

29:49.660 --> 29:50.760
Because they feel comfortable.

29:50.760 --> 29:52.560
They feel like they're not doing anything wrong.

29:52.700 --> 29:58.500
Basically, their thing, and they're not particularly technical, what they like to do is they like to attack WhatsApp.

29:58.500 --> 30:00.080
So WhatsApp now does payments.

30:00.080 --> 30:14.580
And so they do this bot thing where they basically, you come up and you connect your WhatsApp account to the WhatsApp business account, but then they create a bot that basically takes the integration that you just used, and uses that to do a bunch of monetization stuff,

30:14.580 --> 30:16.300
like look at YouTube videos and all kinds of shit.

30:16.300 --> 30:18.900
I mean, they've got all kinds of crazy ways that they're using this.

30:18.960 --> 30:21.140
All of this stuff gets ex-filled back to Discord.

30:21.140 --> 30:27.240
They love Discord, probably because they're not technical enough to, yeah, buddy, to create actual C2 infrastructure.

30:27.280 --> 30:29.060
Very, very low technical skill.

30:29.800 --> 30:31.780
The Russians, we all know about the Russians.

30:31.780 --> 30:33.140
So I probably will skip this one.

30:33.140 --> 30:41.140
But one thing to point out, now, I'm not talking about the state actors, but the criminal gangs, they're actually using a lot of .ru and .sus.

30:41.140 --> 30:50.060
I think the sanctions are actually working in the sense that I am seeing a genuine increase in the use of .ru and .sus when they used to buy .coms and stuff like that.

30:50.320 --> 30:55.480
They're still using some of the cheap ones, .tops and .xyzs, but I've definitely seen the increase in .ru and .sus.

30:55.640 --> 30:57.600
And finally, bug bounty researchers.

30:57.640 --> 31:01.820
Bug bounty researchers are flooding NPM on a month to month basis.

31:01.820 --> 31:06.660
We're looking at 40 plus percent of the malicious packages that I look at are from researchers.

31:06.820 --> 31:08.000
And we need to do something about this.

31:08.000 --> 31:14.940
So I've worked, I've reached out to bug crowd and HackerOne asking them, can you change your terms of service so that we see a lot less of this stuff?

31:14.940 --> 31:21.660
But I mean, it's honestly, it, it spends a lot of researchers spend a lot of time trying to address this.

31:21.660 --> 31:22.400
How do we get better?

31:22.400 --> 31:27.600
We need better detection for our solution, from our solutions, our SCA providers, our ASPM providers.

31:27.660 --> 31:33.580
Engineering teams need to understand how to pull vetted packages from known private registries.

31:33.580 --> 31:37.220
Or I like to use, I like the idea of package firewalls.

31:37.220 --> 31:40.940
So the company I'm working for is building one, but Sonotype has one.

31:41.360 --> 31:42.880
A bunch of companies are working on them.

31:42.880 --> 31:44.640
There's an open source one too as well.

31:44.860 --> 31:47.640
You want to make sure that that integrates with your proxies as well.

31:47.640 --> 31:53.340
And basically what they do is they wrap around NPM or PyPy and don't let you call malicious packages.

31:53.720 --> 31:57.580
And finally, hire people with subject matter expertise, right?

31:57.580 --> 31:59.160
This is complicated shit.

31:59.570 --> 32:01.860
You know, don't think that tools is going to solve this.

32:01.860 --> 32:05.080
You need to hire some people with some SME in this space.

32:05.200 --> 32:07.900
And finally, here's some open source malware.

32:08.240 --> 32:10.360
Let me move the cursor so you can see that.

32:10.360 --> 32:11.400
Take a picture of that.

32:11.440 --> 32:13.620
These are all the places that I go to get information.

32:13.620 --> 32:15.040
Damn, that's a lot of phones.

32:15.040 --> 32:17.240
That is such a, oh man, I wish I could take a picture of that.

32:17.240 --> 32:17.920
That's dope.

32:19.500 --> 32:21.860
I'll try to make this available on my GitHub account.

32:21.860 --> 32:24.860
So GitHub.com slash six mile.

32:24.880 --> 32:27.220
I'm from Detroit, probably so.

32:27.680 --> 32:31.180
This, this is some of the places that I go to get information about open source malware.

32:31.180 --> 32:32.600
And finally, that's me, Paul McCarty.

32:32.600 --> 32:33.140
Thank you so much.

32:33.140 --> 32:34.080
I appreciate it.

