BLOG

The OpenSourceMalware Show #32

Two new GitHub security features, token farming in npm, and PolinRider redundancy techniques

By cb482791-4ef1-4762-96ad-b0ca4bdd538e ยท

The OpenSourceMalware Show #32

The OpenSourceMalware Show is available on YouTube, LinkedIn, and as a podcast.

Two new GitHub security features, token farming hurts malware detection, and new PolinRider redundancy tactics

This week we talked about:

Two new GitHub security features: GitHub added two new features this week - blocking pull_request_target by default and batch approval for npm staged packages. We talk about where these can limit software supply chain attacks, and the gaps that still remain.

Token farming hurts malware detection: Token farming packages exist to game reward platforms like Tea. Although they contain no malware, their worm-like scripts and packages that call each other make them look malicious. They create noise for researchers and distract from where the real problems reside. We walk through what npm could do to stop this abuse, and why the same controls would improve their malware detection.

New PolinRider redundancy tactics: We observed some new techniques this week for how North Korea makes its PolinRider infections harder to detect. This includes adding several redundancy mechanisms to a single infected repo, "trampolining" across multiple files/scripts, and using a Base64 URL disguised as an API key to reach a payload located outside the repo.


Resources

[00:00:00] Jenn Gile: Hello. It is Friday, December 4th. Paul and I are both in North America this week, so doing a, uh, a closer to real time, uh, as we talk to each other. So, uh, if you're new to the show, um, my name's Jenn Gile. Paul McCarty and I are the co-founders of OpenSourceMalware, and we do this little podcast every week to talk about the trends that we're seeing in malicious open source, any new interesting research.

[00:00:30] Jenn Gile: Um, we have a few topics on the agenda today. GitHub has come out with a couple of announcements in the last week that are worth a conversation to understand what they do or don't do and, uh, what impact they might have. Uh, we're gonna talk about, uh, the, I guess I was gonna say resurgence, but it's continuing surgence, whatever, continuation of these- Comes, comes

[00:00:55] Paul McCarty: in waves.

[00:00:56] Paul McCarty: Yeah ...

[00:00:56] Jenn Gile: yeah, this, these token farming campaigns that in particular are a problem in npm. And then finally, we're going to wrap up with some PolinRider, um, North Korean malware research that I did this week. So let's jump straight into the GitHub announcements. I will go ahead and, uh, share some links here in a second.

Two new GitHub security features

[00:01:18] Jenn Gile: But they made two announcements, you know, maybe a day or two apart, and the first one, um, actually caught my eye because, um, our friend Francois over at Boost Security was talking about it. It's a new pull_request_target block, and what this does is it's closing one way into, um, scraping CI secrets. This particular way is how TeamPCP was able to kick off its supply chain attack back in March by stealing a Trivy secret.

[00:01:53] Jenn Gile: Um- The docs themselves say it's partial, so, uh, it says, uh, you know, pwn requests that happen through a different, uh, workflow are not covered. So issue_comment, workflow_run, uh, fetching a PR code with, uh, git fetch, for example, running a downloaded artifact. So it's not covering everything, it's covering one specific way in.

[00:02:20] Jenn Gile: Um, Paul, I know you've been following some of the security community conversation about this. Uh, what are your thoughts?

[00:02:29] Paul McCarty: Yeah. I mean, I think that this is, first and foremost, this is a really good change. Happy to see it. Um, I think it's one of those things that's like, why did it take you this long to do it?

[00:02:39] Paul McCarty: And I'm not trying to like, you know, be negative or whatever, but it's like, genuinely this has been a problem for, for ages. Why did it take you until, you know, November 27th, '26, whatever year this is, to do this? Um, but that having been said, um, I think it does signi- dr- uh, sign- address a significant number of these kind of CI based attacks.

[00:03:02] Paul McCarty: But as to your point, Francois and others have mentioned, there are other ways, you know, to, to kind of still get things done. Um, so I mean, I guess my takeaway is, good job for doing this, guys. A little bit late, but let's keep the pressure up and let's keep it going, um, and address some of the other kind of issues, um, you know, that are attacking the NPM and GitHub ecosystem, but this is definitely a good, good change.

[00:03:32] Jenn Gile: Yeah. I mean, is it like a mind-blowing change that's gonna, uh, stop all GitHub malware? No, definitely not. You know, this is not the kind of thing that would stop, um, campaigns like GhostAction or PolinRider or wfx-loot or, uh, uh, React2STEAL. Like, those all rely on different ways of getting in. So just to be clear, like it's definitely an important change, but understand its limited focus.

[00:04:05] Jenn Gile: Okay. The second change that they announced is npm batch approval for staged packages. So let's start first before we talk about the change, um, about what staged packages are. So this got announced maybe a couple months ago, and we've been seeing them in npm as we, um, look at malicious packages. Often we'll see, you know, a staged release before the real one.

[00:04:34] Jenn Gile: So, like, we're seeing, uh, people leveraging this feature. Um, I don't know. What should people know about staged packages?

[00:04:44] Paul McCarty: Yeah. Well, staged packages basically, if you really boil it down, it's really simple. It basically allows a team to force an MFA challenge, um, you know, at, before publishing, right, effectively.

[00:05:00] Paul McCarty: Um, so like you said, there actually is a stage 0.00- 0.0.0 file that's created. People can't see... Even though that's a public artifact, people can't see

