@@ -179,6 +179,59 @@ sysctl_config:
179179 # Virtual memory regions protection | sysctl-32
180180 kernel.randomize_va_space: 2
181181
182+ kernel.core_uses_pid: 1
183+
184+ # When an attacker is trying to exploit the local kernel, it is often
185+ # helpful to be able to examine where in memory the kernel, modules,
186+ # and data structures live. As such, kernel addresses should be treated
187+ # as sensitive information.
188+ #
189+ # Many files and interfaces contain these addresses (e.g. /proc/kallsyms,
190+ # /proc/modules, etc), and this setting can censor the addresses. A value
191+ # of "0" allows all users to see the kernel addresses. A value of "1"
192+ # limits visibility to the root user, and "2" blocks even the root user.
193+ kernel.kptr_restrict: 1
194+
195+ # The PTRACE system is used for debugging. With it, a single user process
196+ # can attach to any other dumpable process owned by the same user. In the
197+ # case of malicious software, it is possible to use PTRACE to access
198+ # credentials that exist in memory (re-using existing SSH connections,
199+ # extracting GPG agent information, etc).
200+ #
201+ # A PTRACE scope of "0" is the more permissive mode. A scope of "1" limits
202+ # PTRACE only to direct child processes (e.g. "gdb name-of-program" and
203+ # "strace -f name-of-program" work, but gdb's "attach" and "strace -fp $PID"
204+ # do not). The PTRACE scope is ignored when a user has CAP_SYS_PTRACE, so
205+ # "sudo strace -fp $PID" will work as before. For more details see:
206+ # https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace
207+ #
208+ # For applications launching crash handlers that need PTRACE, exceptions can
209+ # be registered by the debugee by declaring in the segfault handler
210+ # specifically which process will be using PTRACE on the debugee:
211+ # prctl(PR_SET_PTRACER, debugger_pid, 0, 0, 0);
212+ #
213+ # In general, PTRACE is not needed for the average running Ubuntu system.
214+ # To that end, the default is to set the PTRACE scope to "1". This value
215+ # may not be appropriate for developers or servers with only admin accounts.
216+ # kernel.yama.ptrace_scope = 1
217+ kernel.yama.ptrace_scope: 1
218+
219+ # Protect the zero page of memory from userspace mmap to prevent kernel
220+ # NULL-dereference attacks against potential future kernel security
221+ # vulnerabilities. (Added in kernel 2.6.23.)
222+ #
223+ # While this default is built into the Ubuntu kernel, there is no way to
224+ # restore the kernel default if the value is changed during runtime; for
225+ # example via package removal (e.g. wine, dosemu). Therefore, this value
226+ # is reset to the secure default each time the sysctl values are loaded.
227+ vm.mmap_min_addr: 65536
228+
229+ # These settings eliminate an entire class of security vulnerability:
230+ # time-of-check-time-of-use cross-privilege attacks using guessable
231+ # filenames (generally seen as "/tmp file race" vulnerabilities).
232+ fs.protected_hardlinks: 1
233+ fs.protected_symlinks: 1
234+
182235# Do not delete the following line or otherwise the playbook will fail
183236# at task 'create a combined sysctl-dict if overwrites are defined'
184237sysctl_overwrite:
0 commit comments