CVE-2022-21698: Uncontrolled Resource Consumption in promhttp

Published Jan 25, 2022
·
Updated

A denial of service attack was found in prometheus/clientgolang. This flaw allows an attacker to produce a denial of service attack on an HTTP server by exploiting the InstrumentHandlerCounter function in the version below 1.11.1, resulting in a loss of availability.

Other sources

A malicious actor can in theory kill / DOS a server in Go instrumented using prometheus/clientgolang InstrumentHandlerCounter in the version below 1.11.1.

InstrumentHandlerCounter function code: https://github.com/prometheus/clientgolang/blob/22da9497b8f0d53072dfc4721904faa7395d8318/prometheus/promhttp/instrumentserver.go#L95

Security advisory: https://github.com/prometheus/clientgolang/security/advisories/GHSA-cg3q-j54f-5p7p

Upstream fix: https://github.com/prometheus/clientgolang/commit/9075cdf61646b5adf54d3ba77a0e4f6c65cb4fd7 [main] https://github.com/prometheus/clientgolang/commit/989baa30fe956631907493ccee1f8e7708660d96 [release-1.11]

— Red Hat

clientgolang is the instrumentation library for Go applications in Prometheus, and the promhttp package in clientgolang provides tooling around HTTP servers and clients. In clientgolang 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. clientgolang 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.

This is the Go client library for Prometheus. It has two separate parts, one for instrumenting application code, and one for creating clients that talk to the Prometheus HTTP API. clientgolang is the instrumentation library for Go applications in Prometheus, and the promhttp package in clientgolang provides tooling around HTTP servers and clients.

Impact

HTTP server susceptible to a Denial of Service through unbounded cardinality, and potential memory exhaustion, when handling requests with non-standard HTTP methods.

Affected Configuration

In order to be affected, an instrumented software must

Use any of promhttp.InstrumentHandler middleware except RequestsInFlight. Do not filter any specific methods (e.g GET) before middleware. Pass metric with method label name to our middleware. Not have any firewall/LB/proxy that filters away requests with unknown method.

Patches

https://github.com/prometheus/clientgolang/pull/962 https://github.com/prometheus/clientgolang/pull/987

Workarounds

If you cannot upgrade to v1.11.1 or above, in order to stop being affected you can:

Remove method label name from counter/gauge you use in the InstrumentHandler. Turn off affected promhttp handlers. Add custom middleware before promhttp handler that will sanitize the request method given by Go http.Request. Use a reverse proxy or web application firewall, configured to only allow a limited set of methods.

For more information

If you have any questions or comments about this advisory:

Open an issue in https://github.com/prometheus/clientgolang Email us at prometheus-team@googlegroups.com

— GitHub

Uncontrolled Resource Consumption in promhttp

— Microsoft

Affected Software

50 affected componentsFixes available
redhat/openshift-serverless-clients<0:1.3.1-4.el8
0:1.3.1-4.el8
redhat/grafana<0:7.5.15-3.el8
0:7.5.15-3.el8
redhat/grafana<0:7.5.15-3.el9
0:7.5.15-3.el9
redhat/atomic-openshift-dockerregistry<0:3.11.705-1.g0fa231c.el7
0:3.11.705-1.g0fa231c.el7
redhat/buildah<1:1.23.4-2.el8
1:1.23.4-2.el8
redhat/openshift-clients<0:4.11.0-202207291716.p0.g7075089.assembly.stream.el8
0:4.11.0-202207291716.p0.g7075089.assembly.stream.el8
redhat/etcd<0:3.3.23-10.el8
0:3.3.23-10.el8
redhat/kubevirt<0:4.10.1-489.el7
0:4.10.1-489.el7
redhat/kubevirt<0:4.10.1-489.el8
0:4.10.1-489.el8
Prometheus Client Golang Go<1.11.1
Fedoraproject Fedora=34
Fedoraproject Fedora=35
Fedoraproject Fedora=36
Fedoraproject Extra Packages For Enterprise Linux=7.0
Fedoraproject Extra Packages For Enterprise Linux=8.0
Rdo Project Rdo
Fedoraproject Fedora=37
Microsoft cbl2 application-gateway-kubernetes-ingress 1.4.0-25
Microsoft azl3 moby-engine 20.10.25-3
Microsoft cbl2 moby-engine 20.10.27-4
Microsoft cbl2 cri-o 1.22.3-14
Microsoft azl3 node-problem-detector 0.8.10-18
Microsoft azl3 keda 2.4.0-15
Microsoft azl3 prometheus-process-exporter 0.7.10-15
Microsoft cbl2 prometheus-node-exporter 1.3.1-26
Microsoft azl3 multus 3.8-13
Microsoft cbl2 rook 1.6.2-26
Microsoft cbl2 node-problem-detector 0.8.10-20
Microsoft cbl2 kube-vip-cloud-provider 0.0.2-22
Microsoft azl3 application-gateway-kubernetes-ingress 1.7.2-2
Microsoft cbl2 local-path-provisioner 0.0.21-18
Microsoft azl3 application-gateway-kubernetes-ingress 1.7.2-3
Microsoft cbl2 moby-cli 20.10.27-5
Microsoft cbl2 moby-engine 20.10.27-4
Microsoft cbl2 nmi 1.8.7-15
Microsoft azl3 keda 2.14.0-1
Microsoft azl3 moby-engine 25.0.3-1
Microsoft azl3 multus 4.0.2-1
Microsoft azl3 node-problem-detector 0.8.15-1
Microsoft cbl2 moby-buildx 0.7.1-24
Microsoft azl3 prometheus-process-exporter 0.8.2-1
Microsoft cbl2 prometheus-process-exporter 0.7.10-21
Microsoft cbl2 application-gateway-kubernetes-ingress 1.4.0-25
redhat/prometheus/client_golang<1.11.1
1.11.1
go/github.com/prometheus/client_golang<1.11.1
1.11.1
debian/golang-github-prometheus-client-golang<1.11.1-1
1.11.1-1
debian/golang-github-prometheus-client-golang<1.11.1-1
1.11.1-1
debian/golang-github-prometheus-client-golang<1.11.1-1
1.11.1-1
debian/golang-github-prometheus-client-golang
1.14.0-31.21.1-11.23.2-5
alpine/buildah<1.23.4-r0
1.23.4-r0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/openshift-serverless-clients to a version that resolves this vulnerability.

    Fixed in 0:1.3.1-4.el8
  2. Upgrade

    Upgrade redhat/grafana to a version that resolves this vulnerability.

    Fixed in 0:7.5.15-3.el8
  3. Upgrade

    Upgrade redhat/grafana to a version that resolves this vulnerability.

    Fixed in 0:7.5.15-3.el9
  4. Upgrade

    Upgrade redhat/atomic-openshift-dockerregistry to a version that resolves this vulnerability.

    Fixed in 0:3.11.705-1.g0fa231c.el7
  5. Upgrade

    Upgrade redhat/buildah to a version that resolves this vulnerability.

    Fixed in 1:1.23.4-2.el8
  6. Upgrade

    Upgrade redhat/openshift-clients to a version that resolves this vulnerability.

    Fixed in 0:4.11.0-202207291716.p0.g7075089.assembly.stream.el8
  7. Upgrade

    Upgrade redhat/etcd to a version that resolves this vulnerability.

    Fixed in 0:3.3.23-10.el8
  8. Upgrade

    Upgrade redhat/kubevirt to a version that resolves this vulnerability.

    Fixed in 0:4.10.1-489.el7
  9. Upgrade

    Upgrade redhat/kubevirt to a version that resolves this vulnerability.

    Fixed in 0:4.10.1-489.el8
  10. Upgrade

    Upgrade redhat/prometheus/client_golang to a version that resolves this vulnerability.

    Fixed in 1.11.1
  11. Upgrade

    Upgrade go/github.com/prometheus/client_golang to a version that resolves this vulnerability.

    Fixed in 1.11.1
  12. Upgrade

    Upgrade debian/golang-github-prometheus-client-golang to a version that resolves this vulnerability.

    Fixed in 1.14.0-3Fixed in 1.21.1-1Fixed in 1.23.2-5
  13. Upgrade

    Upgrade alpine/buildah to a version that resolves this vulnerability.

    Fixed in 1.23.4-r0
  14. Upgrade

    Upgrade debian/golang-github-prometheus-client-golang to a version that resolves this vulnerability.

    Fixed in 1.11.1-1
  15. Upgrade

    Upgrade prometheus/client_golang to a version that resolves this vulnerability.

    Fixed in 1.11.1
  16. Configuration

    Remove the method label name from the counter or gauge used in InstrumentHandler.

    prometheus/client_golang promhttp instrumentation method label = removed
  17. Configuration

    Turn off the affected promhttp handlers.

    prometheus promhttp handlers affected promhttp handlers = disabled
  18. Compensating control

    Add custom middleware before the promhttp handler to sanitize the request method supplied by Go http.Request.

  19. Compensating control

    Use a reverse proxy or web application firewall configured to allow only a limited set of HTTP methods.

Event History

Jan 25, 2022
Data Sourced
via Red Hat·08:36 PM
DescriptionSeverityAffected Software
Feb 15, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·04:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·04:15 PM
DescriptionSeverityAffected Software
Feb 16, 2022
Advisory Published
via GitHub·10:26 PM
Data Sourced
via GitHub·10:26 PM
DescriptionSeverityWeaknessAffected Software
Nov 8, 2023
Data Sourced
via Microsoft·08:00 AM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the vulnerability ID?

The vulnerability ID is CVE-2022-21698.

2

What is the severity of CVE-2022-21698?

The severity of CVE-2022-21698 is high, with a severity value of 7.5.

3

What is the affected software?

The affected software includes Prometheus Client Golang version up to 1.11.1, Fedoraproject Fedora versions 34-37, Fedoraproject Extra Packages For Enterprise Linux versions 7.0 and 8.0, and Rdo Project Rdo.

4

How does CVE-2022-21698 affect the Prometheus client library for Go?

CVE-2022-21698 is a denial of service attack vulnerability in the prometheus/client_golang library for Go applications.

5

How do I fix CVE-2022-21698?

To fix CVE-2022-21698, it is recommended to upgrade to a fixed version of Prometheus Client Golang or to apply the relevant security patches provided by the software vendor.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203