Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Fix security issues in pre-install script
Browse files Browse the repository at this point in the history
- Having $HOME in /tmp means everyone can create e.g. a .bashrc in your home dir
- "chown -R" on the logdir is problematic when an attacker takes over alppaca
  and places hardlinks to files that alppaca should not be able to access in
  that directory. The next time the pre-install script runs, it would chown
  the hardlinked file to alppaca.
- Having /etc/alppaca writable for alppaca itself means that an attacker that
  takes over alppaca can re-configure alppaca to run as root and then take
  over the privileged alppaca process.
  • Loading branch information
Stefan Nordhausen committed Jan 22, 2016
1 parent ef50b77 commit 3468846
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ confdir=/etc/alppaca

# add service user and group
groupadd $user 2> /dev/null || :
useradd -c "Alppaca - a local prefetch proxy for amazon credentials" -s /sbin/nologin -r -d /tmp -g $user $user 2> /dev/null || :
useradd -c "Alppaca - a local prefetch proxy for amazon credentials" -s /sbin/nologin -r -d / -g $user $user 2> /dev/null || :

# Add log directory
if [ ! -d $logdir ]; then
mkdir -p $logdir
fi

# change ownership of directory to $user
chown -R $user: $logdir
chown $user: $logdir

# Add the conf directory
if [ ! -d $confdir ]; then
mkdir -p $confdir
fi

# change ownership of directory to $user
chown -R $user: $confdir

0 comments on commit 3468846

Please sign in to comment.