1HARDENING-CHECK(1) HARDENING-CHECK(1)
2
3
4
6 hardening-check - check binaries for security hardening features
7
9 hardening-check [options] [ELF ...]
10
11 Examine a given set of ELF binaries and check for several security
12 hardening features, failing if they are not all found.
13
15 This utility checks a given list of ELF binaries for several security
16 hardening features that can be compiled into an executable. These
17 features are:
18
19 Position Independent Executable
20 This indicates that the executable was built in such a way
21 (PIE) that the "text" section of the program can be relocated
22 in memory. To take full advantage of this feature, the
23 executing kernel must support text Address Space Layout
24 Randomization (ASLR).
25
26 Stack Protected
27 This indicates that there is evidence that the ELF was compiled
28 with the gcc(1) option -fstack-protector (e.g. uses
29 __stack_chk_fail). The program will be resistant to having its
30 stack overflowed.
31
32 When an executable was built without any character arrays being
33 allocated on the stack, this check will lead to false alarms
34 (since there is no use of __stack_chk_fail), even though it was
35 compiled with the correct options.
36
37 Fortify Source functions
38 This indicates that the executable was compiled with
39 -D_FORTIFY_SOURCE=2 and -O1 or higher. This causes certain
40 unsafe glibc functions with their safer counterparts (e.g.
41 strncpy instead of strcpy), or replaces calls that are
42 verifiable at runtime with the runtime-check version (e.g.
43 __memcpy_chk insteade of memcpy).
44
45 When an executable was built such that the fortified versions
46 of the glibc functions are not useful (e.g. use is verified as
47 safe at compile time, or use cannot be verified at runtime),
48 this check will lead to false alarms. In an effort to mitigate
49 this, the check will pass if any fortified function is found,
50 and will fail if only unfortified functions are found.
51 Uncheckable conditions also pass (e.g. no functions that could
52 be fortified are found, or not linked against glibc).
53
54 Read-only relocations
55 This indicates that the executable was build with -Wl,-z,relro
56 to have ELF markings (RELRO) that ask the runtime linker to
57 mark any regions of the relocation table as "read-only" if they
58 were resolved before execution begins. This reduces the
59 possible areas of memory in a program that can be used by an
60 attacker that performs a successful memory corruption exploit.
61
62 Immediate binding
63 This indicates that the executable was built with -Wl,-z,now to
64 have ELF markings (BIND_NOW) that ask the runtime linker to
65 resolve all relocations before starting program execution. When
66 combined with RELRO above, this further reduces the regions of
67 memory available to memory corruption attacks.
68
70 --nopie, -p
71 Do not require that the checked binaries be built as PIE.
72
73 --nostackprotector, -s
74 Do not require that the checked binaries be built with the
75 stack protector.
76
77 --nofortify, -f
78 Do not require that the checked binaries be built with Fortify
79 Source.
80
81 --norelro, -r
82 Do not require that the checked binaries be built with RELRO.
83
84 --nobindnow, -b
85 Do not require that the checked binaries be built with
86 BIND_NOW.
87
88 --quiet, -q
89 Only report failures.
90
91 --verbose, -v
92 Report verbosely on failures.
93
94 --report-functions, -R
95 After the report, display all external functions needed by the
96 ELF.
97
98 --find-libc-functions, -F
99 Instead of the regular report, locate the libc for the first
100 ELF on the command line and report all the known "fortified"
101 functions exported by libc.
102
103 --color, -c
104 Enable colorized status output.
105
106 --lintian, -l
107 Switch reporting to lintian-check-parsable output.
108
109 --debug Report some debugging during processing.
110
111 --help, -h, -?
112 Print a brief help message and exit.
113
114 --man, -H
115 Print the manual page and exit.
116
118 When all checked binaries have all checkable hardening features
119 detected, this program will finish with an exit code of 0. If any check
120 fails, the exit code with be 1. Individual checks can be disabled via
121 command line options.
122
124 Kees Cook <kees@debian.org>
125
127 Copyright 2009-2013 Kees Cook <kees@debian.org>.
128
129 This program is free software; you can redistribute it and/or modify it
130 under the terms of the GNU General Public License as published by the
131 Free Software Foundation; version 2 or later.
132
134 gcc(1), hardening-wrapper(1)
135
136
137
138Debian Utilities 2020-02-06 HARDENING-CHECK(1)