Gentoo Archives: gentoo-hardened

From: Grant <emailgrant@×××××.com>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] Profile switch: hardened to non-hardened?
Date: Sat, 27 Dec 2008 20:30:15
Message-Id: 49bf44f10812271230p7558e8fbt819e595e1cbc960b@mail.gmail.com
In Reply to: Re: [gentoo-hardened] Profile switch: hardened to non-hardened? by "Javier J. Martínez Cabezón"
1 > Low grsecurity level:
2 >
3 > linking restrictions
4 > fifo restrictions
5 > random pids
6 > enforcing nproc on execve()
7 > restricted dmesg
8 > random ip ids
9 > enforced chdir("/") on chroot
10 >
11 > Medium grsecurity level (include low grsec level)
12 >
13 > random tcp source ports
14 > failed fork logging
15 > time change logging
16 > signal logging
17 > deny mounts in chroot
18 > deny double chrooting
19 > deny sysctl writes in chroot
20 > deny mknod in chroot
21 > deny access to abstract AF_UNIX sockets out of chroot
22 > deny pivot_root in chroot
23 > denied writes of /dev/kmem, /dev/mem, and /dev/port
24 > /proc restrictions with special gid set to 10 (generalmente wheel)
25 > address space layout randomization
26 > removal of addresses from /proc//[maps|stat]
27 >
28 > high grsecurity level (include low and medium):
29 >
30 > additional /proc restrictions
31 > chmod restrictions in chroot
32 > no signals, ptrace, or viewing processes outside of chroot
33 > capability restrictions in chroot
34 > deny fchdir out of chroot
35 > priority restrictions in chroot
36 > segmentation-based implementation of PaX
37 > mprotect restrictions
38 > kernel stack randomization
39 > mount/unmount/remount logging
40 > kernel symbol hiding
41 >
42 > I took this from the grsecurity-hacktimes-v1.0.pdf. Let's see.
43 >
44 > Low level: it enforces the chroot creation a bit and protect against
45 > linking attacks. Protects against a few D.O.S. Is a very low low low
46 > low level of security (this and nothing is something like the same.
47 >
48 > Medium level: This introduces two things interesting, it protects
49 > memory devices from alteration (rootkits could do this). It harden the
50 > chroots creation closing some doors that could make people escape from
51 > it. I think it has not sense that ASLR appears here since the stack
52 > probably stays executable and so is not needed one return into libc
53 > attack to get success. The same for the restrictions to
54 > /proc/self/maps.
55 >
56 > High level: It enforces the no executable stack and heap and the
57 > mprotect restrictions to make it useful (so no memory could be
58 > simultaneously writeable and executable. Now is needed the ASLR
59 > approach and the hiding of address to make it useful against buffer
60 > overflows.
61 >
62 > It would be useful to activate Trusted Path Execution by default
63 > (maybe could appears in custom level?).
64
65 Thank you for that. What I'm looking for is one or more easy methods
66 for hardening my Gentoo systems. I have two desktops, a laptop, and a
67 remote server. The desktops and laptop run a hardened kernel with
68 grsecurity "Low" and the server runs a hardened profile and a hardened
69 kernel with grsecurity "Medium". I don't run a hardened profile or
70 grsecurity "Medium" on the desktops or laptops because problems pop up
71 with Xorg apps and I don't have time to delve into them. I need
72 something easy like enabling "Low", "Medium", or "High" and
73 recompiling the kernel.
74
75 What else would you recommend for me?
76
77 - Grant
78
79
80 >>> Why don't you tell what you didn't understand to us explain it
81 >>> properly to you?. You can't assure nothing if you don't know what do
82 >>> you need to assure.
83 >>> You can't implement Mandatory Access Controls such as GRSEC rbac
84 >>> without a bit of known. You need to make one policy for your system
85 >>> and the kernel makes it enforcing their function.
86 >>>
87 >>> If you are not a sysadmin, how did you keep servers running?, to keep
88 >>> servers you need to know how does them work internaly (for example DNS
89 >>> rfc for DNS servers etc.).
90 >>
91 >> When I say I'm not a real sysadmin, I mean I have many duties and I'm
92 >> not able to dive all the way in with sysadmin stuff. This is due to
93 >> time constraints.
94 >>
95 >>> As bad is not getting one MAC system running (as the RBAC of
96 >>> grsecurity) as get one incorrectly configured running, for example
97 >>> granting all capabilities (CAP_SYS_RAWIO...) to the user running
98 >>> skype. GRSEC has one TPE function in himself read about it.
99 >>>
100 >>> Sorry but you have to read documentation (start for example with
101 >>> gentoo hardened docs).
102 >>
103 >> You're right. I thought that I was hardening my system just by
104 >> running a hardened profile and a hardened kernel at the "Medium"
105 >> Grsecurity setting. Does that provide no extra security if I don't
106 >> configure it beyond that?
107 >>
108 >> - Grant
109 >>
110 >>
111 >>>>> Without hardened userland only in access controls. You can implement
112 >>>>> for example one Trusted Path Execution with LIDS, RSBAC, GRSEC or
113 >>>>> SELinux. They could try to stop crackers that gain unpriviledge access
114 >>>>> to the host (with a remote exploit for example) to execute exploits to
115 >>>>> scale priviledges. They could give you one least priviledge approach
116 >>>>> (as PaX does) and other useful things, as isolation of daemons,
117 >>>>> resources controls. And a lot of more. With TPE however, untrusted
118 >>>>> scripts (exploits) could be launched without execution rights, and
119 >>>>> even restricting the use of perl and python, you must grant your users
120 >>>>> the access to bash.
121 >>>>
122 >>>> Thank you for taking the time to explain, but I'm afraid I don't
123 >>>> understand. I'm looking for things I can implement that don't require
124 >>>> me to understand their inner workings. This is not ideal, but I only
125 >>>> have so much time to devote to sysadmin duties since I'm not a real
126 >>>> sysadmin. My server runs a hardened profile because it hasn't caused
127 >>>> any problems, but running a hardened profile on my desktops has proven
128 >>>> to be too difficult. All of my systems run a hardened kernel but the
129 >>>> only hardened feature I've enabled in the kernel is Grsecurity set to
130 >>>> medium or low depending on the system.
131 >>>>
132 >>>> Do the hardened profile and hardened kernels do me any good without
133 >>>> further configuration?
134 >>>>
135 >>>> - Grant
136 >>>>
137 >>>>>>> In terms of userland, non hardened profile doesn't protect you at all
138 >>>>>>> against buffer overflows, you are removing one important security
139 >>>>>>> layer. SSP protects you against buffer overflows in terms that the
140 >>>>>>> vulnerable application gets killed when the canary is modified before
141 >>>>>>> the execution of the arbitrary code. PIE protects you against return
142 >>>>>>> into libc attacks that doesn't need an executable stack. PaX is not
143 >>>>>>> perfect and needs them as complementary solutions. For example I think
144 >>>>>>> that RANDEXEC was removed from PaX time ago, one buffer overflow that
145 >>>>>>> uses return into libc attack could be succesfully against one
146 >>>>>>> non-hardened binary. Since skype is a network oriented software...
147 >>>>>>
148 >>>>>> In what situations is a hardened kernel useful?
149 >>>>>>
150 >>>>>> - Grant

Replies