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 --nocfprotection, -b
89 Do not require that the checked binaries be built with control
90 flow protection.
91
92 --quiet, -q
93 Only report failures.
94
95 --verbose, -v
96 Report verbosely on failures.
97
98 --report-functions, -R
99 After the report, display all external functions needed by the
100 ELF.
101
102 --find-libc-functions, -F
103 Instead of the regular report, locate the libc for the first
104 ELF on the command line and report all the known "fortified"
105 functions exported by libc.
106
107 --color, -c
108 Enable colorized status output.
109
110 --lintian, -l
111 Switch reporting to lintian-check-parsable output.
112
113 --debug Report some debugging during processing.
114
115 --help, -h, -?
116 Print a brief help message and exit.
117
118 --man, -H
119 Print the manual page and exit.
120
122 When all checked binaries have all checkable hardening features
123 detected, this program will finish with an exit code of 0. If any check
124 fails, the exit code with be 1. Individual checks can be disabled via
125 command line options.
126
128 Kees Cook <kees@debian.org>
129
131 Copyright 2009-2013 Kees Cook <kees@debian.org>.
132
133 This program is free software; you can redistribute it and/or modify it
134 under the terms of the GNU General Public License as published by the
135 Free Software Foundation; version 2 or later.
136
138 gcc(1), hardening-wrapper(1)
139
140
141
142Debian Utilities 2023-02-05 HARDENING-CHECK(1)