1 .\" $NetBSD: security.8,v 1.18 2009/01/26 13:23:20 elad Exp $
3 .\" Copyright (c) 2006 Elad Efrat <elad@NetBSD.org>
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. The name of the author may not be used to endorse or promote products
15 .\" derived from this software without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 supports a variety of security features.
39 Below is a brief description of them with some quick usage examples
40 that will help you get started.
45 Veriexec (file integrity)
57 is a file integrity subsystem.
59 For more information about it, and a quick guide on how to use it, please see
62 In a nutshell, once enabled,
64 can be started as follows:
65 .Bd -literal -offset indent
66 # veriexecgen \*[Am]\*[Am] veriexecctl load
68 .Sh EXPLOIT MITIGATION
70 incorporates some exploit mitigation features.
71 The purpose of exploit mitigation features is to interfere with the way exploits
72 work, in order to prevent them from succeeding.
73 Due to that, some features may have other impact on the system, so be sure to
74 fully understand the implications of each feature.
77 provides the following exploit mitigation features:
80 PaX ASLR (Address Space Layout Randomization)
89 stack-smashing protection (SSP)
93 implements Address Space Layout Randomization, meant to complement
94 non-executable mappings.
95 Its purpose is to harden prediction of the address space layout, namely
96 location of library and application functions that can be used by an attacker
97 to circumvent non-executable mappings by using a technique called
99 to bypass the need to write new code to (potentially executable) regions of
104 is used, it is more likely the attacker will fail to predict the addresses of
105 such functions, causing the application to segfault.
106 To detect cases where an attacker might try and brute-force the return address
107 of respawning services,
109 can be used (see below).
111 For non-PIE (Position Independent Executable) executables,
115 implementation introduces randomization to the following memory regions:
126 The program itself (exec base)
135 While it can be enabled globally,
141 on a per-program basis.
144 .Bd -literal -offset indent
145 # paxctl +A /usr/sbin/sshd
151 .Bd -literal -offset indent
152 # sysctl -w security.pax.aslr.global=1
156 implements memory protection restrictions, meant to complement non-executable
158 Their purpose is to prevent situations where malicious code attempts to mark
159 writable memory regions as executable, often by trashing arguments to an
163 While it can be enabled globally,
169 on a per-program basis.
172 .Bd -literal -offset indent
173 # paxctl +M /usr/sbin/sshd
179 .Bd -literal -offset indent
180 # sysctl -w security.pax.mprotect.global=1
184 monitors the number of segmentation faults in a program on a per-user basis,
185 in an attempt to detect on-going exploitation attempts and possibly prevent
189 can help detect when an attacker tries to brute-force a function
190 return address, when attempting to perform a return-to-lib attack.
193 consumes kernel memory, so use it wisely.
194 While it provides rate-limiting protections, records are tracked for all
195 users on a per-program basis, meaning that irresponsible use may result in
196 tracking all segmentation faults in the system, possibly consuming all kernel
199 For this reason, it is highly recommended to have
201 enabled explicitly only for network services, etc.
204 explicitly works like this:
205 .Bd -literal -offset indent
206 # paxctl +G /usr/sbin/sshd
209 However, a global knob is still provided, for use in strict environments
210 with no local users (some network appliances, embedded devices, firewalls,
212 .Bd -literal -offset indent
213 # sysctl -w security.pax.segvguard.global=1
219 .Bd -literal -offset indent
225 provides several tunable options.
226 For example, to limit a program to 5 segmentation faults from the same user in
227 a 60 second timeframe:
228 .Bd -literal -offset indent
229 # sysctl -w security.pax.segvguard.max_crashes=5
230 # sysctl -w security.pax.segvguard.expiry_timeout=60
233 The number of seconds a user will be suspended from running the culprit
234 program is also configurable.
235 For example, 10 minutes seem like a sane setting:
236 .Bd -literal -offset indent
237 # sysctl -w security.pax.segvguard.suspend_timeout=600
239 .Ss GCC Stack Smashing Protection ( SSP )
245 a set of compiler extensions to raise the bar on exploitation attempts by
246 detecting corruption of variables and buffer overruns, which may be used to
247 affect program control flow.
249 Upon detection of a buffer overrun,
251 will immediately abort execution of the program and send a log message
255 The system (userland and kernel) can be built with
261 .Bd -literal -offset indent
265 You are encouraged to use
267 for software you build, by providing one of the
270 .Fl fstack-protector-all
273 Keep in mind, however, that
275 will not work for functions that make use of
277 as the latter modifies the stack size during run-time, while
279 relies on it being a compile-time static.
283 is especially encouraged on platforms without per-page execute bit granularity
286 .Sh PER-USER TEMPORARY STORAGE
287 It is possible to configure per-user temporary storage to avoid potential
288 security issues (race conditions, etc.) in programs that do not make secure
292 To enable per-user temporary storage, add the following line to
294 .Bd -literal -offset indent
300 is a mount point, you will also need to update its
304 (or whatever directory you want, if you override the default using the
311 .Bd -literal -offset indent
312 # /etc/rc.d/perusertmp start
314 .Sh INFORMATION FILTERING
316 provides administrators the ability to restrict information passed from
317 the kernel to userland so that users can only view information they
320 The hooks that manage this restriction are located in various parts of the
321 system and affect programs such as
326 Information filtering is enabled as follows:
327 .Bd -literal -offset indent
328 # sysctl -w security.curtain=1
339 .An Elad Efrat Aq elad@NetBSD.org