[00:05:15] Jenn Gile: what's in it- What's in it, yeah ...

[00:05:16] Paul McCarty: by definition, and that has been around, they pushed that a couple months ago. Uh, staged publishing has been around for several months now.

[00:05:25] Paul McCarty: What's different about this one today is that, um, now they're allowing you to push a many to one kind of scenario. So imagine multiple stages that all get pushed to one published artifact. So in other words-

[00:05:38] Jenn Gile: Yeah, what they're saying is this means there'll be one MFA challenge for all of them rather than a collection of-

[00:05:46] Paul McCarty: Yeah.

[00:05:46] Paul McCarty: And I think you and I were talking about those OIDC challenges and, and, and flattening them, and I agree. I think that what they're talking about here is just the fact that you only get challenged once even though there might be 10 staged, you know, packages I think this is overall good, and it's expected that you should be able to...

[00:06:06] Paul McCarty: Well, I mean, maybe not expected, but, you know, I'm not surprised that people would want to be able to iterate on, um, on the stage, the stages before it goes to production. Um, I think the biggest challenge, it's like, you know, is to, like, the infrastructure that people have built to be able to scan this. So for example, our scanning mechanism, you know, did not initially account for these new, uh, staged artifacts, and I think, you know, a lot of other people are probably in the same scenario.

[00:06:35] Paul McCarty: But, um, relatively easy thing to, to address. I don't know what these new staged files are gonna be. Are they, are they gonna be 0.0.1, 0.0.2, so on and so forth? I guess we'll see.

[00:06:47] Jenn Gile: Yeah, it's a little unclear. This is a very thin announcement. Um, it sounds like perhaps it's not actually available right now. Um, but the reasoning that they say, you know, is the, the impetus, impetus for this is, um, monorepos that need this kind of, uh, flexibility.

[00:07:11] Jenn Gile: Uh, I don't know. You and I have kind of debated whether this is really necessary for most monorepos, but it sounds like there may be some who have settings in a way where this could be useful.

[00:07:24] Paul McCarty: Yeah, unless you're nesting multiple Git repositories inside one another for your monorepo, which I, I don't, I don't think is commonly thought of as best practice.

[00:07:35] Paul McCarty: Um, you know, I don't understand where they're coming from with some of the language they've used, but, I mean, I guess

[00:07:42] Jenn Gile: we'll find out. My assumption is this is a customer ask, um-

[00:07:46] Paul McCarty: Yeah,

[00:07:46] Jenn Gile: probably ... you know, that came after staged publishing rolled out and people wanted some tweaks to it. So I guess net here, staged publishing is good.

[00:07:55] Jenn Gile: It means that if your token was stolen, the attacker will still be presented with a challenge that hopefully they can't get past. Depends on, I guess, how they broke into your account, but yeah, net good. Uh, this particular announcement is kind of like no real change.

[00:08:16] Paul McCarty: Agreed.

Token farming hurts malware detection

[00:08:18] Jenn Gile: Okay. Um, last week, kinda as we were heading into the Thanksgiving holiday, um, you and I were talking about token farming.

[00:08:29] Jenn Gile: And, uh, so kind of for our listeners who don't know about this particular way of abusing the ecosystem, there are certain, um, platforms that reward you for, uh, you know, downloads, things like that. And so people will publish packages on npm specifically in order to artificially inflate numbers. And a lot of times what these packages will do is they will just be total junk.

[00:09:03] Jenn Gile: They don't do anything. Um, there... To be clear, there's no malware in them. Um, they are designed solely to inflate numbers of either themselves or other packages, and there'll be dependencies based on them. So why are we talking about this if there's no malware? Well, a lot of these end up having a script that looks sketchy, and the way that they get flagged by, um, security analysts, by npm, is in a way that, like, these look like malware when they come up.

[00:09:36] Jenn Gile: And so we, as well as, you know, our peers in the industry, spend a lot of time, wasted time, analyzing these and figuring out, "Oh, it's just junk." Like, great, thanks. You know, it kind of distracts from the real problems in the ecosystem. Um, we've seen these types of campaigns hit other ecosystems. I know Ruby got hit with something like this, but they are, uh, highly, um, reactive in a good way.

[00:10:09] Jenn Gile: I- I... Reactive's not usually the right word you wanna hear, but, like, Ruby's very responsive when these hit. They pull them out as soon as possible. Um, a lot of these npm token farming packages have been in npm for multiple years. Um, I was looking at one of the publishers. They have over 10,000 packages on npm, which is just a crazy amount.

[00:10:33] Jenn Gile: We know most of those are these token farming packages. Um, so I think this is in a little bit our way of saying, "Hey, there's a, a, an abuse problem in the ecosystem that makes it harder for everybody to identify what's really dangerous." Would you say that? summarizes your irritation with this particular problem?

[00:10:56] Paul McCarty: Yeah, I think there's a, there's another component to it too as well. So yeah, like, like Jenn says, there's no actual malware in these things, so to call them malicious is a bit of a stretch, and that's why we internally we've had a tough time kind of deciding how to, to flag these things. However, especially with the first several waves of this were the big- which were the bigger waves, there was a secondary component that made this more malicious feeling, and that was a script that would, um, it basically referenced an internal, um, set of names, and it randomly generated new packages, um, based on- Yeah, it's

[00:11:30] Jenn Gile: kinda worm-like when it first- Yeah

