Your message dated Tue, 12 May 2015 18:47:06 +0000
with message-id <[email protected]>
and subject line Bug#781608: fixed in caja 1.8.2-3+deb8u1
has caused the Debian Bug report #781608,
regarding MATE should disable automounting when screen is locked
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
781608: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781608
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: caja
Version: 1.8.2-3
Severity: normal
Tags: patch, security
User: [email protected]
Usertags: origin-ubuntu natty ubuntu-patch

To avoid auto-run drive-by attacks by a physically proximate attacker on
the system from USB auto-mounting screen is locked, the desktop should
delay automounting until the screen is unlocked (to not interfere with
the case of sitting back down at your system, plugging in a device,
and then unlocking your screen).

This is similar to how gnome-keyring flushes all keys the when locking
the screen.

http://www.net-security.org/secworld.php?id=10544

This was fixed in Gnome upstream and in Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/714958
https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/724285

The attached patch likely needs the dbus names changed to, e.g.,
"org.mate.ScreenSaver".

Thanks!

-Kees

-- 
Kees Cook                                            @debian.org
>From 98ebb6be0882ba2dbb0c621a2906e5190108bca1 Mon Sep 17 00:00:00 2001
From: Martin Pitt <[email protected]>
Date: Tue, 22 Feb 2011 14:06:14 +0100
Subject: [PATCH] disable automounting while screen is locked

On the recent Shmoocon there was a presentation by Jon Larimer demonstrating
how to abuse vulnerabilities and bugs, or even just creating socially or
security compromising thumbnails in mounting and thumbnailing, which happens o
automounting USB drives. This is a particular issue when this happens on a
locked box where the attacker doesn't otherwise have access to the user
account:

  http://www.net-security.org/secworld.php?id=10544

Disable automounting if the GNOME screen saver is currently locked.

Backported from gnome-settings-daemon trunk commits 71deedf7 and 90c0f8676.

https://bugzilla.gnome.org/show_bug.cgi?id=642020
---
 src/nautilus-application.c |  219 +++++++++++++++++++++++++++++++++++++++++++-
 src/nautilus-application.h |    5 +
 2 files changed, 223 insertions(+), 1 deletions(-)

Index: nautilus-2.32.2.1/src/nautilus-application.c
===================================================================
--- nautilus-2.32.2.1.orig/src/nautilus-application.c	2010-12-28 16:54:38.000000000 +0100
+++ nautilus-2.32.2.1/src/nautilus-application.c	2011-03-15 15:04:00.659603038 +0100
@@ -116,6 +116,9 @@
 static void     volume_added_callback              (GVolumeMonitor           *monitor,
 						    GVolume                  *volume,
 						    NautilusApplication      *application);
+static void     volume_removed_callback            (GVolumeMonitor           *monitor,
+						    GVolume                  *volume,
+						    NautilusApplication      *application);
 static void     drive_connected_callback           (GVolumeMonitor           *monitor,
 						    GDrive                   *drive,
 						    NautilusApplication      *application);
@@ -347,6 +350,15 @@
 
 	g_object_unref (application->unique_app);
 
+	if (application->ss_watch_id > 0) {
+		g_bus_unwatch_name (application->ss_watch_id);
+	}
+	
+	if (application->volume_queue != NULL) {
+		g_list_free_full (application->volume_queue, g_object_unref);
+		application->volume_queue = NULL;
+	}
+
 	if (application->automount_idle_id != 0) {
 		g_source_remove (application->automount_idle_id);
 		application->automount_idle_id = 0;
@@ -357,6 +369,11 @@
 		application->proxy = NULL;
 	}
 
+	if (application->ss_proxy != NULL) {
+		g_object_unref (application->ss_proxy);
+		application->ss_proxy = NULL;
+	}
+
         G_OBJECT_CLASS (nautilus_application_parent_class)->finalize (object);
 }
 
@@ -663,6 +680,175 @@
 }
 
 static void
