How to Review an AUR Package
This technical deep dive unpacks how to scrutinize Arch Linux AUR packages, a critical skill after recent malware incidents. It meticulously explains PKGBUILD scripts, their metadata, and build functions, guiding users to identify potential malicious code. The story is popular on HN because it addresses a fundamental security concern within a widely used, community-driven Linux ecosystem.
The Lowdown
Following a recent malware incident involving three Arch User Repository (AUR) packages, the author, Bert Peters, provides a comprehensive guide on how to manually review AUR PKGBUILD scripts. This article aims to educate users on the structure of these scripts and what red flags to look for to ensure system security.
The AUR is a collection of user-contributed packaging scripts, not pre-compiled binaries, allowing anyone to upload PKGBUILD files. While AUR helpers streamline installation, the inherent trust model means users must vet packages themselves.
PKGBUILDStructure: These are bash scripts containing metadata (likepkgname,pkgver,source,sha256sums) and build functions (prepare(),build(),check(),package()). Metadata provides package details, while functions define the build process from source preparation to final installation.- Reviewing Sources: Emphasizes checking the
sourcearray to ensure upstream projects are trusted and downloads originate from official, secure locations, ideally with PGP signatures. Patches should also be carefully examined for hidden malicious code. - Scrutinizing Build Steps: Advises vigilance in the
prepare(),build(),check(), andpackage()functions. Key warnings include avoiding downloads outside of specific ecosystem needs, questioning unusual or custom scripts not from upstream, and rejecting anyPKGBUILDthat attempts to runsudo. - Special Attention to
installscripts and Pacman Hooks: These components run with root privileges.installscripts, though rare, require intense scrutiny. Similarly, anyPKGBUILDadding custom Pacman hooks should be viewed with suspicion, as they can execute arbitrary commands on trigger. - User Responsibility: Stresses the importance of not using packages one doesn't fully understand, acknowledging that the AUR is volunteer-maintained and mistakes or malicious intent can occur.
- Reporting Malicious Activity: Guides users to official Arch Linux channels like IRC, forums, or mailing lists to report suspicious packages, where maintainers can take action.
Ultimately, the article highlights the AUR's reliance on trust and its archaic design, which was not built for today's hostile internet. While recognizing the need for improvements like a pull-request system, it reiterates that for now, diligent user review remains the cornerstone of security within the Arch Linux ecosystem.