[00:11:32] Jenn Gile: came out. Everyone looked at it and kinda thought, "Oh, no, it's another worm."

[00:11:37] Paul McCarty: Yeah, and so when I found this, which I think was in March of this year, but you're right, many of these packages go back,

[00:11:45] Jenn Gile: um- I looked. It was November of last year

[00:11:47] Paul McCarty: Oh, was it? Okay. Sorry. The, all, all the worms blend together, but, um, that's funny.

[00:11:52] Paul McCarty: So would it come after the original, um- It came

[00:11:56] Jenn Gile: out right around the same time as Shai-Hulud came out. Yeah And so it looked a lot worse than it really was, and it caused, I think, some fair panic

[00:12:07] Paul McCarty: Yeah. Well, I remember when I kind of identified it, I was like, "Why hasn't somebody else already found this?"

[00:12:12] Paul McCarty: 'Cause h- here's the thing is the number of these things is gargantuan. Before IndonesianFoods, which was the first big wave that I found, there were roughly about 60,000 malicious packages identified in OSV, um, and then, you know, in, in, uh, eventually OSM, when OSM came into existence about the same time last year, that...

[00:12:34] Paul McCarty: So there was, there's known about N- uh, there was roughly speaking about 60,000 known malicious NPM packages until that time. IndonesianFoods itself was 156,000 new. N- new. So suddenly you took the number and it went from the total number of known malicious packages went from being 60,000 to over 200,000, and that was significant, right?

[00:12:55] Paul McCarty: Which is why when- It

[00:12:56] Jenn Gile: looked really bad, and there was so much chatter in the industry, frankly, by people who didn't understand that it wasn't really malware, of, like, this emergency, like, uh, I don't know what you remember from that time, but I was definitely in the thick of, you know, how bad is the problem in NPM, and there was a lot of misunderstanding.

[00:13:18] Jenn Gile: But yes, malware was increasing, but IndonesianFoods made it look like it was increasing at an absolutely- Exactly ... insane rate- Exactly ... that is not accurate. And actually today, because we do catalog these to make sure, um, you know, if people come across them that they know, we just mark the severity as low, 66% of our database for NPM packages is this junk.

[00:13:45] Jenn Gile: Yeah. And that's frustrating, I think, to both of us.

[00:13:51] Paul McCarty: I, I think the other thing too, and, and I wanna talk about what Tea is itself, because I think there's some interesting things there- Mm-hmm ... to kind of understand how this influenced-

[00:13:59] Jenn Gile: Yeah, the Tea

[00:13:59] Paul McCarty: Party ... 'cause it's really... Yeah. It's really kind of how two different worlds kinda came together.

[00:14:03] Paul McCarty: But, um, to that point about the first thing I wanted to say, um, which is, um, the, the other thing that kinda made this look and feel like a malicious- campaign- Mm-hmm ... was the packages call each other. So-

[00:14:19] Jenn Gile: Mm-hmm ...

[00:14:19] Paul McCarty: um, and it's not just the packages, the, the net new packages called the original package, which also happened.

[00:14:26] Paul McCarty: It's that many of the packages call, like, one or two or five of these kind of essential top level packages, which had the worm capability in them. So it was a combination of the fact that they didn't do anything legitimate, they had this worm-like behavior, and they were calling each other, which by the way, we see all the time in- With-

[00:14:45] Paul McCarty: actual malicious packages. Malware,

[00:14:47] Jenn Gile: yeah.

[00:14:47] Paul McCarty: Yeah. Where, like, one thing that is benign will call a dependency that, um, is malicious. Or now what we see a lot is a benign package will call a benign package, which will call a benign package, which will call a malicious package. So you put all those signals together and, um, you know, it's malware, it just doesn't have, like, a malicious payload.

[00:15:09] Paul McCarty: Um, which is just proof that it's just kind of weird and it's not black or white, right, Jenn?

[00:15:15] Jenn Gile: Yeah. Well, so one of the things that you did in the article that we published last week, this week, time's funny, um, was talk about what NPM could actually do to stop these campaigns, because this is, in our opinion, a solvable problem.

[00:15:31] Jenn Gile: Um, I laughed when I saw your first reason, because this is, like, this would solve so many problems, and that is limit what new accounts can do, and in particular, limit how many packages a brand new account can publish. Like, this is common in many ecosystems that you have a holding period. Sure, it's not gonna eliminate all of it.

[00:15:57] Jenn Gile: People could spin up accounts and then wait a week, but you know, you could have some automation in place that looked for concerning things. So I don't think there's a whole lot to say with that other than NPM really should do the thing that would also benefit the ecosystem- Right ... more broadly, right?

[00:16:17] Paul McCarty: Like, why is this not just a thing that you've done since day one? Like, seriously, like-

[00:16:22] Jenn Gile: Well- It would have been ... and I'm gonna take your things out of order because I think one of your others is very similar, is block dependencies on known abuse packages. Yeah. So, like you mentioned, they tend to depend on a small set of packages.

[00:16:40] Jenn Gile: Once a package is confirmed abusive, anything new that depends on it should also be blocked, and we're not really seeing that behavior.

[00:16:52] Paul McCarty: Nope.

[00:16:54] Jenn Gile: And again- Yeah,

[00:16:54] Paul McCarty: and I- ...

[00:16:55] Jenn Gile: this would be a thing that would benefit the ecosystem in general.

