[gdm/gnome-2-32] worker: CVE-2011-0727: change to user before copying user files
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/gnome-2-32] worker: CVE-2011-0727: change to user before copying user files
- Date: Mon, 28 Mar 2011 16:58:10 +0000 (UTC)
commit f2eb8e2b25844d6964129e0232e022995e27e11f
Author: Ray Strode <rstrode redhat com>
Date: Thu Mar 24 16:47:37 2011 -0400
worker: CVE-2011-0727: change to user before copying user files
This commit changes to a user before copying user files to prevent
a possible symlink local root exploit attack.
daemon/gdm-session-worker.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 281c554..441f833 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1031,17 +1031,6 @@ gdm_cache_copy_file (GdmSessionWorker *worker,
error->message);
g_error_free (error);
} else {
- int res;
-
- res = chown (cachefilename,
- worker->priv->uid,
- worker->priv->gid);
- if (res == -1) {
- g_warning ("GdmSessionWorker: Error setting owner of cache file: %s",
- g_strerror (errno));
- }
-
- g_chmod (cachefilename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
g_debug ("Copy successful");
}
@@ -1179,7 +1168,23 @@ gdm_session_worker_uninitialize_pam (GdmSessionWorker *worker,
return;
if (worker->priv->state >= GDM_SESSION_WORKER_STATE_SESSION_OPENED) {
- gdm_session_worker_cache_userfiles (worker);
+ pid_t pid;
+
+ pid = fork ();
+
+ if (pid == 0) {
+ if (setuid (worker->priv->uid) < 0) {
+ g_debug ("GdmSessionWorker: could not reset uid: %s", g_strerror (errno));
+ _exit (1);
+ }
+
+ gdm_session_worker_cache_userfiles (worker);
+ _exit (0);
+ }
+
+ if (pid > 0) {
+ gdm_wait_on_pid (pid);
+ }
pam_close_session (worker->priv->pam_handle, 0);
gdm_session_auditor_report_logout (worker->priv->auditor);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]