How to Check & Remove Malicious AUR yay/paru Packages
If you installed or updated yay or paru from the Arch User Repository (AUR) recently, you may be running malware with full root privileges. A threat actor uploaded malicious packages impersonating these two popular AUR helper tools, and because AUR packages build and install with your user’s sudo rights, the payload executes as root. This guide shows you exactly how to detect the compromise, remove it, and harden your system against future AUR supply-chain attacks.
The attack worked by publishing typosquatted or hijacked package names that mimicked yay and paru. When a user ran makepkg -si or a helper like yay -S yay, the malicious PKGBUILD executed a post_install or prepare() hook that fetched a remote script and ran it as root. Because AUR is community-maintained and unvetted, nothing blocked it.
Step-by-Step: Detect and Remove the Malware
Step 1 — Check What You Actually Installed
First, confirm the origin of your helper. Legitimate yay and paru are normally installed from source you reviewed, or from the official extra repo (paru is now in extra).
# List installed packages matching the helpers
pacman -Qs yay paru
# Check the install date and version
pacman -Qi yay
pacman -Qi paru
Look at the Install Date and Packager fields. If yay or paru was installed from AUR recently and you did not intentionally build it, treat it as suspect.
Step 2 — Inspect the Build Cache and PKGBUILD
AUR helpers cache build files. Review them for suspicious hooks.
# yay cache
ls -la ~/.cache/yay/yay/
cat ~/.cache/yay/yay/PKGBUILD
# paru cache
ls -la ~/.cache/paru/clone/paru/
cat ~/.cache/paru/clone/paru/PKGBUILD
Red flags in a PKGBUILD:
curl ... | bashorwget ... | shinprepare(),build(), orpackage()- Base64-encoded blobs or obfuscated variables
post_install()orpost_upgrade()running network calls- URLs pointing to pastebins, raw GitHub gists, or unknown domains
Step 3 — Hunt for Persistence and Root Payloads
Malware installed as root typically drops persistence. Check these locations:
# Suspicious systemd units
systemctl list-units --type=service --state=running | grep -iE 'yay|paru|update|helper'
# Recently modified system files
find /etc /usr/local /opt -mtime -7 -type f 2>/dev/null
# Crontabs and timers
crontab -l
ls -la /etc/cron.*
systemctl list-timers --all
# Outbound connections
ss -tupn
Also inspect /etc/pacman.d/hooks/ for unexpected hooks that run after installs.
Step 4 — Remove the Malicious Package
# Remove via pacman if tracked
sudo pacman -Rns yay paru
# If not tracked, remove manually
sudo rm -rf /usr/bin/yay /usr/bin/paru
sudo rm -rf ~/.cache/yay ~/.cache/paru
Then delete any persistence you found: sudo systemctl disable --now <unit>, remove cron entries, and delete dropped files in /usr/local/bin or /opt.
Step 5 — Rotate Credentials
Because the payload ran as root, assume full compromise. Rotate:
- SSH keys (
~/.ssh/) - GPG keys
- Browser-stored passwords
- Any API tokens or cloud credentials on the machine
If this was a production or work machine, the safest path is a full reinstall from a trusted ISO.
Prevention: Safer AUR Habits
- Always read the PKGBUILD before building. Use
yay -S --editmenuorparu --review. - Prefer official repos.
paruis available inextra; install it withsudo pacman -S paru. - Diff updates. Tools like
aurutilsand manualgit diffon the AUR repo catch injected changes. - Use a build user. Never build AUR packages as your daily user with broad sudo rights.
- Enable
pacmanhook auditing and monitor/var/log/pacman.logfor unexpected installs.
| Risk Factor | Safe Practice |
|---|---|
Blind yay -S |
Review PKGBUILD first |
| Root build | Build as unprivileged user |
| No diff | git diff before update |
| Trusting names | Verify upstream repo URL |
Frequently Asked Questions (FAQ)
How do I know if my yay or paru is the fake AUR version?
Check pacman -Qi yay for the Packager and install source. If it came from AUR and you did not review the PKGBUILD, inspect ~/.cache/yay/yay/PKGBUILD for curl | bash patterns. Official paru now ships in the extra repo, so an AUR-sourced paru is immediately suspicious.
Can the AUR malware run without sudo?
The payload needs root to persist system-wide, but it triggers during makepkg -si when you enter your sudo password. That single approval is enough for it to install root-level persistence, which is why reviewing the PKGBUILD before building is critical.
Is the Arch User Repository safe to use at all?
AUR is community-vetted, not officially audited. It is safe if you treat every PKGBUILD as untrusted code and review it. Never build AUR packages blindly, and prefer official repos when a package exists there.
Final Verdict
Treat any recent AUR install of yay or paru as compromised until proven otherwise. Run the detection steps above immediately, remove suspicious packages, rotate every credential that touched the machine, and if you cannot fully verify cleanliness, reinstall from a trusted Arch ISO. Going forward, install paru from extra, review every PKGBUILD, and never pipe remote scripts into a root shell. AUR is powerful, but it is only as safe as your review habits.