[00:16:59] Paul McCarty: I think if I were to like, if I s- if you and I sat down at a table with a bunch of people at GitHub and we brought this up, you know, like, "Hey, these are the things that we're bringing to you that are good ideas."

[00:17:07] Paul McCarty: I don't know what that accent was, but if, if we could like say that to them, um, they would probably say, "Well, that means, you know, there's a lot of overhead there that we have to..." Um, you know, and I... When I'm doing this exercise in my head, I'm doing this because I want- Mm-hmm ... to understand empathetically and like what are gonna be the pushbacks and why, what are some reasons they might not wanna do this?

[00:17:26] Paul McCarty: That's important to me, right? But I think their first response would be, "Well, first we'd have to like analyze each package dot JSON file and see what dependencies it's pulling." I'm like, well, y- you're definitely ana-

[00:17:38] Jenn Gile: You should be doing that anyway.

[00:17:39] Paul McCarty: Yeah, you're analyzing the package dot JSON anyhow. The great thing about this is that like I'm not even asking you to like look through the transitive dependency structure.

[00:17:48] Paul McCarty: I'm just asking you in the top level packages. So that's just a, that's just g- you know- Low-hanging fruit ... grabbing. Yeah, that's low-hanging fruit. That's... I'm not asking you to do a w- we are not asking you to do a lot here. Just say i- if any of like the dependencies are specifically called out that are malicious, you know, just don't allow them to publish that version while it's in staging or whatever, right?

[00:18:08] Paul McCarty: Hey, let's combine some of the things we already-

[00:18:10] Jenn Gile: Well, another related one that really puzzles me because in GitHub, if somebody has a malicious repo for good or bad, if you have one malicious repo, your whole account gets killed. Do I agree with that? No, but that's the way they've decided to do it. Yeah.

[00:18:25] Jenn Gile: In npm, that is not necessarily the case. So- True ... one of the things that we've observed is a lot of the people who are committing this abuse, their accounts have not been shut down. Uh, I looked at one account, again, that has over 10,000 packages published to it. Most of those are this spam junk that is documented, known.

[00:18:48] Jenn Gile: We're not the only ones who know about it. Um, npm itself-

[00:18:51] Paul McCarty: Right ...

[00:18:52] Jenn Gile: has been shutting these things down. So again, it's kind of that like what's good for stopping- Token farming is also good for stopping malware

[00:19:03] Paul McCarty: 100%. To be fair and, and clear, you know, NPM has, um, you know, when they look at packages inside of an account and they realize that all packages are malicious, they do nuke the whole account, and they've been doing that for years.

[00:19:20] Paul McCarty: But what you're talking about, Jenn, is this kind of this gray area where they're like, well, some of the packages look benign or legitimate. Well, here's the problem, NPM, is like, you know... And I'm not saying that you wanna do this across the board, because people do get compromised, and we want to have this other- Yeah

[00:19:37] Paul McCarty: this other gate that says, "If you've had an account takeover or if your system has been compromised," we don't want all of your packages to be nuked. But what bad guys will do, and they are probably already doing this, is they will create legitimate looking packages that have no malicious nature at all, let those age-

[00:19:54] Jenn Gile: Stew a little bit, yeah

[00:19:55] Paul McCarty: stew a little bit, let them age like fine wine, not that long, you know, a couple weeks, a month maybe, and then deploy the package. Uh, and the great thing then is that it saves them. 'Cause one of the things that, you know, in trust and safety, w- we'll be talking about this next week with the GitLab thing. I, I, you know, w- we don't know enough about it yet to talk about it this week, but we'll talk about it probably next week.

[00:20:15] Paul McCarty: But the thing with a lot of trust and safety teams is they're trying to determine is the actor malicious or not, right? Mm-hmm. And it's really easy to fool you if the trust and safety team, if you publish these things. But also one of the mo- biggest, you know, hurdles is if you kill the account, it takes a significant amount of automation to go and create one to replace that one, and you're not, you know, whether you're DPRK or somebody else, you're not necessarily putting conditionals into your automation that says, "Oh, hey, if you lose 10- If

[00:20:45] Jenn Gile: this happens

[00:20:45] Paul McCarty: go and create 10," you know?

[00:20:49] Jenn Gile: So you've got two other, um-

[00:20:51] Paul McCarty: I've spent way too much time thinking about this, I swear.

[00:20:53] Jenn Gile: No, I know. That's okay. Um, you know, this is an example of... Like again, it's not malware, but understanding how these things work help us understand how the malware response works. Um, you had two others that I think are also related in different ways.

[00:21:14] Jenn Gile: So one is, um, repeated tea.yaml wallets. Uh, why don't you stop or start with, uh, you know, why would that be a, a signal?

[00:21:26] Paul McCarty: Yeah. So the tea.yaml. So maybe it's helpful here, I mentioned it earlier, maybe it's helpful here,

[00:21:31] Jenn Gile: um- Talk about Tea, yeah ...

[00:21:31] Paul McCarty: to talk about, yeah, what, what Tea is. So basically Tea is this i- it was a really good idea.

[00:21:37] Paul McCarty: The idea was to like incentivize financially, amongst other ways, open source, you know, maintainers. It was basically that. As I understand it, it was basically the idea. So the Tea protocol was, was created by a couple of guys, one of whom was the, um, the original guy behind, or one of the original guys behind Homebrew, right?

