AUR compromise: several hundred packages altered to install malware

It appears that someone(s) has submitted numerous malicious updates to various AUR packages (400+ was the last I saw). The main change is adding npm as a dependency and then installing a package from there, but they also alter the maintainer’s e-mail address without changing the underlying name. There are also some more recent commits using a different dependency.

The earliest reference to this I saw on the Arch mailing list is from May 30. The main reporting thread has a list of the packages known to have been compromised, although it’s not clear which of these have been rolled back.

6 Likes

Arch list on topic

Looks like someone has made a bash script to see if your machine actually got any of the infected packages.

curl -sL https://gist.githubusercontent.com/Kidev/59bf9f5fb53ab5eee99f19a6a2fc3992/raw/c89cff0e68d9b219e868010bfd6d125ef4762028/aur_check.sh | bash

read-only script, its up to 446 total infected packages now.

1 Like

Consensus is, read you PKGBUILDs and know the package update schedule. Lot’s of checkers in the HN link

hm, so this is new, looks like a supply chain attack on the actual AUR infrastructure and not just someone that scammed/compromised a single package developer like in the past

there sure are a lot of people claiming people don’t read PKGBUILDs on updates

I know my coworker doesn’t, but come on. The few lines diff literally gets shown to me every update for whatever third-party package happens to have an update.

plenty of those armchair comments are making me murderous tbh…par for the course I guess.

1 Like

I also wonder how many people seem to think reading PKGBUILDs is some kind of cure to the underlying issue, wouldn’t it be trivial to just hide the exploit in a .patch file, or use some other kind of obfuscation? Just enough to pass the scrutiny of 90% of the users who even check the diffs? But I guess an attack of this scale will be found out anyhow, so presumably the goal is to get in enough of systems early on.

1 Like

Reading PKGBUILDs is necessary, but I agree it is not enough once the payload can be hidden in generated files, patches, or a fetched dependency. For AUR packages I care about, the practical baseline is: diff every update, avoid auto-updating AUR blindly, prefer upstream/source builds over npm/curl blobs, and keep a short list of AUR packages installed so you can audit them after events like this. Also worth checking shell history/package cache for anything upgraded in the affected date range.

It’s like saying “people should be more careful” after a bunch of people get crushed in an industrial accident.
Technically true, but not useful because it ignores human behavior (i.e. predictable failings) and the limits we have on our time, energy, and technical capability. It’s nothing more than self-satisfied contempt.

The actual fix is to look at what went wrong, and implement a safety system that is difficult to bypass.

It’ll be interesting to see what else we are blindly trusting that has no security speed bumps at all.

11 Likes

Just in case, but I meant PKGBUILD in the most simplistic case.

If someone drops in a .patch file, that’s still going to show up in the git diff when you pull the updated package, and a reasonable AUR helper should show that diff to you as well (paru definitely does for me). In this particular attack, it wasn’t the PKGBUILD that had the fishy npm call. See for example, Malicious activity on plex-media-player pkgbuilds - Aur-general - lists.archlinux.org —this is exactly the output paru would’ve asked me to approve before updating: a few additional lines that clearly look suspicious.

Of course, an attacker could try to obfuscate, but that attempt is still going to show up in the diff. As far as I’m concerned, the user who decides to use a user-submitted build definition from the AUR (as opposed to using an Arch-maintained package, or building it/writing that definition yourself) is responsible for reading and understanding that definition up until the actual upstream source code repository (because that’s the thing we typically inherently trust, even though it could also be compromised, but at that point it becomes the developer’s responsibility).

The AUR is largely meant for niches. It’s like what deviantart can be for Windows themes and icons. There are a lot of folks who seem to think there should be considerable safeguards added, but to me it doesn’t make sense for Arch to be introducing more friction for user submissions. (I would probably agree that package adoption should probably be treated with more care, though.)

No, it’s not (but I understand where you’re coming from and that is generally the sentiment I have with most things), because every time you use the AUR you are basically running curl $URL | bash. And people do that all the time. Is curl and/or bash somehow responsible for implementing a safety system that’s difficult to bypass?

Those are just tools. The websites/services saying to run such commands are the ones responsible for the curation/security involved.

Just like how NPM is just a tool, but the service behind it is starting to make changes to address some obvious and predictable failings.

1 Like

Even if, an ASN gets hijacked and ends up rerouting requests for said site? The internet is fragile. The only surefire way to ensure you’re getting what you want is to fetch, review (even if you leave it to other tooling), and execute.

There is no proper package manager for the AUR. You use git to clone the repo, and you use makepkg to build it. The thought did pass through my head that an AUR helper could maybe use some tooling to scan for issues but it would be unlikely that every single helper would fall in line.

Now marked outdated:

OUTDATED. YOU MAY WANT TO USE A CHECK THAT PULLS FROM AN AUTHORITATIVE LIST OF INFECTED PACKAGES

CHECK Check if any infected package is installed using Arch authoritative list · GitHub

New one pulls from official

# Pulls the live package list from the official Arch Linux HedgeDoc note.
LIST_URL="https://md.archlinux.org/s/SxbqukK6IA"

Be sure also to check the comments for ongoing developments.

Ran the first one yesterday and it only looked for 446 packages.

Checking for infected AUR packages (446 total)...

Clean: none of the known infected packages are installed.

Now up to 1739 (at the time of writing) with the authoritative list:

Fetching infected package list...
Checking 1739 known infected packages...

Clean: none of the known infected packages are installed.

So far I seem to have dodged them, but will be checking periodically as new packages are discovered.

1 Like

Admittedly, I do not read every single line of code in every single piece of software on my system. For I am merely human.

4 Likes

A writeup:

2 Likes

To understand how this happened, you need to know one specific thing about how the AUR works: anyone can adopt an orphaned package. When a maintainer abandons a project, the package gets marked unmaintained and becomes fair game. Any AUR account can submit a change to the PKGBUILD and associated install scripts. There’s no review gating, no vouching system, no delay period.

This sounds like madness, what is the logic behind that system?

it’s a user repository, it’s github but linked to a package manager*

Adjusted to be more broad. yay is correct, my mind was just thinking shorthand

I don’t think pacman talks to the aur? only the official packages.

yay and paru talk to the aur.

1 Like