+check_volume_queue (NautilusApplication *application)
+{
+        GList *l, *next;
+        GVolume *volume;
+
+        l = application->volume_queue;
+
+        if (application->screensaver_active) {
+                return;
+        }
+
+        while (l != NULL) {
+		volume = l->data;
+		next = l->next;
+
+		nautilus_file_operations_mount_volume (NULL, volume, TRUE);
+		application->volume_queue =
+			g_list_remove (application->volume_queue, volume);
+
+		g_object_unref (volume);
+		l = next;
+        }
+
+        application->volume_queue = NULL;
+}
+
+#define SCREENSAVER_NAME "org.gnome.ScreenSaver"
+#define SCREENSAVER_PATH "/org/gnome/ScreenSaver"
+#define SCREENSAVER_INTERFACE "org.gnome.ScreenSaver"
+
+static void
+screensaver_signal_callback (GDBusProxy *proxy,
+                             const gchar *sender_name,
+                             const gchar *signal_name,
+                             GVariant *parameters,
+                             gpointer user_data)
+{
+	NautilusApplication *application = user_data;
+
+	if (g_strcmp0 (signal_name, "ActiveChanged") == 0) {
+		g_variant_get (parameters, "(b)", &application->screensaver_active);
+		g_debug ("Screensaver active changed to %d", application->screensaver_active);
+
+		check_volume_queue (application);
+	}
+}
+
+static void
+screensaver_get_active_ready_cb (GObject *source,
+				 GAsyncResult *res,
+				 gpointer user_data)
+{
+	NautilusApplication *application = user_data;
+	GDBusProxy *proxy = application->ss_proxy;
+	GVariant *result;
+	GError *error = NULL;
+
+	result = g_dbus_proxy_call_finish (proxy,
+					   res,
+					   &error);
+
+	if (error != NULL) {
+		g_warning ("Can't call GetActive() on the ScreenSaver object: %s",
+			   error->message);
+		g_error_free (error);
+
+		return;
+	}
+
+	g_variant_get (result, "(b)", &application->screensaver_active);
+	g_variant_unref (result);
+
+	g_debug ("Screensaver GetActive() returned %d", application->screensaver_active);
+}
+
+static void
+screensaver_proxy_ready_cb (GObject *source,
+			    GAsyncResult *res,
+			    gpointer user_data)
+{
+	NautilusApplication *application = user_data;
+	GError *error = NULL;
+	GDBusProxy *ss_proxy;
+	
+	ss_proxy = g_dbus_proxy_new_finish (res, &error);
+
+	if (error != NULL) {
+		g_warning ("Can't get proxy for the ScreenSaver object: %s",
+			   error->message);
+		g_error_free (error);
+
+		return;
+	}
+
+	g_debug ("ScreenSaver proxy ready");
+
+	application->ss_proxy = ss_proxy;
+
+	g_signal_connect (ss_proxy, "g-signal",
+			  G_CALLBACK (screensaver_signal_callback), application);
+
+	g_dbus_proxy_call (ss_proxy,
+			   "GetActive",
+			   NULL,
+			   G_DBUS_CALL_FLAGS_NO_AUTO_START,
+			   -1,
+			   NULL,
+			   screensaver_get_active_ready_cb,
+			   application);
+}
+
+static void
+screensaver_appeared_callback (GDBusConnection *connection,
+			       const gchar *name,
+			       const gchar *name_owner,
+			       gpointer user_data)
+{
+	NautilusApplication *application = user_data;
+
+	g_debug ("ScreenSaver name appeared");
+
+	application->screensaver_active = FALSE;
+
+	g_dbus_proxy_new (connection,
+			  G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+			  NULL,
+			  name,
+			  SCREENSAVER_PATH,
+			  SCREENSAVER_INTERFACE,
+			  NULL,
+			  screensaver_proxy_ready_cb,
+			  application);
+}
+
+static void
+screensaver_vanished_callback (GDBusConnection *connection,
+			       const gchar *name,
+			       gpointer user_data)
+{
+	NautilusApplication *application = user_data;
+
+	g_debug ("ScreenSaver name vanished");
+
+	application->screensaver_active = FALSE;
+	g_object_unref (&application->ss_proxy);
+
+	/* in this case force a clear of the volume queue, without
+	 * mounting them.
+	 */
+	if (application->volume_queue != NULL) {
+		g_list_free_full (application->volume_queue, g_object_unref);
+		application->volume_queue = NULL;
+	}
+}
+
+static void
+do_initialize_screensaver (NautilusApplication *application)
+{
+	application->ss_watch_id =
+		g_bus_watch_name (G_BUS_TYPE_SESSION,
+				  SCREENSAVER_NAME,
+				  G_BUS_NAME_WATCHER_FLAGS_NONE,
+				  screensaver_appeared_callback,
+				  screensaver_vanished_callback,
+				  application,
+				  NULL);
+}
+
+static void
 do_upgrades_once (NautilusApplication *application,
 		  gboolean no_desktop)
 {
@@ -709,6 +895,10 @@
 	/* Initialize the ConsoleKit listener for active session */
 	do_initialize_consolekit (application);
 
+	/* Initialize GNOME screen saver listener to control automount
+	 * permission */
+	do_initialize_screensaver (application);
+
 	/* Watch for mounts so we can restore open windows This used
 	 * to be for showing new window on mount, but is not used
 	 * anymore */
@@ -724,6 +914,8 @@
 				 G_CALLBACK (mount_added_callback), application, 0);
 	g_signal_connect_object (application->volume_monitor, "volume_added",
 				 G_CALLBACK (volume_added_callback), application, 0);