[00:21:58] Paul McCarty: The- Mm ... the most popular package manager for the Mac. Um, but the idea was, yeah, let's, you know, open source maintainers, uh, you know, do this on their own. They're not getting paid. Um, you know, they're under a lot of strain right now with all the security requirements we're throwing at them. Let's do something to incentivize them.

[00:22:14] Paul McCarty: So the idea was that if you put a, a, this tea.yaml file in which called a, a, it had a, it had a blockchain address inside of... One of the configuration options, uh, requirements was this blockchain address, which was on the Tea, um, blockchain. And, um, uh, you know, if your package or your thing was really popular, there was this thing called TeaRank, which basically just went out and looked at how many people were using your thing, and then you would be on the, on the TeaRank, and then you could get things for that, right?

[00:22:47] Paul McCarty: You could get incentivized from that, and you could get, you know... There's, there's, like all crypto things, you know, it's like, it's a blockchain, but it's also, there's a currency component there. So you're gonna get, you're gonna get Tea currency, I guess. Um, so in theory, the idea was good, but then the problem is like almost immediately people started figuring out how to game it, and one of those ways is to create a bunch of junk NPM packages that all call each other.

[00:23:12] Paul McCarty: And so you create 160,000 NPM packages that all call each other. You just create all this energy, and you have just all these references to the same Tea address, which means that, you know, you're going up the TeaRank thing. Um- Now, to their credit, the guys behind Tea came out with a, uh, a- A

[00:23:33] Jenn Gile: way to fix, yeah

[00:23:35] Paul McCarty: yeah, and they made an announcement saying, "Hey, our intent was never to let people game this, so let's put some implementations into it." And if you're interested, you can go just find that. You know, you can just search for

[00:23:44] Jenn Gile: tea dot YAML somewhere. Yeah, I'll drop the link. I've got it from- Yeah, um- ... what I added.

[00:23:50] Jenn Gile: Yeah

[00:23:51] Paul McCarty: But back to h- what NPM could do, they could say, simply say, "If there's a tea.yaml file in the package, don't push it." Or use that as a flag, a trigger to say, does this look like a, a spam campaign package, right? Because I'm not gonna make the deter- determination. You know, we have to leave that up to NPM 'cause it's their registry.

[00:24:14] Paul McCarty: If I owned it, I would make my own decision, but I don't. It's up to them to say, "Hey, do we wanna allow people to use Tea in a legitimate fashion?" Which is how it supposedly was designed. That's great. That's fine, if that's your decision. But then, you know, identify there's a tea.yaml file in the package contents, and then figure out is this a legitimate package that happens to be using Tea or is it spam?

[00:24:37] Paul McCarty: To me, that seems really simple.

[00:24:38] Jenn Gile: Yeah. Yeah. Okay, you had one other that I felt like was also very obvious. Not that I'm criticizing, like these are, these are things that other people surely have thought about, uh, was detect near identical packages. So I was thinking about that because we certainly see lots of copies of existing legitimate packages where it would be expected that things might be identical.

[00:25:08] Jenn Gile: You know, some of the code would be identical, the README would be identical. So how would... And I guess what I should say is this is already something that gets highly abused by actual threat actors, where they'll copy- Yeah ... a legitimate package, keep the legitimate functionality, zhuzh it up a little bit to make it pop in the results, slide in some malware.

[00:25:29] Jenn Gile: So how, like, how would you say you could, uh, differentiate between- The legitimate copying of a package because you wanna fork it and do something unique with it, versus these spam ones. Are you just looking at volume?

[00:25:53] Paul McCarty: No, because you don't wanna look at volume because as we know, it's really easy to fake that.

[00:26:00] Paul McCarty: So if we, if we-

[00:26:01] Jenn Gile: Oh, I mean in terms of if you have 100 copies of a single package, like-

[00:26:06] Paul McCarty: Oh. Oh ...

[00:26:07] Jenn Gile: if you're, if you're looking at how many copies of it there are. And 100's arbitrary.

[00:26:13] Paul McCarty: Yeah, 10-4, understood. Okay, and so th- the interesting thing about this, this observation or this suggestion to NPM has multiple ways it can kind of be implemented, and some of those ways specifically could target things like Tea, right, and token farming.

[00:26:29] Jenn Gile: Mm-hmm.

[00:26:30] Paul McCarty: Or they can target kind of the, the bread and butter... Well, is that the right... The, the normal everyday worker day, as they say on Risky Biz, the worker day, um, you know, typosquats and copycat lookalike packages, malicious lookalike packages. And the way you would do this could be, could be, you know, customized for either/or kind of scenario.

[00:26:53] Paul McCarty: But in the former sense, like the typosquats and, um, and the kind of, you know, fake malicious stuff, you can be looking for does this reference a GitHub repo that doesn't align with the name or the, the maintainer or the author that's on it? Now, all of these things, by the way, all of us that have written scanners should be looking at this data, right?

[00:27:19] Paul McCarty: Like, that's one of the simplest things you can do to figure out whether- Look at the

[00:27:24] Jenn Gile: package ...

[00:27:24] Paul McCarty: there's a problem.

[00:27:24] Jenn Gile: Yeah. Yeah.

[00:27:25] Paul McCarty: Is there a provenance- And

[00:27:26] Jenn Gile: then,

