2018-01-29 10:22:05 -05:00
|
|
|
## Copyright (C) 2012 - 2018 ENCRYPTED SUPPORT LP <adrelanos@riseup.net>
|
2015-12-14 21:00:24 -05:00
|
|
|
## See the file COPYING for copying conditions.
|
|
|
|
|
|
|
|
Source: security-misc
|
|
|
|
Section: misc
|
|
|
|
Priority: optional
|
|
|
|
Maintainer: Patrick Schleizer <adrelanos@riseup.net>
|
2019-07-01 09:35:45 -04:00
|
|
|
Build-Depends: debhelper (>= 12), genmkfile, config-package-dev
|
2015-12-14 21:00:24 -05:00
|
|
|
Homepage: https://github.com/Whonix/security-misc
|
|
|
|
Vcs-Browser: https://github.com/Whonix/security-misc
|
|
|
|
Vcs-Git: https://github.com/Whonix/security-misc.git
|
2019-04-04 05:51:06 -04:00
|
|
|
Standards-Version: 4.3.0
|
2015-12-14 21:00:24 -05:00
|
|
|
|
|
|
|
Package: security-misc
|
|
|
|
Architecture: all
|
2019-08-14 07:50:53 -04:00
|
|
|
Depends: python, libglib2.0-bin, libpam-runtime, sudo,
|
2019-08-14 07:10:18 -04:00
|
|
|
apparmor-profile-anondist, ${misc:Depends}
|
2016-03-31 11:36:59 -04:00
|
|
|
Replaces: tcp-timestamps-disable
|
2015-12-14 21:00:24 -05:00
|
|
|
Description: enhances misc security settings
|
2019-07-16 07:28:50 -04:00
|
|
|
kernel hardening:
|
2019-07-15 09:01:46 -04:00
|
|
|
.
|
|
|
|
* deactivates Netfilter's connection tracking helper
|
2016-03-31 11:53:40 -04:00
|
|
|
Netfilter's connection tracking helper module increases kernel attack
|
|
|
|
surface by enabling superfluous functionality such as IRC parsing in
|
2019-07-13 12:25:08 -04:00
|
|
|
the kernel. (!) Hence, this package disables this feature by shipping the
|
2019-06-28 07:33:48 -04:00
|
|
|
/etc/modprobe.d/30_nf_conntrack_helper_disable.conf configuration file.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* Kernel symbols in /proc/kallsyms are hidden to prevent malware from
|
2019-06-23 15:26:03 -04:00
|
|
|
reading them and using them to learn more about what to attack on your system.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* Kexec is disabled as it can be used for live patching of the running
|
|
|
|
kernel.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* ASLR effectiveness for mmap is increased.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* The TCP/IP stack is hardened.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* his package makes some data spoofing attacks harder.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* SACK is disabled as it is commonly exploited and is rarely used.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* This package disables the merging of slabs of similar sizes to prevent an
|
2019-06-23 15:26:03 -04:00
|
|
|
attacker from exploiting them.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* Sanity checks, redzoning, and memory poisoning are enabled.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* The kernel now panics on uncorrectable errors in ECC memory which could
|
2019-06-23 15:26:03 -04:00
|
|
|
be exploited.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* Kernel Page Table Isolation is enabled to mitigate Meltdown and increase
|
2019-06-23 15:26:03 -04:00
|
|
|
KASLR effectiveness.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* SMT is disabled as it can be used to exploit the MDS vulnerability.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* All mitigations for the MDS vulnerability are enabled.
|
2019-06-23 15:47:05 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* The SysRq key is restricted to only allow shutdowns/reboots.
|
|
|
|
A systemd service clears System.map on boot as these contain kernel symbols
|
|
|
|
that could be useful to an attacker.
|
2019-08-14 03:24:24 -04:00
|
|
|
/etc/kernel/postinst.d/30_remove-system-map
|
|
|
|
/lib/systemd/system/remove-system-map.service
|
|
|
|
/usr/lib/security-misc/remove-system.map
|
2019-07-15 09:01:46 -04:00
|
|
|
.
|
|
|
|
* Coredumps are disabled as they may contain important information such as
|
|
|
|
encryption keys or passwords.
|
|
|
|
.
|
|
|
|
* The thunderbolt and firewire modules are blacklisted as they can be used
|
|
|
|
for DMA (Direct Memory Access) attacks.
|
|
|
|
.
|
|
|
|
* IOMMU is enabled with a boot parameter to prevent DMA attacks.
|
|
|
|
.
|
|
|
|
* The kernel now panics on oopses to prevent it from continuing running a
|
|
|
|
flawed process.
|
2019-07-31 14:33:28 -04:00
|
|
|
.
|
|
|
|
* Bluetooth is blacklisted to reduce attack surface. Bluetooth also has
|
2019-08-16 12:05:09 -04:00
|
|
|
a history of security concerns.
|
|
|
|
https://en.wikipedia.org/wiki/Bluetooth#History_of_security_concerns
|
2019-08-16 10:35:51 -04:00
|
|
|
.
|
|
|
|
* Requires every module to be signed before being loaded. Any module that is
|
2019-08-14 03:01:25 -04:00
|
|
|
unsigned or signed with an invalid key cannot be loaded. This makes it harder
|
|
|
|
to load a malicious module.
|
|
|
|
/etc/default/grub.d/40_only_allow_signed_modules.cfg
|
2019-06-28 07:34:35 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
Uncommon network protocols are blacklisted:
|
|
|
|
These are rarely used and may have unknown vulnerabilities.
|
|
|
|
/etc/modprobe.d/uncommon-network-protocols.conf
|
2019-07-11 14:26:17 -04:00
|
|
|
The network protocols that are blacklisted are:
|
|
|
|
.
|
|
|
|
* DCCP - Datagram Congestion Control Protocol
|
|
|
|
* SCTP - Stream Control Transmission Protocol
|
|
|
|
* RDS - Reliable Datagram Sockets
|
|
|
|
* TIPC - Transparent Inter-process Communication
|
|
|
|
* HDLC - High-Level Data Link Control
|
|
|
|
* AX25 - Amateur X.25
|
|
|
|
* NetRom
|
|
|
|
* X25
|
|
|
|
* ROSE
|
|
|
|
* DECnet
|
|
|
|
* Econet
|
|
|
|
* af_802154 - IEEE 802.15.4
|
|
|
|
* IPX - Internetwork Packet Exchange
|
|
|
|
* AppleTalk
|
|
|
|
* PSNAP - Subnetwork Access Protocol
|
|
|
|
* p8023 - Novell raw IEEE 802.3
|
|
|
|
* LLC - IEEE 802.2
|
|
|
|
* p8022 - IEEE 802.2
|
2019-07-11 11:26:14 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
user restrictions:
|
2019-06-28 07:34:35 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* A systemd service mounts /proc with hidepid=2 at boot to prevent users from
|
|
|
|
seeing each other's processes.
|
2019-07-15 08:48:17 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* The kernel logs are restricted to root only.
|
2019-06-28 07:34:35 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* The BPF JIT compiler is restricted to the root user and is hardened.
|
2019-06-28 07:34:35 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* The ptrace system call is restricted to the root user only.
|
2019-07-15 08:48:17 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
restricts access to the root account:
|
2019-06-28 07:34:35 -04:00
|
|
|
.
|
2019-07-31 03:32:36 -04:00
|
|
|
* `su` is restricted to only users within the group `sudo` which prevents
|
|
|
|
users from using `su` to gain root access or to switch user accounts.
|
2019-08-11 06:34:38 -04:00
|
|
|
/usr/share/pam-configs/wheel-security-misc
|
2019-07-31 03:32:36 -04:00
|
|
|
(Which results in a change in file `/etc/pam.d/common-auth`.)
|
2019-07-31 03:29:42 -04:00
|
|
|
.
|
2019-07-31 03:32:36 -04:00
|
|
|
* Add user `root` to group `sudo`. This is required to make above work so
|
|
|
|
login as a user in a virtual console is still possible.
|
2019-07-31 03:30:40 -04:00
|
|
|
debian/security-misc.postinst
|
2019-07-31 03:29:42 -04:00
|
|
|
.
|
|
|
|
* Lock user accounts after 5 failed login attempts using pam_tally2.
|
2019-08-11 06:34:38 -04:00
|
|
|
/usr/share/pam-configs/tally2-security-misc
|
2019-06-29 20:21:46 -04:00
|
|
|
.
|
2019-07-17 16:39:42 -04:00
|
|
|
* Logging into the root account from a virtual, serial, whatnot console is
|
2019-07-17 16:42:14 -04:00
|
|
|
prevented by shipping an existing and empty /etc/securetty.
|
|
|
|
(Deletion of /etc/securetty has a different effect.)
|
2019-07-17 16:39:42 -04:00
|
|
|
/etc/securetty.security-misc
|
2019-06-29 18:30:41 -04:00
|
|
|
.
|
2019-08-15 09:37:28 -04:00
|
|
|
informational output during PAM:
|
|
|
|
.
|
|
|
|
* Show failed and remaining password attempts.
|
|
|
|
* Document unlock procedure if Linux user account got locked.
|
|
|
|
* Point out, that there is no password feedback for `su`.
|
|
|
|
* Explain locked (root) account if locked.
|
|
|
|
* /usr/share/pam-configs/tally2-security-misc
|
|
|
|
* /usr/lib/security-misc/pam_tally2-info
|
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
access rights restrictions:
|
2019-06-30 09:16:12 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* The default umask is changed to 006. This allows only the owner and group
|
|
|
|
to read and write to newly created files.
|
2019-07-17 16:48:33 -04:00
|
|
|
/etc/login.defs.security-misc
|
2019-08-14 03:39:28 -04:00
|
|
|
/usr/share/pam-configs/usergroups-security-misc
|
2019-08-16 11:15:25 -04:00
|
|
|
/etc/sudoers.d/umask-security-misc
|
2019-07-17 16:48:33 -04:00
|
|
|
.
|
|
|
|
* Enables pam_umask.so usergroups so group permissions are same as user
|
|
|
|
permissions. Debian by default uses User Private Groups (UPG).
|
|
|
|
https://wiki.debian.org/UserPrivateGroups
|
2019-08-11 06:34:38 -04:00
|
|
|
/usr/share/pam-configs/usergroups-security-misc
|
2019-08-11 06:33:22 -04:00
|
|
|
.
|
|
|
|
* Create home directory on login with umask 006 using
|
|
|
|
pam_mkhomedir.so umask=006
|
|
|
|
/usr/share/pam-configs/mkhomedir-security-misc
|
2019-07-08 19:04:47 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
* Removes read, write and execute access for others for all users who have
|
|
|
|
home folders under folder /home by running for example
|
|
|
|
"chmod o-rwx /home/user"
|
2019-08-14 05:52:53 -04:00
|
|
|
during package installation, upgrade or pam. This will be done only once per
|
|
|
|
folder in folder /home so users who wish to relax file permissions are free to
|
|
|
|
do so. This is to protect previously created files in user home folder which
|
|
|
|
were previously created with lax file permissions prior installation of this
|
2019-07-13 12:20:14 -04:00
|
|
|
package.
|
2019-07-31 03:30:40 -04:00
|
|
|
debian/security-misc.postinst
|
2019-08-14 05:40:41 -04:00
|
|
|
/usr/share/pam-configs/permission-lockdown-security-misc
|
|
|
|
/usr/lib/security-misc/permission-lockdown
|
2019-07-13 12:20:14 -04:00
|
|
|
.
|
2019-07-17 17:02:27 -04:00
|
|
|
access rights relaxations:
|
|
|
|
.
|
2019-07-17 17:03:54 -04:00
|
|
|
This package does (not yet) automatically lock the root account password.
|
2019-07-17 17:02:27 -04:00
|
|
|
It is not clear that would be sane in such a package.
|
|
|
|
It is recommended to lock and expire the root account.
|
|
|
|
In new Whonix builds, root account will be locked by package
|
|
|
|
anon-base-files.
|
|
|
|
https://www.whonix.org/wiki/Root
|
|
|
|
https://www.whonix.org/wiki/Dev/Permissions
|
|
|
|
https://forums.whonix.org/t/restrict-root-access/7658
|
|
|
|
However, a locked root password will break rescue and emergency shell.
|
|
|
|
Therefore this package enables passwordless resuce and emergency shell.
|
|
|
|
This is the same solution that Debian will likely addapt for Debian
|
|
|
|
installer.
|
|
|
|
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802211
|
|
|
|
Adverse security effects can be prevented by setting up BIOS password
|
|
|
|
protection, grub password protection and/or full disk encryption.
|
2019-07-17 17:05:11 -04:00
|
|
|
/etc/systemd/system/emergency.service.d/override.conf
|
|
|
|
/etc/systemd/system/rescue.service.d/override.conf
|
2019-07-17 17:02:27 -04:00
|
|
|
.
|
2019-07-15 09:01:46 -04:00
|
|
|
Disables TCP Time Stamps:
|
2019-07-13 12:26:14 -04:00
|
|
|
.
|
|
|
|
TCP time stamps (RFC 1323) allow for tracking clock
|
|
|
|
information with millisecond resolution. This may or may not allow an
|
|
|
|
attacker to learn information about the system clock at such
|
|
|
|
a resolution, depending on various issues such as network lag.
|
|
|
|
This information is available to anyone who monitors the network
|
|
|
|
somewhere between the attacked system and the destination server.
|
|
|
|
It may allow an attacker to find out how long a given
|
|
|
|
system has been running, and to distinguish several
|
|
|
|
systems running behind NAT and using the same IP address. It might
|
|
|
|
also allow one to look for clocks that match an expected value to find the
|
|
|
|
public IP used by a user.
|
|
|
|
.
|
|
|
|
Hence, this package disables this feature by shipping the
|
|
|
|
/etc/sysctl.d/tcp_timestamps.conf configuration file.
|
|
|
|
.
|
|
|
|
Note that TCP time stamps normally have some usefulness. They are
|
|
|
|
needed for:
|
|
|
|
.
|
|
|
|
* the TCP protection against wrapped sequence numbers; however, to
|
|
|
|
trigger a wrap, one needs to send roughly 2^32 packets in one
|
|
|
|
minute: as said in RFC 1700, "The current recommended default
|
|
|
|
time to live (TTL) for the Internet Protocol (IP) [45,105] is 64".
|
|
|
|
So, this probably won't be a practical problem in the context
|
|
|
|
of Anonymity Distributions.
|
|
|
|
* "Round-Trip Time Measurement", which is only useful when the user
|
|
|
|
manages to saturate their connection. When using Anonymity Distributions,
|
|
|
|
probably the limiting factor for transmission speed is rarely the capacity
|
|
|
|
of the user connection.
|
2019-07-15 09:02:30 -04:00
|
|
|
.
|
|
|
|
Application specific hardening:
|
|
|
|
.
|
2019-07-16 07:28:50 -04:00
|
|
|
* Enables APT seccomp-BPF sandboxing. /etc/apt/apt.conf.d/40sandbox
|
|
|
|
* Deactivates previews in Dolphin.
|
|
|
|
* Deactivates previews in Nautilus.
|
|
|
|
* Deactivates thumbnails in Thunar.
|