Your message dated Sun, 06 Oct 2013 19:02:04 +0000
with message-id <[email protected]>
and subject line Bug#723034: fixed in davfs2 1.4.6-1.1+deb7u1
has caused the Debian Bug report #723034,
regarding davfs2: CVE-2013-4362: Unsecure use of system()
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.)


-- 
723034: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=723034
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: davfs2
Version: 1.4.6-1.1
Severity: critical
Tags: patch, security, upstream

davfs2 calls function system several times. Because davfs2 is setuid
root in many cases this will allow for privilege escalation.

Appended are patches for version 1.4.6 and 1.4.7 that will fix this bug.

Note: as a consequence davfs2 will no longer try to insert required
kernel modules or create device special files /dev/fuse or /dev/codaX.
So the user has to make sure that one of these devices exists before
mounting a davfs2 file system. As far as I can see /dev/fuse is created
by default on Debian systems. davfs2 uses /dev/fuse by default (and
not /dev/codaX). So this bug fix should not cause any problem on Debian
systems.

Werner (upstream maintainer)
diff -ur davfs2-1.4.6/ChangeLog davfs2-1.4.6.new/ChangeLog
--- davfs2-1.4.6/ChangeLog	2010-04-30 21:17:15.000000000 +0200
+++ davfs2-1.4.6.new/ChangeLog	2013-09-15 11:05:42.000000000 +0200
@@ -1,6 +1,11 @@
 ChangeLog for davfs2
 --------------------
 
+2013-09-08 Werner Baumann ([email protected])
+    * kernel_interface.c, mount_davfs.c:
+      Don't create /dev/coda and /dev/fuse.
+      Remove insecure calls of system().
+
 2010-04-30 Werner Baumann ([email protected])
     * Released version 1.4.6
 
Nur in davfs2-1.4.6.new: ChangeLog~.
diff -ur davfs2-1.4.6/src/kernel_interface.c davfs2-1.4.6.new/src/kernel_interface.c
--- davfs2-1.4.6/src/kernel_interface.c	2010-02-16 20:29:54.000000000 +0100
+++ davfs2-1.4.6.new/src/kernel_interface.c	2013-09-15 11:07:07.000000000 +0200
@@ -168,27 +168,6 @@
     }
 
     if (*dev <= 0) {
-        system("/sbin/modprobe coda &>/dev/null");
-        minor = 0;
-        while (*dev <= 0 && minor < MAX_CODADEVS) {
-            char *path;
-            if (asprintf(&path, "%s/%s%i",
-                         DAV_DEV_DIR, CODA_DEV_NAME, minor) < 0)
-                abort();
-            *dev = open(path, O_RDWR | O_NONBLOCK);
-            if (*dev <= 0) {
-                if (mknod(path, S_IFCHR, makedev(CODA_MAJOR, minor)) == 0) {
-                    chown(path, 0, 0);
-                    chmod(path, S_IRUSR | S_IWUSR);
-                    *dev = open(path, O_RDWR | O_NONBLOCK);
-                }
-            }
-            free(path);
-            ++minor;
-        }
-    }
-
-    if (*dev <= 0) {
         error(0, 0, _("no free coda device to mount"));
         return -1;
     }
@@ -223,24 +202,6 @@
             abort();
 
     *dev = open(path, O_RDWR | O_NONBLOCK);
-    if (*dev <= 0) {
-        system("/sbin/modprobe fuse &>/dev/null");
-        *dev = open(path, O_RDWR | O_NONBLOCK);
-    }
-    if (*dev <= 0) {
-        if (mknod(path, S_IFCHR, makedev(FUSE_MAJOR, FUSE_MINOR)) == 0) {
-            chown(path, 0, 0);
-            chmod(path, S_IRUSR | S_IWUSR);
-            *dev = open(path, O_RDWR | O_NONBLOCK);
-        }
-    }
-
-    free(path);
-    if (*dev <= 0) {
-        error(0, 0, _("can't open fuse device"));
-        return -1;
-    }
-
     if (*buf_size < (FUSE_MIN_READ_BUFFER + 4096)) {
         *buf_size = FUSE_MIN_READ_BUFFER + 4096;
     }