[00:27:27] Paul McCarty: yeah ... set of triggers here or not? Yeah. Um, another thing to look at is does the name of... 'Cause what'll happen is when bad guys copy an existing package, whether it's for Tea or whether it's for something else, they'll copy the README, and a lot of times they just won't change anything in the README.

[00:27:43] Paul McCarty: No, it's word for

[00:27:43] Jenn Gile: word. So- Yeah, they don't change at all.

[00:27:44] Paul McCarty: Yes. So does the name of package in README com- is it not matched to the name of the actual file that's called in package.json? Another one is, like, if you take out the line for the package name, is the, is the rest of the file byte for byte with a pa- sorry, the package manifest file byte for byte with- Mm-hmm

[00:28:04] Paul McCarty: another existing package manifest? And there's actually a, there's a cool little algorithm that allows you to do that, which is you truncate that line, then you do the file hash, and

[00:28:12] Jenn Gile: then- Oh, and the hash will match. Yeah ...

[00:28:14] Paul McCarty: yeah, exactly. Yeah. That's neat. It's pretty sneaky, right? As long as there's not some...

[00:28:18] Paul McCarty: That algorithm can get thrown off by additional, you know... JSON's, JSON's structure can be a problem for it, and, um, and just, you know, spare new lines and stuff like that. But, but it works well. I've, I've, you know, I've implemented some of my stuff in the past. But, um, yeah, sorry, I'm going, I'm meandering here because this, this one- No, this is useful.

[00:28:39] Jenn Gile: Yeah ...

[00:28:40] Paul McCarty: this one kind of- Like, you know, way for them to flag some of this stuff could then, 'cause my scanner does this, I look for that, and if I see that I'm like, "Oh, let me look closer," right? Mm-hmm. "Let me look for more." There's no reason they can't be doing that.

[00:28:55] Jenn Gile: Well,

[00:28:55] Paul McCarty: that's, I think like when you talk about- Especially since we're...

[00:28:58] Paul McCarty: Wait, wait. Supposed to... They're already supposed to be doing this, right

[00:29:00] Jenn Gile: Jenn? Yeah. Um, these are all signals that by themselves are not necessarily indicative of abuse or malware, but as with many things, the more signals, the higher the score, the more likely it is that something sketchy is going on. All right.

[00:29:18] Jenn Gile: Have we finished with the tea? We're done? Yeah, I'm good. I'm- Tea's gotten cold ...

[00:29:22] Paul McCarty: I'm,

[00:29:22] Jenn Gile: I'm

[00:29:23] Paul McCarty: over it Whatever

New PolinRider redundancy tactics

[00:29:23] Jenn Gile: version you want. Okay, I wanna talk a bit about, um, some PolinRider research that I did this week. So I was reviewing our threat report submissions and saw a few from one of our active community members, Anderson Lin.

[00:29:38] Jenn Gile: Thank you for being active. And, um, most of them were pretty standard VS Code, auto runs, a fake font file. And so, you know, when I see that it's like, okay, yeah, that's the usual thing. And then I paused on one because I was like, oh, this one looks different. Um, he submitted a repo that had five different ways to trigger, uh, an obfuscated JavaScript loader to run and then install malware on whoever, you know, opened that, uh, code.

[00:30:13] Jenn Gile: And some of those were ones we've seen before, but seeing five redundancy paths is unusual. Two, kinda common. Three, every once in a while. If it is more than two, it's usually multiple config files that they've-

[00:30:31] Paul McCarty: Yeah ...

[00:30:31] Jenn Gile: inserted it into. So the two things that we typically see are abusing tasks, VS Code tasks, and then a config file that has the, uh, blob amended to the end of it.

[00:30:44] Jenn Gile: So this one had, again, five. Uh, it had three config files, um, that had the payload attached to it, and then it had, um... Let me make sure on my notes I don't miss say this. It had an init file that runs from an NPM script, so basically any time you, um, run NPM, this init file is gonna run. Um, and then, and so that's a little bit more novel but not totally unique.

[00:31:14] Jenn Gile: And then the last thing that it had was a bit of a different way of abusing the VS task- VSC code task JSON file. And, um, I don't know. I was feeling a little punchy. I started calling this a trampoline because what it does is it hops multiple times from the tasks file so that if you're looking... Uh, very similar to what you said earlier with dependencies.

[00:31:43] Jenn Gile: You know, your first- Your package is benign, your first layer of dependencies are benign, your second layer of dependencies are benign, and then the malware is hidden in the third. They did the same thing here. So w- the tasks file auto-runs, it's alleging to do a lint check. So it goes and, um Uh, on the folder open, it depends on the lint check, which then starts a, um, second file.

[00:32:13] Jenn Gile: That second file is the lint check. The lint check runs a shim. That shim says, "Hey, Node, run VS Code/ESLint," and that is where the malware lives. So it's in a file that is not directly called from VS Code. So if you're a developer reviewing this file because perhaps you've heard they're dodgy, you might look at it and say, "Oh, it's just running a lint check."

[00:32:44] Jenn Gile: You look at the, the thing that it runs. You think, "Okay, it looks fine," and you don't jump the three levels down to see what's really going on. So, um- Yeah ... there's another interesting redundancy thing that I found that I wanna talk about, but let's pause on this one. Um, other than, you know, going nuclear and not relying on VS Code and completely, you know, ignoring all task file, how would you tell people to detect this type of behavior where there's nothing in the task file that's happening that's really all that sketchy?