+	g_signal_connect_object (application->volume_monitor, "volume_removed",
+				 G_CALLBACK (volume_removed_callback), application, 0);
 	g_signal_connect_object (application->volume_monitor, "drive_connected",
 				 G_CALLBACK (drive_connected_callback), application, 0);
 
@@ -1520,6 +1712,33 @@
 }
 
 static void
+check_screen_lock_and_mount (NautilusApplication *application,
+                             GVolume *volume)
+{
+        if (application->screensaver_active) {
+                /* queue the volume, to mount it after the screensaver state changed */
+                g_debug ("Queuing volume %p", volume);
+                application->volume_queue = g_list_prepend (application->volume_queue,
+                                                              g_object_ref (volume));
+        } else {
+                /* mount it immediately */
+		nautilus_file_operations_mount_volume (NULL, volume, TRUE);
+        }       
+}
+
+static void
+volume_removed_callback (GVolumeMonitor *monitor,
+                         GVolume *volume,
+                         NautilusApplication *application)
+{
+        g_debug ("Volume %p removed, removing from the queue", volume);
+
+        /* clear it from the queue, if present */
+        application->volume_queue =
+                g_list_remove (application->volume_queue, volume);
+}
+
+static void
 volume_added_callback (GVolumeMonitor *monitor,
 		       GVolume *volume,
 		       NautilusApplication *application)
