CVE-2023-32187: Github.com/k3s io/k3s Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-m4hf-6vgr-75r2
CVSS 7.5
CWE-770
Published
Advisory Summary

CVE-2023-32187 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Github.com/k3s io/k3s libraries in the Go ecosystem. The issue involves k3s apiserver port is vulnerable to unauthenticated remote denial-of-service (dos) attack via tls san stuffing attack. Remediation is available by upgrading affected packages to version 1.24.17, 1.25.13, 1.26.8, 1.27.5, 1.28.1.

CVE-2023-32187 at a Glance

CVE Identifier CVE-2023-32187
GHSA Identifier GHSA-m4hf-6vgr-75r2
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Github.com/k3s io/k3s
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2023-32187

To remediate this vulnerability, upgrade all affected Github.com/k3s io/k3s dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/k3s-io/k3s fixed: 1.24.17
Upgrade github.com/k3s-io/k3s to 1.24.17
github.com/k3s-io/k3s fixed: 1.25.13
Upgrade github.com/k3s-io/k3s to 1.25.13
github.com/k3s-io/k3s fixed: 1.26.8
Upgrade github.com/k3s-io/k3s to 1.26.8
github.com/k3s-io/k3s fixed: 1.27.5
Upgrade github.com/k3s-io/k3s to 1.27.5
github.com/k3s-io/k3s fixed: 1.28.1
Upgrade github.com/k3s-io/k3s to 1.28.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/k3s-io/k3s

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-32187, inspect your project dependencies for Github.com/k3s io/k3s:

inspect dependencies for github.com/k3s-io/k3s

Analyze the terminal output to locate any version of Github.com/k3s io/k3s in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.24.17), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Github.com/k3s io/k3s, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact An issue was found in K3s where an attacker with network access to K3s servers' apiserver/supervisor port (TCP 6443) can force the TLS server to add entries to the certificate's Subject Alternative Name (SAN) list, through a stuffing attack, until the certificate grows so large that it exceeds the maximum size allowed by TLS client implementations. OpenSSL for example will raise an `excessive message size` error when this occurs. No authentication is necessary to perform this attack, only the ability to perform a TLS handshake against the apiserver/supervisor port (TCP 6443). Affected servers will continue to operate, but clients (including both external administrative access with `kubectl` and server or agent nodes) will fail to establish new connections, thus leading to a denial of service (DoS) attack. ### Remediation Upgrade to a fixed release: - v1.28.1+k3s1 - v1.27.5+k3s1 - v1.26.8+k3s1 - v1.25.13+k3s1 - v1.24.17+k3s1 If you are using K3s 1.27 or earlier, you must also add the parameter `tls-san-security: true` to the K3s configuration to enable enhanced security for the supervisor's TLS SAN list. This option defaults to `true` starting with K3s 1.28. Note that this flag changes the behavior of K3s servers. You should ensure that you configure `node-external-ip` on servers that will be connected to via an external IP, and add `tls-san` entries for any load-balancers or VIP addresses that will be associated with the supervisor port. External IPs and load-balancer/VIP addresses will no longer be added to the supervisor certificate's SAN list unless explicitly configured. ### Mitigation If you cannot upgrade to a fixed release, the certificate can be "frozen" by running the following command against the cluster: ```shell kubectl annotate secret -n kube-system k3s-serving listener.cattle.io/static=true ``` **⚠️ IMPORTANT CAUTION:** Note that this mitigation will prevent the certificate from adding new SAN entries when servers join the cluster, and automatically renewing itself when it is about to expire. If you do this, you should delete the annotation when adding new servers to the cluster, or when the certificate is within 90 days of expiring, so that it can be updated. Once that is done, you can freeze it again. Affected certificates can be reset by performing the following steps: 1. Run `kubectl --server https://localhost:6444 delete secret -n kube-system k3s-serving` 2. Delete `/var/lib/rancher/k3s/server/tls/dynamic-cert.json` from all servers, and restart the `k3s` service. ### Background The K3s apiserver/supervisor listener on port TCP 6443 and uses the `rancher/dynamiclistener` library to dynamically generate TLS certificates that contain TLS Subject Alternative Names (SAN) for any host name or IP address requested by a client. This is done to allow servers and external load-balancers to be added to the cluster without the administrator having to explicitly know and configure in advance a fixed list of endpoints that the supervisor may be hosted at. The library allows the embedding application to configure a callback that is used to filter addresses requested by clients; but this was not previously implemented in K3s. ### For more information If you have any questions or comments about this advisory: - Reach out to the [K3s Security team](https://github.com/k3s-io/k3s/security/policy) for security related inquiries. - Open an issue in the [K3s](https://github.com/k3s-io/k3s/issues/new/choose) repository. - Verify with our [support matrix](https://www.suse.com/suse-k3s/support-matrix/all-supported-versions) and [product support lifecycle](https://www.suse.com/lifecycle/#k3s).

CVE-2023-32187 Affected Github.com/k3s io/k3s Versions

5 component(s)
Fixed Versions:
1.24.171.25.131.26.81.27.51.28.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/k3s-io/k3s
Go
< 1.24.17
1.24.17
github.com/k3s-io/k3s
Go
≥ 1.25.0
< 1.25.13
1.25.13
github.com/k3s-io/k3s
Go
≥ 1.26.0
< 1.26.8
1.26.8
github.com/k3s-io/k3s
Go
≥ 1.27.0
< 1.27.5
1.27.5
github.com/k3s-io/k3s
Go
≥ 1.28.0
< 1.28.1
1.28.1

References

Frequently Asked Questions

