Armin Kuster | 066be20 | 2018-07-08 14:58:53 -0700 | [diff] [blame] | 1 | From 5018a0c016495155ee598b7e0167b43d5d902414 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jann Horn <jannh@google.com> |
| 3 | Date: Sat, 14 Jul 2018 03:47:50 -0700 |
| 4 | Subject: [PATCH] fusermount: refuse unknown options |
| 5 | |
| 6 | Blacklists are notoriously fragile; especially if the kernel wishes to add |
| 7 | some security-critical mount option at a later date, all existing systems |
| 8 | with older versions of fusermount installed will suddenly have a security |
| 9 | problem. |
| 10 | Additionally, if the kernel's option parsing became a tiny bit laxer, the |
| 11 | blacklist could probably be bypassed. |
| 12 | |
| 13 | Whitelist known-harmless flags instead, even if it's slightly more |
| 14 | inconvenient. |
| 15 | |
| 16 | CVE: CVE-2018-10906 |
| 17 | Upstream-Status: Backport [https://github.com/libfuse/libfuse/commit/5018a0c016495155ee598b7e0167b43d5d902414] |
| 18 | |
| 19 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> |
| 20 | --- |
| 21 | util/fusermount.c | 8 +++++++- |
| 22 | 1 file changed, 7 insertions(+), 1 deletion(-) |
| 23 | |
| 24 | diff --git a/util/fusermount.c b/util/fusermount.c |
| 25 | index 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 | -- |
| 47 | 2.13.3 |
| 48 | |