Gentoo Archives: gentoo-dev

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-dev@l.g.o
Cc: pr@g.o
Subject: Re: [gentoo-dev] [PATCH] 2021-07-09-systemd-tmpfiles: re-add news item
Date: Sun, 11 Jul 2021 13:53:46
Message-Id: 8543b252-471b-cb25-23b7-aa4953a44ab6@gentoo.org
In Reply to: [gentoo-dev] [PATCH] 2021-07-09-systemd-tmpfiles: re-add news item by Georgy Yakovlev
1 Hi,
2
3 TL;DR:
4
5 Given that William said in the meanwhile, he sees no future for
6 opentmpfiles [1] and that nobody else, including me, is interested in
7 stepping up, things have changed.
8
9 Please start with the normal last-rite process and please please please,
10 rephrase the news item and do not tell world that opentmpfiles has been
11 masked due to the reported vulnerability because this would be wrong.
12
13 ----
14
15 The package was masked due to a miscommunication with the Gentoo
16 Security project.
17
18 While it is true that the way opentmpfiles is currently implemented
19 allows for certain races, from the security point of view, you always
20 have to classify the vulnerability in context of your threat model
21 because security depends on multiple layers (onion model).
22
23 First, we have to take tmpfiles.d specifications into account:
24
25 By default, opentmpfiles service is only reading from certain locations
26 (for example /usr/lib/tmpfiles.d) – all of these locations are only
27 writable for root user by default which makes it impossible for an
28 attacker to create a controllable exploit.
29
30 Furthermore, tmpfiles.d settings are only supposed for creation,
31 deletion and cleaning of volatile and temporary files. Any package which
32 will install tmpfiles.d settings which will create files in persistent
33 locations should be treated like a bug in the package itself (for Gentoo
34 packagers for example we have keepdir [3] function).
35
36 Same is true for packages installing tmpfiles.d settings which will
37 create volatile and temporary directories in user writable locations,
38 which is usually treated like a weak file permission vulnerability in
39 the package, similar to world-writable PID files, config files, log
40 locations etc.
41
42 Despite all the outlined pre-requirements, an attacker would still need
43 to convince the system administrator to restart a boot service which is
44 very uncommon and even OpenRC is warning against doing something like that.
45
46 opentmpfiles specifically starts before any other services, so a
47 compromised daemon is not capable of injecting a malicious symlink
48 before startup:
49
50 > $ /lib/rc/bin/rc-depend opentmpfiles-setup
51 > sysfs devfs udev udev-trigger hwclock modules fsck root localmount opentmpfiles-setup
52
53 Finally, in Gentoo Linux, like in many other distributions, from
54 security point of view, we assume certain preconditions like running
55 with "fs.protected_symlinks" and "fs.protected_hardlinks" enabled by
56 default since baselayout-2.7 [4] which largely mitigates symlink attacks.
57
58 (These sysctls don't affect CVE-2017-18925, but they do affect
59 the other reported opentmpfiles CVEs, and it's worth mentioning
60 them as examples of configuration we have to assume.)
61
62 Therefore, Gentoo's security project does not believe that it is
63 required to mask this package in Gentoo Linux for security reasons
64 because our classification from 2017 has not changed and we usually do
65 not mask any package with flaws which cannot be exploited in default
66 configuration and would require discouraged settings like disabled
67 fs.protected_symlink feature, or adjusting e.g. OpenRC's
68 runlevels/configuration in an unsupported way.
69
70 Thank you.
71
72
73 See also:
74 =========
75 [1]
76 https://archives.gentoo.org/gentoo-dev/message/bce91b9d37db0b1e0980eb923a8607c9
77
78 [2]
79 https://www.gentoo.org/support/security/vulnerability-treatment-policy.html
80
81 [3] https://devmanual.gentoo.org/function-reference/install-functions/
82
83 [4] https://bugs.gentoo.org/704914
84
85
86 --
87 Regards,
88 Thomas Deutschmann / Gentoo Security Team
89 fpr: C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature

Replies