blob: 104aa171bd05d14d434b6fc538ab0d51b0da2bb7 [file] [log] [blame]
Armin Kuster066be202018-07-08 14:58:53 -07001From 5018a0c016495155ee598b7e0167b43d5d902414 Mon Sep 17 00:00:00 2001
2From: Jann Horn <jannh@google.com>
3Date: Sat, 14 Jul 2018 03:47:50 -0700
4Subject: [PATCH] fusermount: refuse unknown options
5
6Blacklists are notoriously fragile; especially if the kernel wishes to add
7some security-critical mount option at a later date, all existing systems
8with older versions of fusermount installed will suddenly have a security
9problem.
10Additionally, if the kernel's option parsing became a tiny bit laxer, the
11blacklist could probably be bypassed.
12
13Whitelist known-harmless flags instead, even if it's slightly more
14inconvenient.
15
16CVE: CVE-2018-10906
17Upstream-Status: Backport [https://github.com/libfuse/libfuse/commit/5018a0c016495155ee598b7e0167b43d5d902414]
18
19Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>
20---
21 util/fusermount.c | 8 +++++++-
22 1 file changed, 7 insertions(+), 1 deletion(-)
23
24diff --git a/util/fusermount.c b/util/fusermount.c
25index 4e0f51a..2792407 100644
26--- a/util/fusermount.c
27+++ b/util/fusermount.c
28@@ -819,10 +819,16 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode,
29 flags |= flag;
30 else
31 flags &= ~flag;
32- } else {
33+ } else if (opt_eq(s, len, "default_permissions") ||
34+ opt_eq(s, len, "allow_other") ||
35+ begins_with(s, "max_read=") ||
36+ begins_with(s, "blksize=")) {
37 memcpy(d, s, len);
38 d += len;
39 *d++ = ',';
40+ } else {
41+ fprintf(stderr, "%s: unknown option '%.*s'\n", progname, len, s);
42+ exit(1);
43 }
44 }
45 }
46--
472.13.3
48