1 00:00:00,000 --> 00:00:01,300 My name is Paul McCarty. 2 00:00:01,360 --> 00:00:06,840 I am currently the head of safety... sorry, head of research at Safety. 3 00:00:06,840 --> 00:00:11,360 Safety is a small supply chain security company based in Vancouver. 4 00:00:11,480 --> 00:00:12,700 That's not why I'm here, though. 5 00:00:12,700 --> 00:00:19,840 I'm here to talk about open source malware and why it's invading our security toolings. 6 00:00:19,840 --> 00:00:22,080 I have worked for a lot of large organizations. 7 00:00:22,080 --> 00:00:23,860 I've worked for a lot of startups. 8 00:00:23,920 --> 00:00:28,640 And the problem is the same for both of those sizes, regardless. 9 00:00:28,640 --> 00:00:30,840 Just a different scale. 10 00:00:32,940 --> 00:00:37,580 So... I like to write a lot of open source tools. 11 00:00:37,580 --> 00:00:38,320 I'm a very prolific... 12 00:00:41,000 --> 00:00:43,380 yeah, anyhow, I do a lot of open source stuff. 13 00:00:43,380 --> 00:00:45,160 The stuff on the left is all my tooling. 14 00:00:45,160 --> 00:00:46,360 These are things I've written. 15 00:00:46,700 --> 00:00:53,000 I'm actually really super excited about Gimme Pats, Super Confused, and Malice. 16 00:00:53,000 --> 00:00:54,540 I haven't even dropped Malice yet. 17 00:00:54,540 --> 00:00:56,980 It's got zero stars on GitHub right now. 18 00:00:56,980 --> 00:01:07,380 Malice, basically what it is, it helps you identify malicious open source packages in the NPM ecosystem or the PyPy ecosystem. 19 00:01:07,900 --> 00:01:10,460 And I'm going to be officially kind of launching that next week. 20 00:01:10,460 --> 00:01:12,640 But all the stuff on the left is mine. 21 00:01:12,640 --> 00:01:19,260 The stuff on the right are projects that I hack on, that I like working on. 22 00:01:19,800 --> 00: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? 23 00:01:30,440 --> 00:01:31,040 All right. 24 00:01:31,040 --> 00:01:31,520 Dope. 25 00:01:31,520 --> 00:01:32,200 Sweet. 26 00:01:33,260 --> 00: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. 27 00:01:47,220 --> 00:01:48,180 Oh, I'm going the wrong way. 28 00:01:48,180 --> 00:01:48,840 Sorry. 29 00:01:50,200 --> 00:01:50,740 All right. 30 00:01:50,740 --> 00:01:53,620 Here's the takeaways that I wanted to come away with today. 31 00:01:53,940 --> 00:01:58,480 How does open source malware evade security tool detection? 32 00:01:58,560 --> 00:02:04,980 Basically, part of the weird thing about open source malware is that it's not just the source code itself. 33 00:02:04,980 --> 00: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. 34 00:02:15,820 --> 00:02:19,640 It's very different from kind of traditional binary based malware. 35 00:02:20,640 --> 00:02:24,320 It targets developers in CICD pipelines. 36 00:02:24,320 --> 00:02:25,360 Why does it do that? 37 00:02:25,380 --> 00:02:28,480 Because there's not many security tools there, right? 38 00:02:28,480 --> 00:02:33,060 What are the number one and two exclusions for EDR tooling? 39 00:02:33,620 --> 00: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? 40 00:02:42,460 --> 00:02:43,060 Anybody? 41 00:02:44,220 --> 00:02:44,700 Developers? 42 00:02:44,700 --> 00:02:45,480 Who else? 43 00:02:46,320 --> 00:02:47,560 Yep, very good. 44 00:02:47,560 --> 00:02:49,400 Oh, my gosh, you guys have been reading my notes. 45 00:02:50,380 --> 00:02:51,100 Yeah, that's right. 46 00:02:51,100 --> 00:02:53,660 Executive suite and developers. 47 00:02:55,100 --> 00:02:56,800 So why do we think that they're targeted? 48 00:02:56,800 --> 00:02:57,720 Well, there you go. 49 00:02:58,300 --> 00:03:03,560 And the reality is that there's not many good security tools that address this space. 50 00:03:03,900 --> 00:03:07,000 Software engineers think that they've got coverage from SCA products. 51 00:03:07,300 --> 00:03:11,240 Security teams think they've got coverage from EDR and other security tools. 52 00:03:11,340 --> 00:03:12,940 In fact, neither is true. 53 00:03:12,960 --> 00:03:16,760 And finally, the reality is that security teams don't understand the threat. 54 00:03:16,760 --> 00:03:23,240 Engineering teams maybe theoretically understand it, but security teams just don't understand the threat. 55 00:03:23,240 --> 00:03:25,120 And that's based on my personal experience. 56 00:03:25,340 --> 00:03:29,160 So why, we're here, we only have 25 minutes today, right? 57 00:03:29,160 --> 00:03:30,980 Why are we here to talk about NPM? 58 00:03:30,980 --> 00:03:33,560 Well, bad guys love NPM. 59 00:03:33,900 --> 00:03:35,220 Why do they love NPM? 60 00:03:36,140 --> 00: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. 61 00:03:46,380 --> 00: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. 62 00:03:55,020 --> 00:04:00,480 And that's not a criticism, it's just an observation of the reality. 63 00:04:01,440 --> 00: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. 64 00:04:13,220 --> 00:04:14,640 Have you guys heard this before? 65 00:04:14,640 --> 00:04:16,840 The idea of JavaScript no batteries included? 66 00:04:17,260 --> 00: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. 67 00:04:23,120 --> 00:04:27,520 Basically the idea here is that we don't want JavaScript to do anything itself internally. 68 00:04:27,520 --> 00:04:28,400 Now that's different. 69 00:04:28,400 --> 00: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. 70 00:04:34,820 --> 00: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? 71 00:04:44,100 --> 00:04:46,340 And that's part of the problem, it was built to do that. 72 00:04:46,340 --> 00:04:50,680 And you'll see in a slide in a few minutes why this comes back to haunt us. 73 00:04:51,420 --> 00:04:54,400 All right, next, why is NPM so crazy insecure? 74 00:04:54,880 --> 00:05:02,440 Brian Fox from Sonosype calls the install scripts in NPM, he calls that RCE by design. 75 00:05:03,020 --> 00:05:10,660 And the reality is that the post and pre-install scripts in NPM were perfectly built to deploy your JavaScript. 76 00:05:10,660 --> 00: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? 77 00:05:16,920 --> 00:05:20,320 Before the package contents get installed, it does this thing. 78 00:05:20,320 --> 00:05:25,540 Similarly, if there's a post install script, after it's installed, it does a thing. 79 00:05:25,540 --> 00: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. 80 00:05:32,820 --> 00:05:36,420 It's like the perfect RCE pipeline. 81 00:05:36,760 --> 00:05:39,020 Next, the barrier to entry is low. 82 00:05:39,180 --> 00: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. 83 00:05:52,680 --> 00:05:56,840 The ease of onboarding those ecosystems is amazing. 84 00:05:56,840 --> 00:06:02,080 So that means that somebody can create an NPM account in a minute and immediately publish packages. 85 00:06:02,100 --> 00: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. 86 00:06:11,020 --> 00:06:13,320 Anyone can claim a namespace . 87 00:06:13,320 --> 00:06:20,920 Not only can you create an account really quickly, but anybody, if at Microsoft and NPM is available, guess what? 88 00:06:20,920 --> 00:06:21,820 You can take it. 89 00:06:21,820 --> 00:06:23,680 You don't have to prove that you're from Microsoft. 90 00:06:23,680 --> 00:06:27,720 You don't have to prove that your email address ends in Microsoft.com. 91 00:06:27,720 --> 00:06:29,560 If it's available, you can take it. 92 00:06:29,720 --> 00: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. 93 00:06:41,220 --> 00:06:42,900 Anybody can grab a namespace. 94 00:06:42,980 --> 00:06:45,280 Package metadata can be faked. 95 00:06:45,720 --> 00:06:46,720 This is crazy. 96 00:06:46,720 --> 00:06:48,300 Like this still blows my mind. 97 00:06:48,580 --> 00:06:53,760 Package metadata in NPM, about half of those fields can be faked. 98 00:06:53,760 --> 00:06:57,760 And what I mean by that is the author field, you can put anything in there you want to. 99 00:06:57,760 --> 00:07:00,960 You can put Linus Torvalds, you can put anything in there you want to. 100 00:07:01,360 --> 00:07:03,420 Similarly, you can do the same thing with the git repo. 101 00:07:03,420 --> 00:07:05,840 You can point at any git repo you want to. 102 00:07:07,160 --> 00:07:09,080 All right, so we've got some more people coming in. 103 00:07:09,180 --> 00:07:10,720 Sorry, yo, I started early. 104 00:07:11,320 --> 00:07:12,000 But that's okay. 105 00:07:12,000 --> 00:07:13,280 You're here for the good stuff. 106 00:07:15,540 --> 00: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. 107 00:07:28,460 --> 00:07:31,380 The only thing that changes is the NPM user. 108 00:07:32,220 --> 00:07:32,920 All right. 109 00:07:33,200 --> 00:07:35,760 Account takeover in NPM is really easy. 110 00:07:36,140 --> 00:07:43,560 Still to this day, it doesn't require you to NPM doesn't require you to use 2FA or MFA. 111 00:07:44,060 --> 00:07:49,200 It does if you're one of those super important maintainers. 112 00:07:49,460 --> 00:07:51,940 But still doesn't require if you create an account. 113 00:07:52,120 --> 00:07:59,340 And unfortunately it takes a long time to remove malicious NPM packages from the registry. 114 00:07:59,680 --> 00:08:06,040 In fact, I found one in December, late December of 2024. 115 00:08:06,460 --> 00:08:08,320 I let NPM know about it. 116 00:08:08,420 --> 00:08:11,460 And when do you think that got removed from the NPM registry? 117 00:08:12,420 --> 00:08:13,200 I like it. 118 00:08:13,200 --> 00:08:13,880 It hasn't. 119 00:08:13,880 --> 00:08:15,080 I like that guy. 120 00:08:15,380 --> 00:08:16,620 That's the winner right there. 121 00:08:16,620 --> 00:08:18,000 No, they took it out in May. 122 00:08:18,120 --> 00:08:18,900 May. 123 00:08:19,120 --> 00:08:20,960 December to May. 124 00:08:21,080 --> 00:08:23,060 So just say this out loud. 125 00:08:23,340 --> 00:08:28,920 I let them know it was vetted malicious in December of 2024. 126 00:08:28,920 --> 00:08:30,340 And it was still in the registry. 127 00:08:30,340 --> 00:08:35,580 You could download it and get pwned by it until May of 2024. 128 00:08:35,900 --> 00:08:37,520 Frankly, it's a shit show. 129 00:08:38,880 --> 00:08:40,960 GHSA and NPM don't track. 130 00:08:40,960 --> 00:08:42,940 So GHSA is GitHub security advisory. 131 00:08:42,940 --> 00:08:44,820 NPM is NPM. 132 00:08:44,820 --> 00:08:47,720 They don't track malware data. 133 00:08:47,720 --> 00: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. 134 00:08:56,280 --> 00:08:57,940 There's no mention of the author. 135 00:08:58,200 --> 00:09:00,820 There's no mention of any other important information. 136 00:09:00,820 --> 00:09:01,940 Doesn't even say what it does. 137 00:09:01,940 --> 00:09:04,400 It just says that package is malicious. 138 00:09:04,860 --> 00: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? 139 00:09:11,260 --> 00:09:12,520 And that's a real problem. 140 00:09:13,260 --> 00:09:14,460 We doing good so far? 141 00:09:14,760 --> 00:09:15,980 Not going too fast? 142 00:09:16,020 --> 00:09:16,780 All right, sweet. 143 00:09:16,820 --> 00:09:17,580 Like this. 144 00:09:19,080 --> 00:09:19,700 All right. 145 00:09:19,860 --> 00:09:23,760 So remember how I said you can get a name space and all those other things? 146 00:09:23,900 --> 00:09:30,780 Well, according to a sonotype study, 98.5% of all malicious packages they took a look at exist in NPM. 147 00:09:30,780 --> 00:09:34,700 Less than one percent is in PyPy. 148 00:09:34,700 --> 00:09:40,260 Although PyPy is growing, all you Python fans, don't worry, your malware day in the sun will come. 149 00:09:40,480 --> 00: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? 150 00:09:46,480 --> 00:09:48,400 98.5%. 151 00:09:48,400 --> 00:09:53,840 Now couple that with, boom, this is data from GitHub. 152 00:09:54,000 --> 00:09:56,500 What this shows, my bag is in the way so I apologize. 153 00:09:56,740 --> 00: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. 154 00:10:09,640 --> 00:10:11,600 So let me say this a different way. 155 00:10:11,680 --> 00: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. 156 00:10:25,540 --> 00:10:27,080 So let's look at PHP. 157 00:10:27,260 --> 00:10:27,920 Nine. 158 00:10:27,920 --> 00:10:30,580 Nine direct dependencies. 159 00:10:30,900 --> 00:10:34,680 Seventy indirect or transitive dependencies. 160 00:10:34,680 --> 00:10:43,020 JavaScript, ten direct dependencies, 683 indirect or transitive dependencies. 161 00:10:43,020 --> 00: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. 162 00:10:54,200 --> 00:10:58,640 If you were to add all those transitive dependency numbers up, still not as big as JavaScript. 163 00:10:59,360 --> 00:11:05,680 This is how the problem inside of NPM and inside the JavaScript ecosystem is compounded. 164 00:11:05,740 --> 00:11:07,140 I need some water, yo. 165 00:11:14,140 --> 00:11:15,340 All right, I'm good. 166 00:11:16,520 --> 00:11:21,020 So how does open source malware invade security tools? 167 00:11:21,020 --> 00:11:27,540 First, let's start by talking about the fact that most open source malware is an interpreted language. 168 00:11:27,540 --> 00:11:29,820 It's JavaScript, Python, Go, what have you. 169 00:11:29,820 --> 00:11:36,200 And sure, Go can be compiled, but the reality is that most of these malicious packages are just source code. 170 00:11:36,200 --> 00:11:37,700 They're just JavaScript, right? 171 00:11:37,700 --> 00: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. 172 00:11:46,160 --> 00:11:49,300 That means that you're not really looking for binaries anymore. 173 00:11:49,300 --> 00:11:52,040 You're dealing with interpreted source code. 174 00:11:52,600 --> 00:12:01,400 And a lot of the common techniques, the muscle memory that malware analysis reverse engineers have just does not apply, right? 175 00:12:01,400 --> 00: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. 176 00:12:11,120 --> 00:12:17,000 Also, the reality is that the payloads, because they're packages, are highly, highly iterative. 177 00:12:17,080 --> 00: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? 178 00:12:27,760 --> 00: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. 179 00:12:41,820 --> 00: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. 180 00:12:53,460 --> 00:12:56,040 With open source malware, they are iterating often. 181 00:12:56,060 --> 00:13:01,980 I looked at one particular package that had been around for about two months and it had 19 versions. 182 00:13:01,980 --> 00: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. 183 00:13:11,880 --> 00: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? 184 00:13:19,940 --> 00:13:25,020 For the free versions of these products, I can't even call a node to run interpreted JavaScript. 185 00:13:25,340 --> 00:13:30,660 So using these kind of traditional sandboxes like any run in Joe's, those are great things. 186 00:13:30,660 --> 00:13:35,300 I use them all the time, but they don't really do a lot for JavaScript or interpreting languages. 187 00:13:36,120 --> 00:13:36,580 Oops. 188 00:13:39,140 --> 00:13:40,080 All right, cool. 189 00:13:40,380 --> 00:13:42,360 There we go. 190 00:13:43,000 --> 00:13:43,500 Obfuscation. 191 00:13:43,840 --> 00:13:47,620 I heard somebody at RSA on stage say obfuscation equals malicious. 192 00:13:47,620 --> 00:13:51,220 If you see obfuscated code inside of a package, it's malicious. 193 00:13:51,220 --> 00:13:52,340 That's just not true. 194 00:13:52,340 --> 00:13:53,940 It's just not true. 195 00:13:53,940 --> 00: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? 196 00:14:06,300 --> 00:14:07,060 What was that? 197 00:14:08,240 --> 00:14:09,000 That's right, yeah. 198 00:14:09,000 --> 00:14:11,080 They just don't want to disclose it, right? 199 00:14:11,200 --> 00: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? 200 00:14:16,500 --> 00:14:18,520 And so they obfuscate it for that reason. 201 00:14:18,580 --> 00:14:26,360 Totally legitimate, but that means that you can't, if you see obfuscation, you can't just assume that equals malware. 202 00:14:26,360 --> 00:14:28,520 You can't assume that it's malicious, right? 203 00:14:29,080 --> 00: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? 204 00:14:38,280 --> 00:14:42,440 That's a bad assumption of intent. 205 00:14:42,960 --> 00:14:46,140 There's lots of very legitimate reasons to have obfuscation. 206 00:14:46,140 --> 00: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. 207 00:14:59,940 --> 00: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. 208 00:15:09,800 --> 00: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. 209 00:15:16,500 --> 00: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. 210 00:15:27,780 --> 00:15:29,820 It's very, very productive. 211 00:15:30,160 --> 00: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. 212 00:15:42,160 --> 00:15:47,620 It just makes it super crazy hard to figure out what's going on. 213 00:15:47,700 --> 00: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. 214 00:15:58,820 --> 00:16:00,920 You can't trust implicitly what it says. 215 00:16:00,920 --> 00: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. 216 00:16:07,920 --> 00:16:11,400 It's understanding what the source code is doing and then translating it for you. 217 00:16:11,500 --> 00:16:18,520 And finally, obfuscation, typically, LLMs aside, typically it means that a human being has to get involved. 218 00:16:18,700 --> 00:16:20,680 And that slows down the process. 219 00:16:20,680 --> 00:16:23,420 That makes it really hard for you to figure out what's going on. 220 00:16:23,420 --> 00:16:24,920 Because you're trying to identify. 221 00:16:24,920 --> 00:16:26,880 You're trying to figure out, there's some signals here. 222 00:16:26,880 --> 00:16:30,060 It makes me look like it's maybe bad, but I don't know. 223 00:16:30,100 --> 00:16:30,460 Right? 224 00:16:30,460 --> 00:16:31,140 I don't know. 225 00:16:31,140 --> 00:16:33,960 And you have to spend time figuring that out. 226 00:16:34,180 --> 00:16:34,620 All right. 227 00:16:34,620 --> 00:16:37,740 What's great about JavaScript is it runs in the browser. 228 00:16:38,000 --> 00:16:42,460 A lot of the malware nowadays is targeting specifically to run in a browser. 229 00:16:42,460 --> 00:16:49,780 The most common example right now is our malicious packages that are targeting crypto developers. 230 00:16:49,800 --> 00:16:54,840 So basically what they want you to do is they want you to import their malicious package into your web app. 231 00:16:54,840 --> 00:16:56,500 You're building this crypto thing. 232 00:16:56,500 --> 00:16:59,460 They want you to import that library into your web app. 233 00:16:59,640 --> 00:17:01,720 And then it does what it says it does. 234 00:17:01,720 --> 00:17:06,680 It logs crypto events or whatever the hell it does. 235 00:17:06,680 --> 00:17:08,160 But it also does the bad thing. 236 00:17:08,160 --> 00:17:08,600 Right? 237 00:17:09,120 --> 00:17:15,100 The reality is that the browser is an attack surface that we really don't have an answer for. 238 00:17:15,260 --> 00:17:15,700 Right? 239 00:17:15,920 --> 00:17:17,560 We really don't. 240 00:17:18,040 --> 00:17:19,640 JavaScript is also flexible. 241 00:17:19,680 --> 00:17:24,740 Obviously you can target devs in the front end and kind of targeting the apps that they're building. 242 00:17:24,740 --> 00:17:26,820 But it can also target the back end. 243 00:17:26,820 --> 00:17:28,080 And that's the thing about JavaScript. 244 00:17:28,080 --> 00:17:29,340 It's a very flexible language. 245 00:17:29,340 --> 00:17:31,340 By the way, I'm not a big fan of JavaScript. 246 00:17:31,360 --> 00:17:33,160 So you might think that I am up here talking about it. 247 00:17:33,160 --> 00:17:35,500 But the reality is it is a very flexible language. 248 00:17:35,500 --> 00:17:37,100 Can be used in multiple ways. 249 00:17:37,440 --> 00:17:42,200 And those, when you are targeting the developer of crypto or what have you, what are you doing? 250 00:17:42,200 --> 00:17:45,200 You're trying to target, you know, wallet files. 251 00:17:45,200 --> 00:17:48,080 You're trying to target cookies, access tokens. 252 00:17:49,040 --> 00:17:52,320 It's just a very, very rich environment. 253 00:17:52,320 --> 00:17:54,100 And I'm now saying malicious packages. 254 00:17:54,340 --> 00:17:58,660 Like, for example, the North Koreans for a long time there were specifically looking for Solana tokens. 255 00:17:58,660 --> 00:18:01,740 And they were very specific, very targeted about what they were looking for. 256 00:18:01,900 --> 00:18:04,180 Now, they have got conditional logic. 257 00:18:04,180 --> 00:18:06,480 They say, hey, do you see any Solana stuff? 258 00:18:06,480 --> 00:18:06,780 Nope. 259 00:18:06,780 --> 00:18:08,420 Do you go and see some ton stuff? 260 00:18:08,420 --> 00:18:08,720 Nope. 261 00:18:08,720 --> 00:18:11,600 Do you see some, you know, they're looking for things. 262 00:18:11,600 --> 00:18:13,880 And if they find it, then they go further. 263 00:18:13,880 --> 00:18:19,280 It's becoming a lot smarter and able to be used in more looking for more stuff. 264 00:18:19,320 --> 00:18:22,600 And finally, our friend browser extensions. 265 00:18:22,600 --> 00:18:23,020 Right? 266 00:18:23,680 --> 00:18:25,920 The pain of our existence. 267 00:18:25,920 --> 00:18:28,140 I'm still, in this browser, I'm not using any. 268 00:18:28,140 --> 00:18:34,920 But, yeah, the reality is that bad guys are able to use open source malware via browser extensions. 269 00:18:34,960 --> 00:18:36,820 And this is a growing threat really quickly. 270 00:18:36,920 --> 00:18:40,700 Open source malware targets developers and the dev environments. 271 00:18:40,760 --> 00:18:41,820 How does it do that? 272 00:18:42,100 --> 00:18:43,260 I'm sorry, why does it do that? 273 00:18:43,260 --> 00:18:44,340 It does that for two reasons. 274 00:18:44,340 --> 00:18:46,740 It does that to deploy the malware itself. 275 00:18:46,800 --> 00:18:51,960 But it also does it, targets the developers to take over their accounts. 276 00:18:52,780 --> 00: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? 277 00:19:00,440 --> 00:19:06,840 Why would I spend that time doing that when I could just, you know, build a much simpler path? 278 00:19:07,260 --> 00:19:10,080 Security tools, I can't stress this enough. 279 00:19:10,660 --> 00:19:14,100 Security tools, app set tools, are absolutely viable. 280 00:19:14,100 --> 00:19:17,580 They address the accidental vulnerabilities that we all know. 281 00:19:17,580 --> 00:19:20,340 The top ten vulnerabilities that we know. 282 00:19:20,360 --> 00:19:24,980 But they are not built, I'm sorry, they're not built to detect malicious behavior. 283 00:19:25,120 --> 00:19:36,880 In my workshop yesterday, I gave copious examples of how static analysis and SCA platforms just don't find this stuff. 284 00:19:36,880 --> 00:19:37,960 They just don't. 285 00:19:38,320 --> 00: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. 286 00:19:45,600 --> 00:19:47,020 They're just not running an EDR agent. 287 00:19:47,020 --> 00:19:49,800 Not that it would actually, you know, catch much of this stuff. 288 00:19:49,800 --> 00:19:56,120 But there's just this history of developers not having to run security tooling, and there you go. 289 00:19:56,320 --> 00:20:03,440 And developers use a lot of browser extensions, so that's another area that you can get to them. 290 00:20:03,440 --> 00:20:06,280 And finally, my favorite, all this AI stuff. 291 00:20:06,280 --> 00: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. 292 00:20:17,840 --> 00:20:21,980 It was just crazy how much the bad guys were targeting MCP specifically. 293 00:20:22,380 --> 00:20:25,160 But all the AI tooling right now is being targeted. 294 00:20:26,100 --> 00: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. 295 00:20:39,900 --> 00:20:45,080 Well, first and foremost, security tools are never running in those CICD pipelines. 296 00:20:46,240 --> 00: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. 297 00:20:55,640 --> 00: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. 298 00:21:07,660 --> 00: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. 299 00:21:17,560 --> 00:21:24,300 And finally, continuous integration, these pipelines, it's where two really important things come together. 300 00:21:24,300 --> 00:21:29,040 First is your core intellectual property, your source code, it's there. 301 00:21:29,040 --> 00: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. 302 00:21:52,380 --> 00:21:53,460 All right. 303 00:21:54,340 --> 00: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? 304 00:21:59,900 --> 00:22:01,480 Do we have anybody that wants to admit that? 305 00:22:01,480 --> 00:22:04,660 Are you offensive security and operate in this environment? 306 00:22:04,660 --> 00:22:05,840 Anybody want to admit that? 307 00:22:06,360 --> 00:22:07,380 All right, we got one. 308 00:22:07,380 --> 00:22:07,920 Me too. 309 00:22:07,920 --> 00:22:08,840 Me and you, bro. 310 00:22:09,340 --> 00:22:10,520 Me and you against the world. 311 00:22:11,280 --> 00: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. 312 00:22:26,440 --> 00:22:31,840 Many security vendors use those two things to determine if something is malicious. 313 00:22:31,840 --> 00:22:35,920 I've proven this again and again and again for sneaking a whole bunch of other tools out there. 314 00:22:36,500 --> 00:22:44,100 So here's the thing, if you can keep your malware out of, especially out of GHSA, you're good. 315 00:22:44,480 --> 00: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. 316 00:22:57,040 --> 00: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. 317 00:23:08,740 --> 00:23:10,220 And so you now have saved yourself. 318 00:23:10,220 --> 00:23:16,140 You can reuse that name for that package again in the future and you can also not burn that capability. 319 00:23:16,140 --> 00:23:17,860 So how do you not get detected? 320 00:23:17,860 --> 00: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. 321 00:23:28,920 --> 00:23:33,340 That's a little tip for all you offensive security practitioners out there. 322 00:23:33,480 --> 00:23:35,780 And finally, malware doesn't go boom. 323 00:23:35,820 --> 00:23:39,860 We have this idea of when you detonate malware, a binary . 324 00:23:39,860 --> 00:23:43,500 The reality is the kind of malware I look at doesn't go boom. 325 00:23:43,600 --> 00: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. 326 00:23:59,340 --> 00:24:02,360 It did everything that this web 3 package did. 327 00:24:02,360 --> 00:24:03,920 So it did what it was supposed to. 328 00:24:03,920 --> 00:24:10,080 It just also took every single event that was logged and sent it to the bad guys, right? 329 00:24:10,940 --> 00:24:17,020 Now the thing is that the only reason you would get pwned by that is if you imported that library. 330 00:24:17,020 --> 00:24:18,680 It wasn't using post install scripts. 331 00:24:18,680 --> 00:24:20,160 It wasn't using install scripts. 332 00:24:20,160 --> 00: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. 333 00:24:30,580 --> 00:24:34,800 But you would never see that malicious behavior unless you knew to take a look in that library. 334 00:24:34,800 --> 00:24:39,800 And so that library stayed on NPM for months and months and months doing all kinds of bad stuff. 335 00:24:39,800 --> 00:24:42,020 The reality is that this stuff is interpreted. 336 00:24:42,020 --> 00:24:45,540 It's not, you know, it doesn't blow up like traditional stuff does. 337 00:24:45,540 --> 00:24:47,680 It doesn't look like the normal stuff does. 338 00:24:47,680 --> 00:24:50,080 And that's why InfoSec really has left it alone. 339 00:24:50,080 --> 00:24:52,700 There's not a lot of people building solutions for this. 340 00:24:52,760 --> 00: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. 341 00:24:58,060 --> 00:25:00,680 You put those two things together and get this amazing grenade. 342 00:25:01,400 --> 00: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. 343 00:25:10,660 --> 00:25:11,640 If you're in the audience, I'm sorry. 344 00:25:11,640 --> 00:25:12,660 I won't do it again. 345 00:25:13,880 --> 00:25:18,900 Almost never use install scripts instead they use import. 346 00:25:19,460 --> 00:25:20,160 All right. 347 00:25:20,320 --> 00:25:23,020 So bad guys like to target what's hot. 348 00:25:23,020 --> 00:25:25,340 And so right now I just did it really quickly. 349 00:25:25,860 --> 00:25:28,180 Basically this is just me doing some hot data tape. 350 00:25:28,180 --> 00: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. 351 00:25:35,840 --> 00:25:36,200 Vite? 352 00:25:36,200 --> 00:25:36,860 Is that how I say it? 353 00:25:37,440 --> 00:25:37,820 Vite? 354 00:25:37,820 --> 00:25:38,480 Vite? 355 00:25:38,700 --> 00:25:44,680 Anything vite right now in NPM or PyPy, spend some extra time looking at it, right? 356 00:25:45,620 --> 00:25:50,760 Anything MCP, oh my God, take the time to look at it because bad guys are all over it. 357 00:25:50,760 --> 00: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. 358 00:25:59,020 --> 00:26:01,600 I'm going to go on a limb and say it's probably more than 60 percent. 359 00:26:01,600 --> 00:26:02,820 It's just straight up. 360 00:26:02,880 --> 00:26:03,780 It's going to gank you. 361 00:26:03,780 --> 00:26:04,660 It's just malicious. 362 00:26:05,540 --> 00: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? 363 00:26:11,160 --> 00:26:14,460 Stuff that's hot, yeah, I see a lot of phones going up here, yeah. 364 00:26:14,900 --> 00:26:17,420 You guys all owe me 900, no. 365 00:26:18,120 --> 00:26:19,680 I'm not going to go through every single one. 366 00:26:19,760 --> 00:26:21,080 Actually, how much time do I got? 367 00:26:22,180 --> 00:26:24,720 Yeah, I don't have time to go through every single one of these. 368 00:26:24,720 --> 00:26:28,520 But if I was a bad guy trying to, wow, that's a lot of phones. 369 00:26:30,040 --> 00:26:31,540 I wish I could take a picture of that. 370 00:26:31,540 --> 00:26:32,360 That would be sick. 371 00:26:33,420 --> 00: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. 372 00:26:42,180 --> 00:26:43,880 And a couple highlights here. 373 00:26:45,180 --> 00:26:46,300 And I see this right now. 374 00:26:46,300 --> 00:26:47,320 We'll talk about this in a second. 375 00:26:47,400 --> 00:26:50,080 Actually, I'm just going to jump ahead to the threat actors. 376 00:26:50,080 --> 00:26:54,040 We're going to talk about actual bad guys that are actually making malicious packages. 377 00:26:54,240 --> 00:26:58,060 Because I started a little bit early, I can go through all three of these. 378 00:26:58,140 --> 00:27:01,100 So first, let's talk about our friends in North Korea. 379 00:27:01,920 --> 00:27:04,140 Lazarus Group, you might have heard of them, right? 380 00:27:04,980 --> 00:27:05,760 No? 381 00:27:05,760 --> 00:27:06,720 Oh, sorry. 382 00:27:06,720 --> 00:27:07,760 Okay, my bad. 383 00:27:08,500 --> 00:27:14,840 They are actually, I just saw a report yesterday saying that they finally are now doing espionage. 384 00:27:14,840 --> 00:27:15,900 Did anybody else see this? 385 00:27:15,900 --> 00:27:20,440 Because they've been so singularly focused on stealing crypto. 386 00:27:20,440 --> 00:27:24,880 They've stolen over $2 billion worth of crypto in the last 18 months that we know about. 387 00:27:25,000 --> 00:27:30,740 They're 100% concentrating on it and they've come up with all kinds of crazy ways to do that. 388 00:27:31,440 --> 00: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. 389 00:27:41,760 --> 00: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. 390 00:27:48,760 --> 00:27:53,240 And so he's constantly, probably like once a week or once every two weeks, he sends me a new one. 391 00:27:53,240 --> 00: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. 392 00:27:59,900 --> 00:28:01,840 So just to be clear, yep, 10-4. 393 00:28:02,260 --> 00:28:04,160 I don't do the attribution, other people do. 394 00:28:04,160 --> 00:28:10,880 But anyhow, they are flooding NPM right now, and to a lesser extent, PyPy, with dependency confusion and typosquatting. 395 00:28:10,880 --> 00:28:17,480 So basically, they put the dependency confusion and typosquatting things there to then use in other parts of their campaign. 396 00:28:17,480 --> 00:28:23,040 So then when they hit you up on GitHub or LinkedIn, they can then call those malicious packages. 397 00:28:23,420 --> 00: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. 398 00:28:30,940 --> 00:28:35,700 But now, they're starting to be a little bit more, they're using conditional logic, they're looking for stuff. 399 00:28:36,360 --> 00:28:40,620 They do like to use obfuscation , they also like to use filler code. 400 00:28:40,620 --> 00: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. 401 00:28:48,280 --> 00: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. 402 00:28:58,600 --> 00:29:00,640 And by the way, these are singular events, right? 403 00:29:00,640 --> 00:29:04,060 This is why EDR has such a hard time finding this stuff, because it's a singular event. 404 00:29:04,060 --> 00: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. 405 00:29:10,860 --> 00:29:16,480 This is a literally a singular like curl or the equivalent calls out to them. 406 00:29:17,260 --> 00: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. 407 00:29:22,240 --> 00:29:25,880 Basically, I call these guys the Liren gang, they're Indonesians. 408 00:29:25,960 --> 00:29:30,260 For some reason, they've all kind of decided we're going to pretend to be Vietnamese women. 409 00:29:30,260 --> 00:29:31,520 I don't know why, but whatever. 410 00:29:32,400 --> 00:29:34,860 So you can and their OPSEC is shit. 411 00:29:34,860 --> 00:29:35,400 I mean, it's terrible. 412 00:29:35,400 --> 00:29:36,760 You can go and find these guys. 413 00:29:36,900 --> 00: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. 414 00:29:44,740 --> 00:29:47,360 There's a bunch of them that are high schoolers in Indonesia, right? 415 00:29:47,360 --> 00:29:48,740 Their OPSEC is terrible. 416 00:29:48,780 --> 00:29:49,580 And why? 417 00:29:49,660 --> 00:29:50,760 Because they feel comfortable. 418 00:29:50,760 --> 00:29:52,560 They feel like they're not doing anything wrong. 419 00:29:52,700 --> 00:29:58,500 Basically, their thing, and they're not particularly technical, what they like to do is they like to attack WhatsApp. 420 00:29:58,500 --> 00:30:00,080 So WhatsApp now does payments. 421 00:30:00,080 --> 00: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, 422 00:30:14,580 --> 00:30:16,300 like look at YouTube videos and all kinds of shit. 423 00:30:16,300 --> 00:30:18,900 I mean, they've got all kinds of crazy ways that they're using this. 424 00:30:18,960 --> 00:30:21,140 All of this stuff gets ex-filled back to Discord. 425 00:30:21,140 --> 00:30:27,240 They love Discord, probably because they're not technical enough to, yeah, buddy, to create actual C2 infrastructure. 426 00:30:27,280 --> 00:30:29,060 Very, very low technical skill. 427 00:30:29,800 --> 00:30:31,780 The Russians, we all know about the Russians. 428 00:30:31,780 --> 00:30:33,140 So I probably will skip this one. 429 00:30:33,140 --> 00: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. 430 00:30:41,140 --> 00: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. 431 00:30:50,320 --> 00: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. 432 00:30:55,640 --> 00:30:57,600 And finally, bug bounty researchers. 433 00:30:57,640 --> 00:31:01,820 Bug bounty researchers are flooding NPM on a month to month basis. 434 00:31:01,820 --> 00:31:06,660 We're looking at 40 plus percent of the malicious packages that I look at are from researchers. 435 00:31:06,820 --> 00:31:08,000 And we need to do something about this. 436 00:31:08,000 --> 00: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? 437 00:31:14,940 --> 00: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. 438 00:31:21,660 --> 00:31:22,400 How do we get better? 439 00:31:22,400 --> 00:31:27,600 We need better detection for our solution, from our solutions, our SCA providers, our ASPM providers. 440 00:31:27,660 --> 00:31:33,580 Engineering teams need to understand how to pull vetted packages from known private registries. 441 00:31:33,580 --> 00:31:37,220 Or I like to use, I like the idea of package firewalls. 442 00:31:37,220 --> 00:31:40,940 So the company I'm working for is building one, but Sonotype has one. 443 00:31:41,360 --> 00:31:42,880 A bunch of companies are working on them. 444 00:31:42,880 --> 00:31:44,640 There's an open source one too as well. 445 00:31:44,860 --> 00:31:47,640 You want to make sure that that integrates with your proxies as well. 446 00:31:47,640 --> 00:31:53,340 And basically what they do is they wrap around NPM or PyPy and don't let you call malicious packages. 447 00:31:53,720 --> 00:31:57,580 And finally, hire people with subject matter expertise, right? 448 00:31:57,580 --> 00:31:59,160 This is complicated shit. 449 00:31:59,570 --> 00:32:01,860 You know, don't think that tools is going to solve this. 450 00:32:01,860 --> 00:32:05,080 You need to hire some people with some SME in this space. 451 00:32:05,200 --> 00:32:07,900 And finally, here's some open source malware. 452 00:32:08,240 --> 00:32:10,360 Let me move the cursor so you can see that. 453 00:32:10,360 --> 00:32:11,400 Take a picture of that. 454 00:32:11,440 --> 00:32:13,620 These are all the places that I go to get information. 455 00:32:13,620 --> 00:32:15,040 Damn, that's a lot of phones. 456 00:32:15,040 --> 00:32:17,240 That is such a, oh man, I wish I could take a picture of that. 457 00:32:17,240 --> 00:32:17,920 That's dope. 458 00:32:19,500 --> 00:32:21,860 I'll try to make this available on my GitHub account. 459 00:32:21,860 --> 00:32:24,860 So GitHub.com slash six mile. 460 00:32:24,880 --> 00:32:27,220 I'm from Detroit, probably so. 461 00:32:27,680 --> 00:32:31,180 This, this is some of the places that I go to get information about open source malware. 462 00:32:31,180 --> 00:32:32,600 And finally, that's me, Paul McCarty. 463 00:32:32,600 --> 00:32:33,140 Thank you so much. 464 00:32:33,140 --> 00:32:34,080 I appreciate it.