Skip to content

Review checklist when installing PKGBUILD from AUR?

Since we're always supposed to review the PKGBUILD when installing a package with an aur helper, what things do you typically look for when reviewing the PKGBUILD to make sure that it's not a security concern?

I typically look at the source line in the PKGBUILD and make sure it's pulling from the correct upstream source, then look at at the install file and focus on any shell commands (things like rm, cp, mv) to make sure that it's not doing anything crazy. I'm almost positive that I'm not doing a great job at this.

There doesn't seem to be an easy-to-find list of these checkout items anywhere...

49 points20 comments
Open on Reddit
About this post
Posted
Archived
Score
49 · 100% up
Kind
Text
ID
4jildf

Author

15
posts
807
comments
3
media
View profile

21 comments

I check the source line as well and sometimes scroll down to the prepare, build, and package if it's an obscure piece of software with little votes online. I should make a better habit of checking the install file, so you're better than me there.

I actually just started reviewing them in detail. I should have previously, but I suppose I didn't really know how. I recently started maintaining a few of my own packages which gave me a fantastic overview of what the PKGBUILD is actually doing and what it's supposed to do. I highly recommend creating your own package. It could be just a simple bash command that you created and you won't be submitting to the AUR, but it will be immensely helpful in learning how it all comes together.

I'm not sure if this will help, but running namcap on the produced package prior to installing might alert you to things that are out of place. I don't think it catches malicious things though and might only be useful if you're creating the package for submission to the AUR.

8 points

I should have previously, but I suppose I didn't really know how.

Yea this was the premise of my post here.. I suspect that many folks (I'm assuming myself included) don't know how, while they install packages from AUR frequently.

I'm really hoping that someone chimes in with decent PKGBUILD review methodology...

4 points

I read the last few comments for that package.

I keep track of the variables and make sure they're not swapped around in the script.

I check the url and visit it to see whats on the page. Maybe google the url to see what results pop up for it.

If the script is pulling from github I verify the repo url to make sure it's not pointing to a malicious repo under the same github account.

(e.g. https://github.com/user/application vs https://github.com/user/appllication)

How many stars and/or forks does the project have on github?

If the package isn't pulling from github, why not? Github is great and makes this whole process easier. Open source or gtfo.

Go through the program source and check around for similar weirdness.

I check the sha hashes and sometimes google those.

I check for ip addresses and urls that look out of place.

View package contents and check package with namcap

And then before I'm finished, I say forget it, I didn't really want to install this package anyways.

6 points

The install file is pretty important since that one actually runs as root. Thankfully pacman is moving to hooks so most packages do not need install files anymore.

5 points

I understand the security implications, but has anybody around here really encountered a stray rm -rf / in one of these before?

3 points

I'm not as concerned about someone deleting my data, more so stealing it.

Restoring from backups is easy. Recovering my bank account is a much larger pain.

2 points

Someone would of pointed it out in aur.archlinux.org

Edited for misspelling

1 points

I don't have any checks not mentioned in other comments. But serious question:

Has anyone actually found red flags in pkgbuilds? Malicious things? Been on arch for a couple years now and have yet to come across shady AUR packages. Then again, haven't installed many of the smaller, lesser-used ones.

1 points

On a related note, I highly recommend cower as the best AUR helper for pulling deps and updates while letting you handle all compilation and installation. If you're good with bash it's quite easy to automate the boring updates.

0 points

Since we're always supposed to review the PKGBUILD

Where did you read that? I don't usually do that.

edit I get it, stop downvoting me

-8 points

oh my

19 points

I'm pretty serious, what am I missing?

Edit: I'm having my first RTFW moment, I'm going to go check the PKGBUILDs on my system.

7 points

Warning: Carefully check all files. cd to the newly created directory and carefully check the PKGBUILD and any .install file for malicious commands. PKGBUILDs are bash scripts containing functions to be executed by makepkg: these functions can contain any valid commands or Bash syntax, so it is totally possible for a PKGBUILD to contain dangerous commands through malice or ignorance on the part of the author. Since makepkg uses fakeroot (and should never be run as root), there is some level of protection but you should never count on it. If in doubt, do not build the package and seek advice on the forums or mailing list.

https://wiki.archlinux.org/index.php/Arch_User_Repository#Build_and_install_the_package

9 points

I always read it. reading it in advance is benificial. some dependencies problem can be solve. and some dependency is not needed. for example I might have xxx-git yet the package require xxx, which most of the time shouldn't be a problem. and there are also linux and linux-xxx dependecies problem. just skim it and edit it to fit your system. just a five seconds check and sometimes save you several minutes.

2 points

Although you're meant to read them for security purposes, sometimes im just too tired or hungover to do so

2 points

So how do you know if you are downloading malware too your computer?

1 points

I just read the comments from aur.archlinux.org and install very little from AUR (chrome, caffeine-ng) and that's about it.

5 points
unknown author

Deleted before we saved it.

-1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.