CVE-2022-21698 Uncontrolled Resource Consumption in promhttp

High 7.5 Published Updated

Attackers can cause memory exhaustion and denial of service in Go applications using promhttp middleware by sending requests with non-standard HTTP methods.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-21698?

CVE-2022-21698 is a high-severity denial of service vulnerability in Fedoraproject Extra Packages for Enterprise Linux, published on 15 Feb 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

client_golang is the instrumentation library for Go applications in Prometheus, and the promhttp package in client_golang provides tooling around HTTP servers and clients. In client_golang prior to version 1.11.1, HTTP server is susceptible to a Denial of Service through unbounded cardinality, and potential memory exhaustion, when handling requests with non-standard HTTP methods. In order to be affected, an instrumented software must use any of `promhttp.InstrumentHandler*` middleware except `RequestsInFlight`; not filter any specific methods (e.g GET) before middleware; pass metric with `method` label name to our middleware; and not have any firewall/LB/proxy that filters away requests with unknown `method`. client_golang version 1.11.1 contains a patch for this issue. Several workarounds are available, including removing the `method` label name from counter/gauge used in the InstrumentHandler; turning off affected promhttp handlers; adding custom middleware before promhttp handler that will sanitize the request method given by Go http.Request; and using a reverse proxy or web application firewall, configured to only allow a limited set of methods.

Weakness: CWE-770, CWE-400

Which versions are affected by CVE-2022-21698?

3 open source packages ship an affected version, including github.com/prometheus/client_golang. It affects 4 products.

PackageAffectedFixed in
github.com/prometheus/client_golang GoAll versions1.11.1
github.com/prometheus/client_golang GoAll versions1.11.1
github.com/prometheus/client_golang GoAll versions1.11.1
Linux distribution packages (37)
kubevirt Red Hat:container_native_virtualization:4.10::el7All versions0:4.10.1-489.el7
kubevirt-virtctl Red Hat:container_native_virtualization:4.10::el7All versions0:4.10.1-489.el7
kubevirt-virtctl-redistributable Red Hat:container_native_virtualization:4.10::el7All versions0:4.10.1-489.el7
kubevirt Red Hat:container_native_virtualization:4.10::el8All versions0:4.10.1-489.el8
kubevirt-virtctl Red Hat:container_native_virtualization:4.10::el8All versions0:4.10.1-489.el8
kubevirt-virtctl-redistributable Red Hat:container_native_virtualization:4.10::el8All versions0:4.10.1-489.el8
golang-github-prometheus-alertmanager SUSE:Enterprise Storage 6All versions0.23.0-150100.4.7.1
golang-github-prometheus-node_exporter SUSE:Enterprise Storage 6All versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Enterprise Storage 6All versions1.3.0-150100.3.18.1
golang-github-prometheus-prometheus SUSE:Enterprise Storage 6All versions2.32.1-150100.4.9.2
golang-github-prometheus-node_exporter SUSE:Enterprise Storage 7All versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Enterprise Storage 7All versions1.3.0-150100.3.18.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOSAll versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOSAll versions1.3.0-150100.3.18.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSSAll versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSSAll versions1.3.0-150100.3.18.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOSAll versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOSAll versions1.3.0-150100.3.18.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions1.3.0-150100.3.18.1
golang-github-vpenso-prometheus_slurm_exporter SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOSAll versions0.20-150300.3.11.2
golang-github-vpenso-prometheus_slurm_exporter SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSSAll versions0.20-150300.3.11.2
golang-github-vpenso-prometheus_slurm_exporter SUSE:Linux Enterprise High Performance Computing 15 SP5-ESPOSAll versions0.20-150300.3.11.2
golang-github-vpenso-prometheus_slurm_exporter SUSE:Linux Enterprise High Performance Computing 15 SP5-LTSSAll versions0.20-150300.3.11.2
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15-ESPOSAll versions1.3.0-150000.3.12.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise High Performance Computing 15-LTSSAll versions1.3.0-150000.3.12.1
firewalld SUSE:Linux Enterprise Micro 5.1All versions0.9.3-150300.3.6.1
firewalld SUSE:Linux Enterprise Micro 5.2All versions0.9.3-150300.3.6.1
firewalld SUSE:Linux Enterprise Module for Basesystem 15 SP3All versions0.9.3-150300.3.6.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise Module for Basesystem 15 SP3All versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise Module for Basesystem 15 SP3All versions1.3.0-150100.3.18.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise Module for Basesystem 15 SP4All versions1.3.0-150100.3.12.1
golang-github-prometheus-node_exporter SUSE:Linux Enterprise Module for Basesystem 15 SP4All versions1.3.0-150100.3.18.1
firewalld SUSE:Linux Enterprise Module for Desktop Applications 15 SP3All versions0.9.3-150300.3.6.1
golang-github-vpenso-prometheus_slurm_exporter SUSE:Linux Enterprise Module for HPC 15 SP7All versions0.20-150300.3.11.2
golang-github-vpenso-prometheus_slurm_exporter SUSE:Linux Enterprise Module for Package Hub 15 SP7All versions0.20-150300.3.11.2
golang-github-prometheus-node_exporter SUSE:Linux Enterprise Server 15 SP1-BCLAll versions1.3.0-150100.3.12.1

Products include Fedoraproject Extra Packages for Enterprise Linux, Fedoraproject Fedora, Prometheus Client Golang, Rdo Project Rdo.

How do I fix CVE-2022-21698?

Upgrade github.com/prometheus/client_golang to 1.11.1 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2022-21698 being exploited?

There is no known exploitation of CVE-2022-21698 in the wild and no public exploit code.

All Fedoraproject Extra Packages for Enterprise Linux vulnerabilities

Sources

Also known as AZL-31981, AZL-33567, AZL-33603, AZL-33611, AZL-33614, AZL-33618 and 45 more.

Is CVE-2022-21698 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free