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

Add question about how kernel modules are signed #337

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

julian-klode
Copy link
Collaborator

@julian-klode julian-klode commented Jul 12, 2023

At least Debian is currently signing modules with the same key as the kernel, causing the kernel to be able to load modules not intended for it, potentially causing grave security issues. This is violating the security model, so let's make sure nobody does stuff like that anymore.

Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
@jsetje jsetje merged commit 1f85d85 into rhboot:main Jul 12, 2023
@steve-mcintyre steve-mcintyre added the meta Not a review request, but an issue or notice wrt the signing process label Sep 18, 2023
Copy link

@xnox xnox left a comment

Choose a reason for hiding this comment

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

I disagree with premise and wording of this requirement, as it does not at all address correctly the concern raised.

*******************************************************************************
### Do you use an ephemeral key for signing kernel modules?
### If not, please describe how you ensure that one kernel build does not load modules built for another kernel.
*******************************************************************************
Copy link

Choose a reason for hiding this comment

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

I disagree with this requirement.

Ubuntu does not only use ephemeral key for signing kernel modules. And it by default trusts: ephemeral build-time, 3rd-party driver signing key, Livepatch signing key, and MOK signing keys.

In practice MOK signing key is always the same for all kernels.

Which key is used and trusted, and whether it is chained to CA is not at all interesting.

Instead the following rules should be followed instead

  1. Ensure unique modversions are set for each distinct kernel build https://www.kernel.org/doc/html/latest/admin-guide/module-signing.html#administering-protecting-the-private-key
  2. Ensure that lockdown=integrity by default prohibits bypassing --force-vermagic

This is easily checked by comparing two distinct abi builds, running modinfo on the modules from both and checking that vermagic is different.

Note that there are additional abi checks that prevent modules loading from incompatible builds of kernel on top of that (but those use non-cryptographically secure CRC).

I request to revert this requirement, as it is crafted without full consideration of existing keys in use for existing secureboot signed keys in all kernels from all vendors, which today all use the same key for different abis and already prevent ability to load a kernel module from one kernel abi on the other abi. If that is incorrect for any vendor, it must be resolved by correctly bumping EXTRAVERSION/LOCALVERSION in every published build.

Also we should ensure all certificates used for kernel module signing, have the extension set that such certs are for module signing only.

Copy link

Choose a reason for hiding this comment

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

cc: @jsetje @steve-mcintyre i disagree with this wording being merged, without reviews or approvals from at least 2 different kernel maintainers. and the proposer of this change is not a kernel maintainer themselves.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe modversions is the wrong thing, because CONFIG_MODVERSIONS is the CRC mechanism, you want to ensure each kernel build has a separate EXTRAVERSION or CONFIG_LOCALVERSION.

I'm wary of allowing people to reuse kernel ABIs because they think it is still the same, they can't really proof it or have the tooling, hence generally guiding them to something that works is what I'm looking for.

Copy link
Collaborator

@dennis-tseng99 dennis-tseng99 Nov 5, 2023

Choose a reason for hiding this comment

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

I'm concerned about the memory life or size of server. Instead of using Canonical key, for each Livepatch operation, MOK needs to add into or erase from the database of keys, which might reduce the usage life of NVRAM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Not a review request, but an issue or notice wrt the signing process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants