summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Hicks <tyhicks@canonical.com>2017-04-05 09:24:12 +1200
committerRobert Ancell <robert.ancell@canonical.com>2017-04-05 09:24:12 +1200
commitd55a0f081f153825d59de713e3d64fda85d181f8 (patch)
treed012d1623bc6037ba7312b94d550154e386d9c33
parent006f628bb09901ea24893f77af78552a36e63b16 (diff)
downloadlightdm-git-d55a0f081f153825d59de713e3d64fda85d181f8.tar.gz
Detect existing malicious guest user home dirs
It was discovered that a local attacker could watch for lightdm's guest-account script to create a /tmp/guest-XXXXXX file and then quickly create the lowercase representation of the guest user's home directory before lightdm could. This allowed the attacker to have control of the guest user's home directory and, subsequently, gain control of an arbitrary directory in the filesystem which could lead to privilege escalation. This patch fixes the issue by detecting failures in creating a directory for the guest user's home directory. If the file (directory, symlink, etc.) already exists at the path, mkdir will fail and the script will exit. This means that it is still possible for a local user to carry out a denial of service on the guest user login feature.
-rw-r--r--debian/guest-account.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/debian/guest-account.sh b/debian/guest-account.sh
index 48bbde69..f618390b 100644
--- a/debian/guest-account.sh
+++ b/debian/guest-account.sh
@@ -35,7 +35,13 @@ add_account ()
temp_home=$(mktemp -td guest-XXXXXX)
GUEST_HOME=$(echo ${temp_home} | tr '[:upper:]' '[:lower:]')
GUEST_USER=${GUEST_HOME#/tmp/}
- [ ${GUEST_HOME} != ${temp_home} ] && mv ${temp_home} ${GUEST_HOME}
+ if [ "${GUEST_HOME}" != "${temp_home}" ]; then
+ mkdir "${GUEST_HOME}" || {
+ echo "Failed to create ${GUEST_USER}'s home directory (${GUEST_HOME})"
+ exit 1
+ }
+ rmdir "${temp_home}"
+ fi
# if ${GUEST_USER} already exists, it must be a locked system account with no existing
# home directory