Nur in davfs2-1.4.6.new/src: kernel_interface.c~.
diff -ur davfs2-1.4.6/src/mount_davfs.c davfs2-1.4.6.new/src/mount_davfs.c
--- davfs2-1.4.6/src/mount_davfs.c	2010-01-21 19:50:15.000000000 +0100
+++ davfs2-1.4.6.new/src/mount_davfs.c	2013-09-15 11:13:18.000000000 +0200
@@ -170,6 +170,9 @@
 static int
 arg_to_int(const char *arg, int base, const char *opt);
 
+static void
+cp_file(const char *src, const char *dest);
+
 static int
 debug_opts(const char *s);
 
@@ -533,10 +536,7 @@
             char *file_name = ne_concat(path, "/", DAV_CONFIG, NULL);
             if (access(file_name, F_OK) != 0) {
                 char *template = ne_concat(DAV_DATA_DIR, "/", DAV_CONFIG, NULL);
-                char *command = ne_concat("cp ", template, " ", file_name,
-                                          NULL);
-                system(command);
-                free(command);
+                cp_file(template, file_name);
                 free(template);
             }
             free(file_name);
@@ -545,11 +545,7 @@
             if (access(file_name, F_OK) != 0) {
                 char *template = ne_concat(DAV_DATA_DIR, "/", DAV_SECRETS,
                                            NULL);
-                char *command = ne_concat("cp ", template, " ", file_name,
-                                          NULL);
-                if (system(command) == 0)
-                    chmod(file_name, S_IRUSR | S_IWUSR);
-                free(command);
+                cp_file(template, file_name);
                 free(template);
             }
             free(file_name);
@@ -1333,6 +1329,34 @@
 }
 
 
+/* Creates a copy of src with name dest. */
+static void
+cp_file(const char *src, const char *dest)
+{
+    FILE *in = fopen(src, "r");
+    if (!in)
+        error(EXIT_FAILURE, errno, _("can't open file %s"), src);
+
+    FILE *out = fopen(dest, "w");
+    if (!out)
+        error(EXIT_FAILURE, errno, _("can't open file %s"), dest);
+
+    size_t n = 0;
+    char *line = NULL;
+    int length = getline(&line, &n, in);
+    while (length > 0) {
+        if (fputs(line, out) == EOF) 
+            error(EXIT_FAILURE, errno, _("error writing to file %s"), dest);
+        length = getline(&line, &n, in);
+    }
+
+    if (line)
+        free(line);
+    fclose(out);
+    fclose(in);
+}
+
+
 /* Converts a debug option string s into numerical value. If s is not a
    valid debug option, it returns 0. */
 static int
Nur in davfs2-1.4.6.new/src: mount_davfs.c~.
diff -ur davfs2-1.4.7/ChangeLog davfs2-1.4.7.new/ChangeLog
--- davfs2-1.4.7/ChangeLog	2012-07-19 13:37:52.000000000 +0200
+++ davfs2-1.4.7.new/ChangeLog	2013-09-15 10:19:12.000000000 +0200
@@ -1,6 +1,11 @@
 ChangeLog for davfs2
 --------------------
 
+2013-09-08 Werner Baumann ([email protected])
+    * kernel_interface.c, mount_davfs.c:
+      Don't create /dev/coda and /dev/fuse.
+      Remove insecure calls of system().
+
 2012-07-19 Werner Baumann ([email protected])
     * Release version 1.4.7.
 
diff -ur davfs2-1.4.7/src/kernel_interface.c davfs2-1.4.7.new/src/kernel_interface.c
--- davfs2-1.4.7/src/kernel_interface.c	2012-07-19 12:58:48.000000000 +0200
+++ davfs2-1.4.7.new/src/kernel_interface.c	2013-09-15 10:15:07.000000000 +0200
@@ -167,29 +167,6 @@
         ++minor;
     }
 