@@ -1527,7 +1746,7 @@
 	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MEDIA_AUTOMOUNT) &&
 	    g_volume_should_automount (volume) &&
 	    g_volume_can_mount (volume)) {
-		nautilus_file_operations_mount_volume (NULL, volume, TRUE);
+		check_screen_lock_and_mount (application, volume);
 	} else {
 		/* Allow nautilus_autorun() to run. When the mount is later
 		 * added programmatically (i.e. for a blank CD),
Index: nautilus-2.32.2.1/src/nautilus-application.h
===================================================================
--- nautilus-2.32.2.1.orig/src/nautilus-application.h	2010-12-28 16:54:38.000000000 +0100
+++ nautilus-2.32.2.1/src/nautilus-application.h	2011-03-15 15:03:21.099603020 +0100
@@ -68,6 +68,11 @@
 	unsigned int automount_idle_id;
 	GDBusProxy *proxy;
 	gboolean session_is_active;
+
+	gboolean screensaver_active;
+	guint ss_watch_id;
+	GDBusProxy *ss_proxy;
+	GList *volume_queue;
 } NautilusApplication;
 
 typedef struct {

--- End Message ---
--- Begin Message ---
Source: caja
Source-Version: 1.8.2-3+deb8u1

We believe that the bug you reported is fixed in the latest version of
caja, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Mike Gabriel <[email protected]> (supplier of updated caja package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Mon, 11 May 2015 09:28:03 +0200
Source: caja
Binary: caja caja-common libcaja-extension1 libcaja-extension-dev gir1.2-caja 
caja-dbg libcaja-extension1-dbg
Architecture: source amd64 all
Version: 1.8.2-3+deb8u1
Distribution: jessie-proposed-updates
Urgency: medium
Maintainer: MATE Packaging Team <[email protected]>
Changed-By: Mike Gabriel <[email protected]>
Description:
 caja       - file manager for the MATE desktop
 caja-common - file manager for the MATE desktop (common files)
 caja-dbg   - file manager for the MATE desktop (debugging symbols)
 gir1.2-caja - GObject introspection data for the caja library
 libcaja-extension-dev - libraries for caja components (development files)
 libcaja-extension1 - libraries for caja components
 libcaja-extension1-dbg - libraries for caja components (debugging symbols)
Closes: 781608
Changes:
 caja (1.8.2-3+deb8u1) jessie-proposed-updates; urgency=medium
 .
   * debian/patches:
     + Add 0004_avoid-automounts-while-screen-is-locked.patch. Don't mount
       newly added USB flash drives / optical disks / etc. while a session
       is locked by the screensaver. Delay the automounting action until the
       session has been unlocked again. (Closes: #781608).
Checksums-Sha1:
 ff8da2b37b6853167da625da70d9e12807e636f4 2897 caja_1.8.2-3+deb8u1.dsc
 64caba25e01a4b2687d4f0c02a2ad28ba1830b15 12192 
caja_1.8.2-3+deb8u1.debian.tar.xz
 8bba5d6cfd0fa8969ed6381bb2e3a5d7088c0dcc 1252330 caja_1.8.2-3+deb8u1_amd64.deb
 2d10ed9a26953950d54705a27cd1094832f22b70 1799588 
caja-common_1.8.2-3+deb8u1_all.deb
 7083338629a2ff70ad720e1a15f776c9007f64b0 18304 
libcaja-extension1_1.8.2-3+deb8u1_amd64.deb
 5b46b286ba0128f8a3a956df8249f13ee55a4d45 12060 
libcaja-extension-dev_1.8.2-3+deb8u1_amd64.deb
 91a0768f03282a8fe6718cbf5004fecdabd2ac8d 13588 
gir1.2-caja_1.8.2-3+deb8u1_amd64.deb
 05aec57c9119eb48c037fc22f36f07752162101b 4027782 
caja-dbg_1.8.2-3+deb8u1_amd64.deb
 bc3efb71d2f95e9417dcaccce6333d0766c5e845 49150 
libcaja-extension1-dbg_1.8.2-3+deb8u1_amd64.deb
Checksums-Sha256:
 18494b62f7b14c1f39c705c876fc0c09c782307c66f4eaeebc5d13007ee3261a 2897 
caja_1.8.2-3+deb8u1.dsc
 b5616f2d5abf3251a3f02886920f9eee9bb48e54a28a5934a52c8a67cf53a623 12192 
caja_1.8.2-3+deb8u1.debian.tar.xz
 fa3a1b40d5b716ec964ef703cf0a7d6ce2832205c86f57fc5e5a0554638c7dc7 1252330 
caja_1.8.2-3+deb8u1_amd64.deb
 57b61249f5500ec8679bc2e72e661765612897ce120322845ffdd42ac3a9b44d 1799588 
caja-common_1.8.2-3+deb8u1_all.deb
 6d38874f164b59f3bf0cd9a6b02b62c501ae5ec4cae6422802d8b81921ba8779 18304 
libcaja-extension1_1.8.2-3+deb8u1_amd64.deb
 e9eabb19266dc241f6c2e39a26070ecfc7d258dec9c9f9137b8719f6f5835605 12060 
libcaja-extension-dev_1.8.2-3+deb8u1_amd64.deb
 86dd04d250d18f02a8adeb1a639ad282cb55d38b1a2c2b480dff68339f3b8d3a 13588 
gir1.2-caja_1.8.2-3+deb8u1_amd64.deb
 5d8a590aef5f251ec81cd539fe1d1f5c24d8ef667f709c54a9ea161a9504c536 4027782 
caja-dbg_1.8.2-3+deb8u1_amd64.deb
 c11e0dec387fd4dbb64c27517cd78e915cc2b9a7c2a0f7e3819fa4584190b754 49150 
libcaja-extension1-dbg_1.8.2-3+deb8u1_amd64.deb
Files:
 bd362de8b1d8ebb3bad01749b552839d 2897 utils optional caja_1.8.2-3+deb8u1.dsc
 51e30ad8aa71d57fdc6c64ecb9bdb659 12192 utils optional 
caja_1.8.2-3+deb8u1.debian.tar.xz
 b2fab69ee80c5f5abb574e75fc1ad547 1252330 utils optional 
caja_1.8.2-3+deb8u1_amd64.deb
 266ad7e42fa8f04453f9b817aef69a60 1799588 utils optional 
caja-common_1.8.2-3+deb8u1_all.deb
 ab108eb7538a87dc25b81b33f7481636 18304 libs optional 
libcaja-extension1_1.8.2-3+deb8u1_amd64.deb
 186f5ccb48ce33c8f5a1e0cc8b15b924 12060 libdevel optional 
libcaja-extension-dev_1.8.2-3+deb8u1_amd64.deb
 eaeb0f796284de51f3aa02743ffd074f 13588 utils optional 
gir1.2-caja_1.8.2-3+deb8u1_amd64.deb
 96e136467a1d23baa27c74c9bb6832a7 4027782 debug extra 
caja-dbg_1.8.2-3+deb8u1_amd64.deb
 064cd3c542312672b5b884d60f0681cd 49150 debug extra 
libcaja-extension1-dbg_1.8.2-3+deb8u1_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVUIZJAAoJEJr0azAldxsxu+QP/A9gTmBS65ZExEFpLdMyZ+lq
pOVjhpzRm9d2/l/IgfYcM9I4Z2hGsnON5jMWFOljmLGHWJR4fiY7B50CbZxDb6gg
t6+uWQJjQDWrlHnvV+yZeQWQLjjVaZwhdstoOqegz0uer2xloRv9WjHB37zIfI9M
F1tfUIHRqYiWBuyJMIkDcxYuHbwACcBIWQnlTLAF5HBRSCVGOR7KMlRB5APF2Kox
Z3gmJAuQFzkHNKrES9V093Cx1+GVRHRKL8ofXSmJBMQG/6cdECdIj5SC/8vYnWth
BMXu1vE7K1F3zWYyjcuol4/WqcxUGz7Xbz0/v3cl/jVMkxA3aas09vFhxqpAw8lG
OJh0rvrC6tQ4c4VodBBflfp3BIBF8TcV3UhdyCeWtTvu2YYHGv3pyBltmdPXvpMN
Jm4JNkMA0K2NBJx4fbIn9VIiykx2N4cLcezlyVrvgufxzQictoMwpvMtDVvJoP4z
+ye3y0g8t6lPIxTFqoMe3iKSrZk1Ud7jhkDQBZg28+0wVi3DI1e0yQWu11WpLne1
nKALooN1PN6/qjL2DZHQvgbk2hijp7g+i9hgsfQucwNX1wXH8HWnk6yoA1127mFU
eUkL4ui/DTjOH0SUshWg8vPit8QyZqCGYKcwg8y8w+AH3ylNWvBzMe30EGDXXqOW
9sXdNGMiFvP/UHQodxbJ
=LR3L
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to