Kyverno

https://kyverno.io/docs/security/arrow-up-right

Kyverno serves an admission controller and is a critical component of the Kubernetes control plane. It is important to properly secure and monitor Kyverno. This section provides guidance on securing Kyverno and the security processes for the Kyverno project.

Disclosure Process

Security vulnerabilities are best handled swiftly and discretely with the goal of minimizing the total time users remain vulnerable to exploits.

If you find or suspect a vulnerability, please email the security group at [email protected]envelope with the following information:

  • description of the problem

  • precise and detailed steps (include screenshots) that created the problem

  • the affected version(s)

  • any known mitigations

The Kyverno security response team will send an initial acknowledgement of the disclosure in 3-5 working days. Once the vulnerability and mitigation are confirmed, the team will plan to release any necessary changes based on the severity and complexity. Additional details on the security policy and processes are available in the Kyverno git repoarrow-up-right.

Contact Us

To communicate with the Kyverno team, for any questions or discussions, use Slackarrow-up-right or GitHubarrow-up-right.

Issues

All security related issues are labeled as security and can be viewed herearrow-up-right.

Release Artifacts

The Kyverno container images are available herearrow-up-right.

With each release, the following artifacts are uploaded:

  • checksums.txt

  • install.yaml

  • kyverno-cli-<version_number>.tar.gz

  • kyverno-cli_v<version_number>_darwin_arm64.tar.gz

  • kyverno-cli_v<version_number>_darwin_x86_64.tar.gz

  • kyverno-cli_v<version_number>_linux_arm64.tar.gz

  • kyverno-cli_v<version_number>_linux_s390x.tar.gz

  • kyverno-cli_v<version_number>_linux_x86_64.tar.gz

  • kyverno-cli_v<version_number>_windows_arm64.zip

  • kyverno-cli_v<version_number>_windows_x86_64.zip

  • Source code (zip)

  • Source code (tar.gz)

Verifying Kyverno Container Images

Kyverno container images are signed using Cosign and the keyless signing featurearrow-up-right. The signatures are stored in a separate repository from the container image they reference located at ghcr.io/kyverno/signatures. To verify the container image using Cosign v1.x, follow the steps below.

  1. Configure the Kyverno signature repository:

bash

  1. Verify the image:

bash

For Cosign v2.x, use the following command instead.

If the container image was properly signed, the output should be similar to:

Note that the important fields to verify in the output are optional.Issuer and optional.Subject. If Issuer and Subject do not match the values shown above, the image is not genuine.

All Kyverno images can be verified.

Verifying Provenance

Kyverno creates and attests to the provenance of its builds using the SLSA standardarrow-up-right and meets the SLSA Level 3arrow-up-right specification. The attested provenance may be verified using the cosign tool.

For v1.x of Cosign, use the following command.

For v2.x of Cosign, use the following command.

The output will look something similar to the below.

Fetching the SBOM for Kyverno

An SBOM (Software Bill of Materials) in CycloneDXarrow-up-right JSON format is published for each Kyverno release, including pre-releases. Like signatures, SBOMs are stored in a separate repository at ghcr.io/kyverno/sbom. To download and verify the SBOM for a specific version, install Cosign and run:

To save the SBOM to a file, run the following command:

Security Scorecard

Kyverno uses Scorecards by OSSFarrow-up-right to maintain repository-wide security standards. The current OSSF/scorecard score for Kyverno can be found in this tracker issuearrow-up-right. The Kyverno team is committed to achieving and maintaining a high score. Contributions are welcome.

Vulnerability Scan Reports

The Kyverno Helm Chart is available via the Artifact Hub pagearrow-up-right along with an auto-generated Security Reportarrow-up-right generated by Artifact Hub for all the releases.

Security Best Practices

The following sections discuss related best practices for Kyverno:

Pod security

Kyverno Pods are configured to follow security best practices and conform to the Pod Security Standardsarrow-up-right restricted profile:

  • runAsNonRoot is set to true

  • privileged is set to false

  • allowPrivilegeEscalation is set to false

  • readOnlyRootFilesystem is set to true

  • all capabilities are dropped

  • limits and quotas are configured

  • liveness and readiness probes are configured

RBAC

The Kyverno RBAC configurations are described in the installationarrow-up-right section.

Use the following command to view all Kyverno roles:

Networking

Kyverno network traffic is encrypted and should be restricted using NetworkPolicies or similar constructs.

By default, a Kyverno installation does not configure NetworkPolicies (see this issuearrow-up-right). The Kyverno Helm chartarrow-up-right has a networkPolicy.enabled option to enable a NetworkPolicy.

Kyverno requires the following network communications to be allowed:

Webhooks

Use the following command to view all Kyverno Roles:

Kyverno creates the following mutating webhook configurations:

  • kyverno-policy-mutating-webhook-cfg: handles policy changes to index and cache policy sets.

  • kyverno-resource-mutating-webhook-cfg: handles resource admission requests to apply matching Kyverno mutate policy rules.

  • kyverno-verify-mutating-webhook-cfg: periodically tests Kyverno webhook configurations

Kyverno creates the following validating webhook configurations:

  • kyverno-policy-validating-webhook-cfg: validates Kyverno policies with checks that cannot be performed via schema validation

  • kyverno-resource-validating-webhook-cfg: handles resource resource admission requests to apply matching Kyverno validate policy rules.

  • kyverno-cleanup-validating-webhook-cfg: handles cleanup policies

  • kyverno-exception-validating-webhook-cfg: handles policy exceptions

Webhook Failure Mode

Kyverno policies are configured to fail-closed by default. This setting can be tuned on a per policy basisarrow-up-right. Kyverno uses the configured policy set to automatically configure webhooks.

Webhook authentication and encryption

By default, Kyverno automatically generates and manage TLS certificates used for authentication with the API server and encryption of network traffic. To use a custom CA, please refer to the details in the installation sectionarrow-up-right.

The Kyverno community manages a set of sample policiesarrow-up-right.

At a minimum, the Pod Security Standardsarrow-up-right and best practicesarrow-up-right policy sets are recommended for use.

Securing policies

Kyverno policies can be used to mutate and generate namespaced and cluster-wide resources. Hence, policies should be treated as critical resources and access to policies should be protected using RBAC.

Threat Model

The Kubernetes SIG Securityarrow-up-right team has defined an Admission Control Threat Modelarrow-up-right. It is highly recommended that Kyverno administrators read and understand the threat model, and use it as a starting point to create their own threat model.

The sections below list each threat, mitigation, and provide Kyverno specific details.

Threat ID 1 - Attacker floods webhook with traffic preventing its operations

Threat Model Linkarrow-up-right

Mitigation:

Threat ID 2 - Attacker passes workloads which require complex processing causing timeouts

Threat Model Linkarrow-up-right

Mitigations:

Threat ID 3 - Attacker exploits misconfiguration of webhook to bypass

Threat Model Linkarrow-up-right

Mitigation:

Threat ID 4 - Attacker has rights to delete or modify the Kubernetes webhook object

Threat Model Linkarrow-up-right

Mitigation:

Threat ID 5 - Attacker gets access to valid credentials for the webhook

Threat Model Linkarrow-up-right

Mitigation:

Threat ID 6 - Attacker gains access to a cluster admin credential

Threat Model Linkarrow-up-right

Mitigation

N/A

Threat ID 7 - Attacker sniffs traffic on the container network

Threat Model Linkarrow-up-right

Mitigation

Threat ID 8 - Attacker carries out a MITM attack on the webhook

Threat Model Linkarrow-up-right

Mitigation

Threat ID 9 - Attacker steals traffic from the webhook via spoofing

Threat Model Linkarrow-up-right

Mitigation

Threat ID 10 - Abusing a mutation rule to create a privileged container

Threat Model Linkarrow-up-right

Mitigation

Threat ID 11 - Attacker deploys workloads to namespaces that are exempt from admission control

Threat Model Linkarrow-up-right

Mitigation

Threat ID 12 - Block rule can be bypassed due to missing match (e.g. missing initContainers)

Threat Model Linkarrow-up-right

Mitigation

Threat ID 13 - Attacker exploits bad string matching on a blocklist to bypass rules

Threat Model Linkarrow-up-right

Mitigation

Threat ID 14 - Attacker uses new/old features of the Kubernetes API which have no rules

Threat Model Linkarrow-up-right

Mitigation

Threat ID 15 - Attacker deploys privileged container to node running Webhook controller

Threat Model Linkarrow-up-right

Mitigation

Threat ID 16 - Attacker mounts a privileged node hostPath allowing modification of Webhook controller configuration

Threat Model Linkarrow-up-right

Mitigation

Threat ID 17 - Attacker has privileged SSH access to cluster node running admission webhook

Threat Model Linkarrow-up-right

Mitigation

N/A

Threat ID 18 - Attacker uses policies to send confidential data from admission requests to external systems

Threat Model Linkarrow-up-right

Mitigation

Last updated