Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increased kernel hardening at boot #111

Merged
merged 21 commits into from Jul 23, 2022
Merged

Increased kernel hardening at boot #111

merged 21 commits into from Jul 23, 2022

Conversation

raja-grewal
Copy link
Contributor

@raja-grewal raja-grewal commented Jul 12, 2022

Please refer to the existing discussion beginning at:
https://forums.whonix.org/t/kernel-hardening/7296/465

In summary:

  • Include mitigations by default against 2 additional known hardware-level CPU vulnerabilities (L1D Flushing and MMIO Stale Data).
  • Force the kernel to panic on "oopses"
  • Enforce IOMMU TLB invalidation
  • Distrust the bootloader as source of entropy
  • Enables randomisation of the kernel stack offset on syscall entries
  • Disables slub_debug due to kernel deciding to implicitly disable kernel pointer hashing
  • Explicitly highlight a few existing sysctl defaults

@@ -53,3 +53,6 @@ GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX extra_latent_entropy"
## https://lkml.org/lkml/2020/7/16/122
## https://github.com/torvalds/linux/blob/fb1201aececc59990b75ef59fca93ae4aa1e1444/Documentation/admin-guide/kernel-parameters.txt#L835-L848
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX debugfs=off"

## Force the kernel to panic on "oopses" (which may be due to false positives)
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX oops=panic"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this already implemented?
See:
/usr/libexec/security-misc/panic-on-oops

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True I am considering removing the existing implementation as I believe setting it the beginning of the boot process may be more secure?

This way we do not have to rely on the configuration files being read by a user space service.

https://github.com/torvalds/linux/blob/97e9c8eb4bb1dc57859acb1338dfddbd967d7484/Documentation/admin-guide/kernel-parameters.txt#L5681-L5688
https://madaidans-insecurities.github.io/guides/linux-hardening.html#sysctl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was a specific reason why it's done as currently implemented and not as kernel command line. That's a while ago since I last re-read this discussion:
https://forums.whonix.org/t/set-oops-panic-kernel-parameter-or-kernel-panic-on-oops-1-sysctl-for-better-security/7713

Could you have a look please?

@adrelanos adrelanos merged commit bfe6b88 into Kicksecure:master Jul 23, 2022
@raja-grewal raja-grewal deleted the harden branch July 25, 2022 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants