Gentoo Archives: gentoo-security

From: Ned Ludd <solar@g.o>
To: John Richard Moser <nigelenki@×××××××.net>
Cc: gentoo-security@l.g.o, gentoo-dev@l.g.o
Subject: [gentoo-security] Re: [gentoo-dev] Stack smash protected daemons
Date: Thu, 23 Sep 2004 05:28:23
Message-Id: 1095917198.29656.64.camel@simple
In Reply to: [gentoo-security] Re: [gentoo-dev] Stack smash protected daemons by John Richard Moser
1 On Thu, 2004-09-23 at 00:01, John Richard Moser wrote:
2 > -----BEGIN PGP SIGNED MESSAGE-----
3 > Hash: SHA1
4 >
5 >
6 > OK, there's too much arguing and not enough useful discussion going on
7 > here. I suggest if you go through with this that you start with the
8 > following in mind and build from there.
9 >
10 > 1. Protect daemons and chmod +s programs
11 The wording on this could be a bit confusing for some. To make it clear
12 no additional apps are getting a +s bit. This proposal is apps that have
13 a setuid mode_t -4000 (going for setgid mote_t -2000 as well?) bit have
14 fstack-protector placed on them as a proactive security measure.
15
16
17 >
18 > For our purposes, let's define a daemon as any program which interacts
19 > with (processes data from) non-root processes, including processes from
20 > other machines. This would cover apache and ssh as well as anything
21 > that happened to provide services to the local box through SysV IPC or
22 > other mechanisms.
23 >
24 > 2. Use a FEATURES flag to implement
25 >
26 > The FEATURES flag I've seen most suggested by persons other than me is
27 > 'autossp'. This flag should cause a portage command (such as
28 > apply-autossp) to append -fstack-protector to CFLAGS. Optionally,
29 > 'autosspall' should apply -fstack-protector-all.
30 >
31 > It's no secret that -fstack-protector-all breaks some programs that
32 > - -fstack-protector doesn't (i.e. Firefox, Thunderbird, Mozilla). In case
33 > of an 'autosspall' FEATURES flag and broken daemons, the 'apply-autossp
34 > no-all' command could tell apply-autossp to use -fstack-protector and
35 > NOT -fstack-protector-all.
36 >
37 > 3. Is this on by default?
38 > It's believed by some of us, me included, to be sane to implement
39 > 'autossp' by default. Personally, I'm against -fstack-protector-all
40 > ('autosspall') by default; others may disagree. I do not have a strong
41 > understanding of the difference between -fstack-protector and -all; I
42 > know what they technically do, but not what the extra instrumentation
43 > code generated with -all will actually gain you. Others know more than I.
44 >
45 > Remember that if this is on by defaut, any user can add "-autossp" to
46 > FEATURES in make.conf. If it's genuinely harmless (I believe it is),
47 > there's really no point in making the user explicitely enable it.
48
49
50 I'll vote YES on -fstack-protector an NO on the -fstack-protector-all by
51 default for the conditions you have outlined.
52
53 ebuilds such as xfree which have problems right now due to improper
54 handling of ELF will restrict it's use with RESTRICT="autossp" or just
55 not make use it.
56
57 No profile will need to contain FEATURES=autossp (it's assumed by
58 default)
59
60 The ebuild logic should/will work as follows.
61
62 inherit flag-o-matic
63
64 src_unpack() {
65 unpack ${A}
66 ...
67 hasq autossp ${RESTRICT} || append-flags -fstack-protector
68 ...
69 }
70
71
72 SpanKY this sound about right?
73
74
75 >
76 > - --
77 > gentoo-dev@g.o mailing list
78 >
79 >
80 >
81 > - --
82 > All content of all messages exchanged herein are left in the
83 > Public Domain, unless otherwise explicitly stated.
84 >
85 > -----BEGIN PGP SIGNATURE-----
86 > Version: GnuPG v1.2.6 (GNU/Linux)
87 > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
88 >
89 > iD8DBQFBUkqFhDd4aOud5P8RAgpqAJ9cUJczw09u8Fc2WxQwCn+1AVsy6QCfbhBK
90 > lBcaH1OZfs+5OcZR6f2V9hE=
91 > =1K/B
92 > -----END PGP SIGNATURE-----
93 >
94 > --
95 > gentoo-dev@g.o mailing list
96 --
97 Ned Ludd <solar@g.o>
98 Gentoo (hardened,security,infrastructure,embedded,toolchain) Developer

Attachments

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

Replies

Subject Author
[gentoo-security] Re: Stack smash protected daemons Thierry Carrez <koon@g.o>