Operating System Hardening

From Kicksecure
Jump to navigation Jump to search

The page is about hardening the Debian operating system, which is the base Kicksecure. It covers topics such as Debian Security Announcements, hardening steps, kernel hardening, and module loading.

Debian[edit]

Debian Security Announcements[edit]

Since Kicksecure is based on Debian, it takes advantage of all the hard work done by their security team: [1]

Debian takes security very seriously. We handle all security problems brought to our attention and ensure that they are corrected within a reasonable timeframe. Many advisories are coordinated with other free software vendors and are published the same day a vulnerability is made public and we also have a Security Audit team that reviews the archive looking for new or unfixed security bugs. Experience has shown that "security through obscurity" does not work. Public disclosure allows for more rapid and better solutions to security problems. In that vein, this page addresses Debian's status with respect to various known security holes, which could potentially affect Debian.

Users should consider subscribing to the Debian security announcement mailing listarchive.org to stay informed about the latest security advisories.

Harden Debian[edit]

Most hardening steps cannot be easily added to Kicksecure by default. Any major changes require careful research and significant developer/tester effort, otherwise system errors or breakage may occur. This is an open topic and Kicksecure developers are amenable to suggestions - improving operating system security will always be a primary design goal.

Before attempting additional hardening measures below, be sure to fully understand them and apply the steps carefully:

Readers are welcome to add any additional hardening resources to this list.

Hardened Kernels[edit]

The upstream Kernel Self Protection Project (KSPP) [2] was established in 2015 with the goal of introducing more hardening features into mainline Linux. This includes many features found in the Grsecurity patchset, which was publicly available until early 2017archive.org. One advantage of KSPP is that users will no longer need to compile and tweak settings to create a secure kernel. Instead, many hardening features will become the default over time in various distributions. Up-to-date information on available hardening features can be viewed herearchive.org.

The Hardened Kernel Project is a collaborative effort between Arch and Gentoo developers who handled Grsecurity packaging in their respective distributions with the goal of accelerating mainlining of the patchset. [3] [4]

While kernel hardening is important, it only addresses a subset of security risks. It cannot protect against backdoors or security issues related to design, policy or yet unknown exploit classes.

Module Loading[edit]

Restricting module loading can protect the kernel.

Chapter "Module Loading" is for advanced users only since it could break various things. This is still under development. See Kicksecure development discussion: allow loading signed kernel modules by default / disallow kernel module loading by defaultarchive.org

/usr/lib/modules-load.d/whonix-firewall.conf

ipt_REJECT ip6t_REJECT nft_chain_nat_ipv4 nft_chain_route_ipv4 nft_chain_route_ipv6 nft_compat nft_counter xt_conntrack xt_state xt_tcpudp

/usr/lib/modules-load.d/xfce.conf

snd_intel8x0 ## Platform specific? ## is autoloaded by snd_intel8x0 #snd evdev drm ## works without too #binfmt_misc

Kicksecure only: /usr/lib/modules-load.d/kloak.conf

uinput

VirtualBox only: /usr/lib/modules-load.d/vbox.conf

vboxguest vboxsf vboxvideo

Disable module loading by creating this file: /etc/sysctl.d/module-loading.conf

kernel.modules_disabled=1

After reboot, test if module loading is really disabled. Try to load any module, for example apanel.

sudo modprobe apanel

Should show.

modprobe: ERROR: could not insert 'apanel': Operation not permitted

Harden Software Repositories[edit]

Many operating systems provide multiple repositories. Since the Kicksecure implementation is based on Debian, these resources provide a suitable introduction for interested readers:

In summary, these resources confirm the main repository receives the most developer attention and security updates. This suggests a degree of hardening might involve editing /etc/apt/sources.list to strictly limit software to the main repository, while only installing security fixes and no other updates.

Kicksecure has not implemented this design by default and it is an open research question whether this will actually improve security.

Vulnerabilities at Install Time[edit]

Introduction[edit]

Various installation media expose users to vulnerabilities, including:

The threat arises because the latest stable releases sometimes contain vulnerable, remotely exploitable applications. These applications are very likely to be used over untrusted networks [5] which are in a position to run Man-in-the-Middle Attacks.

One recent example is the January, 2019 APT vulnerability (CVE-2019-3462archive.org) which allowed content injection by a MiTM attacker, thereby enabling remote code execution on the affected Linux machine. Specifically, improper sanitization of parameters in HTTP redirects allowed malicious content (altered packages) to be installed via a harmful mirror or direct injection into the network traffic. [6] For another example, see CVE-2014-6273archive.org which affected APT in 2014.

Readers are welcome to help research this issue further and document sane and effective solutions. [7] For example, users who solely rely on Debian and Kicksecure onion services for updates may have had (partial) protection against the 2019 APT bug, but this requires investigation.

Possible Solutions[edit]

Always Up-to-date Builds[edit]

If Kicksecure regularly released up-to-date builds, this would be an optimal solution for end users. However, the maintenance effort -- building, testing and uploading -- is resource-intensive and not currently feasible for the Kicksecure team.

Greater community support is needed for testing proposed Kicksecure package updates and major new releases, alongside an automated test suite for Kicksecure.

apt-cache[edit]

When using virtual machines, Kicksecure could be configured to use the host apt-cache. Physically-isolated Kicksecure could use an apt-cache running on a separate machine. apt-cacher-ngarchive.org is an example implementation of such an apt-cache.

This configuration does not secure operating system updates by default over Tor, which is a big disadvantage. [8] It would be first necessary to determine how to configure apt-cacher-ng on the host to force downloads through Tor.

apt-offline[edit]

Another possibility is somehow using apt-offlinearchive.org to complete the initial updates of Kicksecure.

Building from Source Code using Current Sources[edit]

Self-created Kicksecure builds from source code use current sources, thereby solving this problem. Although frozen sources have been deprecated for reasons outlined in the Build documentation, using current sources comes with its own issues.

Footnotes[edit]

  1. https://www.debian.org/security/archive.org
  2. https://www.openwall.com/lists/kernel-hardening/archive.org
  3. https://github.com/GrapheneOS/linux-hardened/wikiarchive.org
  4. https://github.com/anthraxx/linux-hardenedarchive.org
  5. Such as Tor exit relays.
  6. https://thehackernews.com/2019/01/linux-apt-http-hacking.htmlarchive.org
  7. Forum discussionarchive.org.
  8. This leaks a list of installed packages to ISP-level adversaries and update servers. For example, if a user installed a webserver that is likely to be used to host a hidden web service, then this information would leak.

Unfinished: This wiki is a work in progress. Please do not report broken links until this notice is removed, use Search Engines First and contribute improving this wiki.

We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 12 year success story and maybe DONATE!