-    if (*dev <= 0 && system("/sbin/modprobe coda &>/dev/null") == 0) {
-        minor = 0;
-        while (*dev <= 0 && minor < MAX_CODADEVS) {
-            char *path;
-            if (asprintf(&path, "%s/%s%i",
-                         DAV_DEV_DIR, CODA_DEV_NAME, minor) < 0)
-                abort();
-            *dev = open(path, O_RDWR | O_NONBLOCK);
-            if (*dev <= 0) {
-                if (mknod(path, S_IFCHR, makedev(CODA_MAJOR, minor)) == 0) {
-                    if (chown(path, 0, 0) == 0
-                            && chmod(path, S_IRUSR | S_IWUSR) == 0) {
-                        *dev = open(path, O_RDWR | O_NONBLOCK);
-                    } else {
-                        remove(path);
-                    }
-                }
-            }
-            free(path);
-            ++minor;
-        }
-    }
-
     if (*dev <= 0) {
         error(0, 0, _("no free coda device to mount"));
         return -1;
@@ -225,20 +202,6 @@
             abort();
 
     *dev = open(path, O_RDWR | O_NONBLOCK);
-    if (*dev <= 0 && system("/sbin/modprobe fuse &>/dev/null") == 0) {
-        *dev = open(path, O_RDWR | O_NONBLOCK);
-    }
-    if (*dev <= 0) {
-        if (mknod(path, S_IFCHR, makedev(FUSE_MAJOR, FUSE_MINOR)) == 0) {
-             if (chown(path, 0, 0) == 0
-                    && chmod(path, S_IRUSR | S_IWUSR) == 0) {
-                *dev = open(path, O_RDWR | O_NONBLOCK);
-            } else {
-                remove(path);
-            }
-        }
-    }
-
     free(path);
     if (*dev <= 0) {
         error(0, 0, _("can't open fuse device"));
diff -ur davfs2-1.4.7/src/mount_davfs.c davfs2-1.4.7.new/src/mount_davfs.c
--- davfs2-1.4.7/src/mount_davfs.c	2012-07-19 13:35:11.000000000 +0200
+++ davfs2-1.4.7.new/src/mount_davfs.c	2013-09-15 10:15:22.000000000 +0200
@@ -170,6 +170,9 @@
 static int
 arg_to_int(const char *arg, int base, const char *opt);
 
+static void
+cp_file(const char *src, const char *dest);
+
 static int
 debug_opts(const char *s);
 
@@ -530,10 +533,7 @@
             char *file_name = ne_concat(path, "/", DAV_CONFIG, NULL);
             if (access(file_name, F_OK) != 0) {
                 char *template = ne_concat(DAV_DATA_DIR, "/", DAV_CONFIG, NULL);
-                char *command = ne_concat("cp ", template, " ", file_name,
-                                          NULL);
-                if (system(command) != 0);
-                free(command);
+                cp_file(template, file_name);
                 free(template);
             }
             free(file_name);
@@ -542,11 +542,7 @@
             if (access(file_name, F_OK) != 0) {
                 char *template = ne_concat(DAV_DATA_DIR, "/", DAV_SECRETS,
                                            NULL);
-                char *command = ne_concat("cp ", template, " ", file_name,
-                                          NULL);
-                if (system(command) == 0)
-                    chmod(file_name, S_IRUSR | S_IWUSR);
-                free(command);
+                cp_file(template, file_name);
                 free(template);
             }
             free(file_name);
@@ -1304,6 +1300,7 @@
    opt    : name of the option, arg belongs to. Used in the error message.
    return value: the value of the integer number in arg */
 static int
+
 arg_to_int(const char *arg, int base, const char *opt)
 {
     char *tail = NULL;
@@ -1325,6 +1322,34 @@
 }
 
 
+/* Creates a copy of src with name dest. */
+static void
+cp_file(const char *src, const char *dest)
+{
+    FILE *in = fopen(src, "r");
+    if (!in)
+        error(EXIT_FAILURE, errno, _("can't open file %s"), src);
+
+    FILE *out = fopen(dest, "w");
+    if (!out)
+        error(EXIT_FAILURE, errno, _("can't open file %s"), dest);
+
+    size_t n = 0;
+    char *line = NULL;
+    int length = getline(&line, &n, in);
+    while (length > 0) {
+        if (fputs(line, out) == EOF) 
+            error(EXIT_FAILURE, errno, _("error writing to file %s"), dest);
+        length = getline(&line, &n, in);
+    }
+
+    if (line)
+        free(line);
+    fclose(out);
+    fclose(in);
+}
+
+
 /* Converts a debug option string s into numerical value. If s is not a
    valid debug option, it returns 0. */
 static int

--- End Message ---
--- Begin Message ---
Source: davfs2
Source-Version: 1.4.6-1.1+deb7u1

We believe that the bug you reported is fixed in the latest version of
davfs2, 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.
Luciano Bello <[email protected]> (supplier of updated davfs2 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: SHA1

Format: 1.8
Date: Thu, 26 Sep 2013 14:19:41 +0200
Source: davfs2
Binary: davfs2
Architecture: source amd64
Version: 1.4.6-1.1+deb7u1
Distribution: stable-security
Urgency: low
Maintainer: Luciano Bello <[email protected]>
Changed-By: Luciano Bello <[email protected]>
Description: 
 davfs2     - mount a WebDAV resource as a regular file system
Closes: 723034
Changes: 
 davfs2 (1.4.6-1.1+deb7u1) stable-security; urgency=low
 .
   * Fix CVE-2013-4362: Unsecure use of system(). Closes: #723034
Checksums-Sha1: 
 71d83ce914dd591e61c4da7a9afc20e71bf00e3c 1104 davfs2_1.4.6-1.1+deb7u1.dsc
 5cf396d771345a2bf3583c0a7c08d1ab50a38b97 429799 davfs2_1.4.6.orig.tar.gz
 ac45933903f8a9c39699365663b705852d4a04d7 49173 davfs2_1.4.6-1.1+deb7u1.diff.gz
 aa6436ced8887eb8a23a0db799098a13bb22f1b1 157186 
davfs2_1.4.6-1.1+deb7u1_amd64.deb
Checksums-Sha256: 
 f1a8cb1a7c3a361a7262f21b1c6b2b66bb4215d985e6166df162bd0a0e3ce64b 1104 
davfs2_1.4.6-1.1+deb7u1.dsc
 e07252ec6db38c8f691bf2dada639e8300e058594f47a7c3c45020631621c356 429799 
davfs2_1.4.6.orig.tar.gz
 4dfa2bc7bb81e73364e1c7010a773bbf44ddb8e5dbd032861d6bcdf8c13261ad 49173 
davfs2_1.4.6-1.1+deb7u1.diff.gz
 6199a9ea155bf6afde3b1bb20bec170f5f94c6b2e6f7e83b88d82ecf72fe8ca0 157186 
davfs2_1.4.6-1.1+deb7u1_amd64.deb
Files: 
 c527098c3dd57e73e364b31bdd6acdc5 1104 utils extra davfs2_1.4.6-1.1+deb7u1.dsc
 c9e8aeb15daeba4b6283b40bb640e908 429799 utils extra davfs2_1.4.6.orig.tar.gz
 166c80ee52e1d5a0d860a25716030a07 49173 utils extra 
davfs2_1.4.6-1.1+deb7u1.diff.gz
 3882314feac8eca600c0ee02a56dec4c 157186 utils extra 
davfs2_1.4.6-1.1+deb7u1_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlJEKSYACgkQQWTRs4lLtHkzOQCgsJRRPzSqgIjgVBWRVleDdOkR
hHgAnRwbVnleRkMI+84DenMl4tOOqfd0
=hUVU
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to