Securing the Linux kernel with lockdown mode

Additional Safeguards

If you want to use lockdown mode, you need to monitor a few additional factors when operating your environment. After all, lockdown and any other security feature will not help if an attacker can disable them without being noticed.

Lockdown mode cannot prevent every possible security issue – for example, an admin can change certain files on the system. It is possible that a bad guy could quickly reconfigure GRUB to prevent lockdown mode from being activated in the first place.

Regular Checks

Discovering whether lockdown mode is still active is most easily done at the command line. During monitoring, you will want to check whether the lockdown parameter is defined in the /proc/cmdline file and whether it has a value of confidentiality or integrity. The LSM lockdown module also needs to appear in the kernel command line, otherwise the lockdown parameter has no effect.

Even without a lockdown mode in the kernel, all the alarms should go off if a system reboots unexpectedly. Most of the time, a sudden reboot is due to a broken hardware device or driver. But you need clarity about the root cause quickly. The problem could also be an attacker rebooting the system after changing the boot loader configuration. For this reason, I would recommend monitoring a few additional files of system config for example, /boot/grub/grub.cfg.

Do Not Feel Too Secure

Every admin should also be clear that absolute security does not exist. State-financed hackers usually spare no effort and are therefore capable of carrying out highly complex attacks. In fact, an attacker could simply overwrite the boot loader and use their own configuration file so that the grub.cfg stored on the system is not changed. You would only find out about this by checking if the currently running kernel is the one delivered by the manufacturer. If you want to secure your system against such attacks, you have a great deal of work to do. Lockdown mode in the Linux kernel is certainly not a carte blanche that lets you put your feet up and stop worrying about security.

This raises the question as to whether there are also things that Linux kernel lockdown mode does not protect systems against. The answer to this question is a resounding yes.

For example, lockdown does nothing at all to protect you against hardware-related errors. Prominent examples of hardware-based security flaws include the Spectre and Meltdown attacks that caused alarm throughout the Linux community a couple years ago. Although Spectre and Meltdown are now rendered harmless by other kernel workarounds, lockdown mode would not have been able to offer any protection against these bugs.

Similarly, the Linux kernel itself has unnoticed bugs that bypass lockdown mode. This was the case in June 2020, for example, when a bug in the ACPI code allowed kernel code to be smuggled past the UEFI Secure boot interface – and also past the lockdown module.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Linus Torvalds Agrees to Kernel Lockdown

    The feature will let developers restrict root access to the kernel.

  • News

    In the news: The Art of PostgreSQL; Red Hat Announces CentOS Stream; Linus Torvalds Agrees to Kernel Lockdown; Richard Stallman Resigns from Free Software Foundation; Oracle Announces Autonomous Linux; Attackers Find a New Way to Install Cryptominers; and GitLab 12.3 Brings More Security to DevOps Engineers.

  • Linux Kernel 5.4 Released

    A number of new changes and improvements have reached the Linux kernel.

  • Kernel News

    New NDS32 port, landlock versus seccomp, new features from Intel, loading and unloading security modules after bootup, and splitting up security projects.

  • Kernel News

    Zack discusses removing dead ports, new minimum GCC version jumping from 3.2 to 4.8, Intel considering hardware changes to mitigate security flaws, enhancing asymmetric process migration, and protecting user's system control. 

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More