What is CVE-2023-32187?
CVE-2023-32187 is a security vulnerability in Github.com/k3s io/k3s involving K3s apiserver port is vulnerable to unauthenticated remote denial-of-service (DoS) attack via TLS SAN stuffing attack under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Github.com/k3s io/k3s versions are affected?
Affected versions include releases prior to 1.24.17, 1.25.13, 1.26.8, 1.27.5, 1.28.1 across affected packages: github.com/k3s-io/k3s.
What version fixes CVE-2023-32187?
Upgrading to 1.24.17, 1.25.13, 1.26.8, 1.27.5, 1.28.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/k3s-io/k3s affected?
Yes, github.com/k3s-io/k3s is affected in releases prior to 1.24.17, 1.25.13, 1.26.8, 1.27.5, 1.28.1. Upgrade your dependency to 1.24.17, 1.25.13, 1.26.8, 1.27.5, 1.28.1 or later.
What is the CVSS score of CVE-2023-32187?
CVE-2023-32187 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2023-32187?
CVE-2023-32187 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check Go dependencies for CVE-2023-32187?
Run the dependency tree command: 'inspect dependencies for github.com/k3s-io/k3s'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m4hf-6vgr-75r2",
  "modified" : "2023-09-20T21:09:28Z",
  "published" : "2023-09-11T13:47:08Z",
  "aliases" : [ "CVE-2023-32187" ],
  "summary" : "K3s apiserver port is vulnerable to unauthenticated remote denial-of-service (DoS) attack via TLS SAN stuffing attack",
  "details" : "### Impact\n\nAn issue was found in K3s where an attacker with network access to K3s servers' apiserver/supervisor port (TCP 6443) can force the TLS server to add entries to the certificate's Subject Alternative Name (SAN) list, through a stuffing attack, until the certificate grows so large that it exceeds the maximum size allowed by TLS client implementations. OpenSSL for example will raise an `excessive message size` error when this occurs. No authentication is necessary to perform this attack, only the ability to perform a TLS handshake against the apiserver/supervisor port (TCP 6443).\n\nAffected servers will continue to operate, but clients (including both external administrative access with `kubectl` and server or agent nodes) will fail to establish new connections, thus leading to a denial of service (DoS) attack.\n\n### Remediation\n\nUpgrade to a fixed release:\n\n- v1.28.1+k3s1\n- v1.27.5+k3s1\n- v1.26.8+k3s1\n- v1.25.13+k3s1\n- v1.24.17+k3s1\n\nIf you are using K3s 1.27 or earlier, you must also add  the parameter `tls-san-security: true` to the K3s configuration to enable enhanced security for the supervisor's TLS SAN list. This option defaults to `true` starting with K3s 1.28.\n\nNote that this flag changes the behavior of K3s servers. You should ensure that you configure `node-external-ip` on servers that will be connected to via an external IP, and add `tls-san` entries for any load-balancers or VIP addresses that will be associated with the supervisor port. External IPs and load-balancer/VIP addresses will no longer be added to the supervisor certificate's SAN list unless explicitly configured.\n\n### Mitigation\n\nIf you cannot upgrade to a fixed release, the certificate can be \"frozen\" by running the following command against the cluster:\n\n```shell\nkubectl annotate secret -n kube-system k3s-serving listener.cattle.io/static=true\n```\n\n**⚠️ IMPORTANT CAUTION:** Note that this mitigation will prevent the certificate from adding new SAN entries when servers join the cluster, and automatically renewing itself when it is about to expire. If you do this, you should delete the annotation when adding new servers to the cluster, or when the certificate is within 90 days of expiring, so that it can be updated. Once that is done, you can freeze it again.\n\nAffected certificates can be reset by performing the following steps:\n1. Run `kubectl --server https://localhost:6444 delete secret -n kube-system k3s-serving`\n2. Delete `/var/lib/rancher/k3s/server/tls/dynamic-cert.json` from all servers, and restart the `k3s` service.\n\n### Background\n\nThe K3s apiserver/supervisor listener on port TCP 6443 and uses the `rancher/dynamiclistener` library to dynamically generate TLS certificates that contain TLS Subject Alternative Names (SAN) for any host name or IP address requested by a client. This is done to allow servers and external load-balancers to be added to the cluster without the administrator having to explicitly know and configure in advance a fixed list of endpoints that the supervisor may be hosted at.\n\nThe library allows the embedding application to configure a callback that is used to filter addresses requested by clients; but this was not previously implemented in K3s.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n- Reach out to the [K3s Security team](https://github.com/k3s-io/k3s/security/policy) for security related inquiries.\n- Open an issue in the [K3s](https://github.com/k3s-io/k3s/issues/new/choose) repository.\n- Verify with our [support matrix](https://www.suse.com/suse-k3s/support-matrix/all-supported-versions) and [product support lifecycle](https://www.suse.com/lifecycle/#k3s).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/k3s-io/k3s"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.24.17"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/k3s-io/k3s"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.25.0"
      }, {
        "fixed" : "1.25.13"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/k3s-io/k3s"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.26.0"
      }, {
        "fixed" : "1.26.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/k3s-io/k3s"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.27.0"
      }, {
        "fixed" : "1.27.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/k3s-io/k3s"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.28.0"
      }, {
        "fixed" : "1.28.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/k3s-io/k3s/security/advisories/GHSA-m4hf-6vgr-75r2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-32187"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.suse.com/show_bug.cgi?id=CVE-2023-32187https:/"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/k3s-io/k3s"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-09-11T13:47:08Z",
    "nvd_published_at" : "2023-09-18T13:15:08Z"
  }
}