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

Security improvements to Keylime #854

Merged
merged 26 commits into from Jan 27, 2022
Merged

Conversation

THS-on
Copy link
Member

@THS-on THS-on commented Jan 27, 2022

This PR contains fixes for the following issues:

  • malicious reset or replay of U and V encryption
  • Secure mount logic can leak sensitive data
  • Unsanitized UUIDs can lead to log spoofing
  • Revocation Notifier's UNIX unprivileged domain socket which can allow DOS
  • Quote responses subject to Zip bomb attacks

The Keylime API version is increased to v2.0 and the agent now requires a Keylime CA certificate (which is by default the cv_ca) to validate connections from the verifier and tenant.

6.3 will be the only new version that still supports API v1.0.

Thanks to @mgerstner, @aplanas, @maugustosilva, @mpeters and @THS-on for finding, developing and/or testing those changes.

THS-on and others added 26 commits January 27, 2022 15:55
For most certificates we do not care about the hostname

Signed-off-by: Thore Sommer <mail@thson.de>
SSLContext in Python only takes a file path, so we dump the certificate
into a temporary file before using it.

Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
All connections to the agent require a mTLS connection using the
Keylime CA deployed on the agent.

Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
This is done in order to allow upgrading the server side first.
The next minor version will drop support for it.

Signed-off-by: Thore Sommer <mail@thson.de>
This returns now the version supported by the agent.

Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
Signed-off-by: Thore Sommer <mail@thson.de>
This allows the verifier to start the attestation of an agent again after
a restart of the verifier without connecting the the registrar first.

Signed-off-by: Thore Sommer <mail@thson.de>
Pythons zlib decompression has no mitigations against zip bombs or similar
attacks, so we remove the compression for the quote data.

The data itself is rather small compared to the IMA or UEFI event log.

Signed-off-by: Thore Sommer <mail@thson.de>
Keylime will drop support for 1.0 after the initial upgrade to 2.0

Changes from 1.0:
 - mTLS authentication against the agent is now required.
 - The verifier API now has the field supported_version for indicating which
   API version the agent supports. This API version is then used for the
   communication between the verifier and the agent.
 - Agents are expected to implemented a /version API endpoint to allow other
   components to querry supported API versions.
 - Quote data is no longer compressed.

Signed-off-by: Thore Sommer <mail@thson.de>
Currently we are placing the zmq IPC socket in /tmp, that can be
accessed by all the users.

This patch moves the socket into /var/run/keylime, making sure that the
directory is created and present with the correct user permissions.

Signed-off-by: Alberto Planas <aplanas@suse.com>
Move from the config module some validators, and create the validators
module.  Add tests for them.

Signed-off-by: Alberto Planas <aplanas@suse.com>
Add valid_uuid and valid_agent_id validators, and tests for both.

Signed-off-by: Alberto Planas <aplanas@suse.com>
The user ID is read from the config file, or from some public REST API.
We should validate that is composed with valid set of chars.

Signed-off-by: Alberto Planas <aplanas@suse.com>
The function `check_mounted()` is parsing the output of the `mount`
command.  This command can have an unknown number of spaces, that can
break the parsing logic (and produces security issues)

This commit take the mount information data from `/proc/self/mountinfo`,
that is more friendly parsed as it will escape the spaces.

Signed-off-by: Alberto Planas <aplanas@suse.com>
The `mount` function is called several times in different places in the
code, but it takes care of not mounting the secure directory if is
already present.  The problem is that this is never umounted.

This patch add the `umount` function, and update the `mount` one to
track when a mount point needs to be umounted.

Also adjust the keylime_agent exit point to make sure that the `umount`
function is called at the end.

Signed-off-by: Alberto Planas <aplanas@suse.com>
@mpeters mpeters merged commit d37c406 into keylime:master Jan 27, 2022
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

3 participants