[00:33:25] Paul McCarty: Yeah, I mean, there's some really basic things that you've wanted to do from day one that still would be helpful in this scenario, right? One is to look for, in the presence of a task.json file, look for the run on folder, uh, option and look for command or shell, right?

[00:33:41] Jenn Gile: Mm-hmm.

[00:33:42] Paul McCarty: Um, and there's some other things you can, like if you're looking for...

[00:33:44] Paul McCarty: You can look for like a shell that's calling out to Linux. But I know that's not the case for this particular one, but for DPRK stuff, you can look for a shell that's looking for OSX, Linux, or Mac as well. So i- if, so basically this is the way your function works.

[00:33:58] Jenn Gile: If- Right, if it's doing any kind of what kind of ecosystem are you on, what's your OS?

[00:34:04] Paul McCarty: Yeah. But even without that, what, basically what you do is you start chaining these signals together and a, and a low green, and a low green, and a low green suddenly becomes a medium or high, right? And this is, the same thing works in the vulnerability world where you like chain together these lows, um, and mediums and suddenly get a critical.

[00:34:21] Paul McCarty: It's the same kind of thing. So yeah, look for the presence of run on folder options. Look for whether or not it's calling a shell or a command. Um, and then, uh, also look for the pipe symbol. Like, so the way... If you're piping inside of the, the quote marks on a shell command, that's a pretty good thing to look for, whether it's a single pipe and you're just piping, or whether it's a double pipe and it's or.

[00:34:44] Paul McCarty: These are those commands that- It's very rare for people to be doing that kind of thing in a legitimate one. Does it happen? Yes, I've seen them myself. But, you know, if you've got 20 of them, probably the majority of them are gonna be, you know, malicious and not somebody doing something weird like that.

[00:34:59] Jenn Gile: So- Yeah, the other thing to note would be if something is set up so that this thing is running Without your explicit, like, not just saying yes to it, but also running without your knowledge.

[00:35:13] Jenn Gile: So one of the ways that they did this was in a slightly different file. In the settings, uh, .json file, it, um... Let me go back to it. There's a task.allowAutomaticTasks row, and it is listed as true. And so what that means is that, in conjunction with the task file, it will run, um, it'll skip the prompt that VS Code is gonna show before running a task automatically.

[00:35:44] Jenn Gile: Right. So you don't know that it's happening. So, you know, I talk to a lot of people who are like, "Well, just don't click the thing that says, 'Is it okay to run this?'" And, you know, that's true, don't click it. But they are finding more ways to get around the way that this-

[00:36:00] Paul McCarty: Right ...

[00:36:00] Jenn Gile: that VS Code works.

[00:36:02] Paul McCarty: Those are s- those are probably the same people that just say, "Well, just upgrade to the new version, dummy, and you will never get-

[00:36:08] Jenn Gile: Yeah

[00:36:08] Paul McCarty: you will never get compromised." Um, the... Oh, oh my gosh, I had something important there to say about that. Uh, just... Oh. All right. So VS Code, like, like many things, you can override what's in the config file. There's like, there's like three or four different places to override some of these, these functions.

[00:36:27] Paul McCarty: So even if the config file has that turned off, if you pass an environment file... So basically all the bad guy has to do, and I've seen this myself, is-

[00:36:35] Jenn Gile: Yeah, I've been seeing those files ...

[00:36:37] Paul McCarty: you just, yeah, you run the shell command that exports the variable, that then runs VS Code and, you know, that, it's gonna ignore that config off thing.

[00:36:46] Paul McCarty: So, you know, just because the key value pairs are set the way you think they are, don't think that people can't run these task file. DPRK and all these bad guys would not be just over-indexing on VS Code tasks if they weren't working, right? You're right. So don't think just because you've got GPO set up in your AD and all these other things, don't expect it...

[00:37:08] Paul McCarty: Do- I guess don't assume that's, that's covering you, right? It's not.

[00:37:13] Jenn Gile: Well, and I think know that there are probably going to be multiple ways that they can, you know, they are building in redundancy. And so when I dug into this one some more, I found that the malicious commits actually came from a different user.

[00:37:31] Jenn Gile: This repo had been built by someone else and transferred to the existing user. And the original developer, I don't think is a threat actor either. I think they're a victim.

[00:37:43] Paul McCarty: Yeah.

[00:37:43] Jenn Gile: All of these, uh, their repos are also compromised. Um, but even though these pushes are happening at the same time, and the, um- infection is coming from the same machine.

[00:37:56] Jenn Gile: We're not seeing the same redundancy tactics in all of the repos. They're all slightly different. Yeah. And you and I have talked about this experimentation thing that they do, and so this, again, very much looks to me like some experimentation. So one of the other things that I found in, uh, the victim, the, um, other victim's repos, is in addition to the VS Code thing, some config files, they also had, um, a trick that we've seen part of before, and that's a URL descri- uh, disguised as an API key.

[00:38:37] Jenn Gile: So there'll be a, like you said, a .env file, and it has, it'll say API key and then a string. Well, that string is just Base64. It's not, um, it's not a real key, but it looks like a key, 'cause Base64- Right ... kinda looks like an API key. Um, and if you, i- in the past, those would jump off to, like, a Vercel hosted site.

[00:39:02] Jenn Gile: That's not what they're doing here. Um, in this case, the way it's configured is it says, you know, "Hey, anything you find at this URL, just run it." And what you find at that URL is a GitLab repository. And that was one of those, when I, when I clicked the thing, I was like, "Oh, that's sneaky." You know, we're, we're getting onto another, um, legitimate platform, and GitLab is harder to find these things in because there's no global search that we can look for, but it is byte identical as...

[00:39:38] Jenn Gile: So it's the same obfuscated JavaScript loader, same campaign marker in all of these places, including that GitLab repo. And I mean, the benefit, obviously, with the GitLab repo is you can swap out payloads to your heart's content. You don't have to go and-

[00:39:59] Paul McCarty: Yeah ...

[00:40:00] Jenn Gile: push something new to their GitHub repository.

[00:40:03] Jenn Gile: This is, you know, working like a dynamic URL.

[00:40:08] Paul McCarty: Yeah. And I think, too, that-

[00:40:10] Jenn Gile: Side note, I couldn't figure out how to report the repo, so we're gonna have to talk about that. Um- GitLab makes it a little harder than it should be

[00:40:19] Paul McCarty: Interesting. Yeah, there... Oh, you have to do it at the user level. So basically, um, you can, you can report the user.

[00:40:25] Paul McCarty: Yeah,

[00:40:25] Jenn Gile: I, I will, we'll go down that rabbit hole later, but-

[00:40:29] Paul McCarty: Fair enough ...

[00:40:29] Jenn Gile: I struggled.

[00:40:30] Paul McCarty: Yeah. Well, you know, as a former GitLaber, like, there's, there's a bunch of things about GitLab, one of which is the fact that they cl- this is... I'm totally going out on, like, Jenn hasn't heard this yet, but they, they're case, they're supposed to be case insensitive, but they're really not.

[00:40:48] Jenn Gile: Hmm.

[00:40:48] Paul McCarty: But then they created a hack. So there's all these kind of weird things in GitLab, but in the l- you know, in the search o- the search function. Uh, so I was just thinking, I happened to find a spam campaign in GitLab today, which is what I teased about earlier, and I'll talk about it more next week when we know more, and once I've been able to disclose it.

[00:41:04] Paul McCarty: But, um, the, the... What I was thinking just then, Jenn, is, like, I bet you if there was a s- global search and we went and did a search for that spam campaign, I bet you we would find a lot more of these l- large scale things inside of GitLab just like we find in GitHub.

[00:41:18] Jenn Gile: Like, why not? I'm sure there's a ton, and it's just hard to find, and this is the point that I make when I give talks about PolinRider is like, yeah, this is a GitHub problem- And it is unique, but it is not- Yeah

[00:41:31] Jenn Gile: exclusive. Like-

[00:41:32] Paul McCarty: 100% ...

[00:41:33] Jenn Gile: I am, we know this is happening in GitLab and Bitbucket and other SCMs. The difference is they don't have a public search where we can find it, and there's- Right ... I mean, the, the extra reason it's problematic with GitHub is if you and I can find it, so can threat actors, and then they can use, like we saw with GhostAction, they can use this as inspiration for their next campaign.

[00:41:59] Jenn Gile: Yeah. So.

[00:42:00] Paul McCarty: Yeah.

[00:42:00] Jenn Gile: Yeah. Uh, I, when I clicked that link and ended up over in GitLab, it was a, "Whoa, that's not what I was expecting."

[00:42:08] Paul McCarty: I think, uh, this is the por- part of the, the show where I typically grab the computer, bring it close to my face and talk directly to GitHub. But today instead, I'm gonna talk to trust and safety teams.

[00:42:18] Paul McCarty: And what Jenn and I are talking about here is really important for you as trust and safety teams to push back on, you know, marketing teams and whatnot that are asking you to drop some of these onboarding functions to make it easier for people to onboard. Part of the reason that GitLab has traditionally been less prone to this kind of stuff is because they required more during onboarding.

[00:42:40] Paul McCarty: And I know from my time at GitLab, there was, you know, a lot of tension there between the marketing teams that really wanna drop some of these kind of resistance adding features, and the security team like myself, that were really pushing back on those. And, you know, the ability to kind of look before and after to see what the trust and...

[00:42:57] Paul McCarty: Sorry, it was to see what the, the, the onboarding changes meant, both in terms of cost and security incidents that came out of that. Trust and safety teams, by adding things like, you know, a credit card requiring a credit card or some other validation of the user, that is just enough resistance to keep the bad guys out to a large extent.

[00:43:20] Paul McCarty: Um, so, sorry, that was a long-winded affair there, but I think it's important that, you know, trust and safety teams realize th- a lot of these little things make a big, big difference.

[00:43:30] Jenn Gile: Well, and I think that would be the comment that I would make to marketing people, 'cause it's certainly having worked in product for a long time, you wanna make the product as easy to onboard, easy to use, you know, reduce the friction for sign up.

[00:43:44] Jenn Gile: So this is also a, like, product people please, please understand the trade-off is maybe worth it depending on your, your values. All right, we're at almost 45 minutes. We went a little longer than I expected with only two topics. I was not expecting

[00:44:03] Paul McCarty: us to go long.

[00:44:04] Jenn Gile: So let's call it there. Yeah, let's do it.

[00:44:07] Jenn Gile: Have a great week. Safe travels. We'll see everyone next week.

[00:44:11] Paul McCarty: Sounds good. See you guys. Thanks so much for listening.