CVE-2023-45142

CVE-2023-45142 is a high-severity allocation of resources without limits or throttling vulnerability in go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (go), affecting versions < 0.44.0. It is fixed in 0.44.0.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

OpenTelemetry-Go Contrib vulnerable to denial of service in otelhttp due to unbound cardinality metrics

This handler wrapper https://github.com/open-telemetry/opentelemetry-go-contrib/blob/5f7e6ad5a49b45df45f61a1deb29d7f1158032df/instrumentation/net/http/otelhttp/handler.go#L63-L65
out of the box adds labels

  • http.user_agent
  • http.method

that have unbound cardinality. It leads to the server's potential memory exhaustion when many malicious requests are sent to it.

Details

HTTP header User-Agent or HTTP method for requests can be easily set by an attacker to be random and long. The library internally uses httpconv.ServerRequest that records every value for HTTP method and User-Agent.

PoC

Send many requests with long randomly generated HTTP methods or/and User agents (e.g. a million) and observe how memory consumption increases during it.

Others

It is similar to already reported vulnerabilities

Workaround for affected versions

As a workaround to stop being affected otelhttp.WithFilter() can be used, but it requires manual careful configuration to not log certain requests entirely.

For convenience and safe usage of this library, it should by default mark with the label unknown non-standard HTTP methods and User agents to show that such requests were made but do not increase cardinality. In case someone wants to stay with the current behavior, library API should allow to enable it.

The other possibility is to disable HTTP metrics instrumentation by passing otelhttp.WithMeterProvider option with noop.NewMeterProvider.

Solution provided by upgrading

In PR https://github.com/open-telemetry/opentelemetry-go-contrib/pull/4277, released with package version 0.44.0, the values collected for attribute http.request.method were changed to be restricted to a set of well-known values and other high cardinality attributes were removed.

References

Impact

In order to be affected, the program has to configure a metrics pipeline, use otelhttp.NewHandler wrapper, and does not filter any unknown HTTP methods or User agents on the level of CDN, LB, previous middleware, etc.

The application allocates resources such as memory, threads, or file descriptors based on untrusted input without enforcing a cap. Typical impact: resource exhaustion leading to denial of service.

CVE-2023-45142 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.44.0); upgrading removes the vulnerable code path.

Affected versions

go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (< 0.44.0) go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful (< 0.44.0) go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin (< 0.44.0) go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux (< 0.44.0) go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho (< 0.44.0) go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron (< 0.44.0) go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace (< 0.44.0)

Security releases

go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp → 0.44.0 (go) go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful → 0.44.0 (go) go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin → 0.44.0 (go) go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux → 0.44.0 (go) go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho → 0.44.0 (go) go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron → 0.44.0 (go) go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace → 0.44.0 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade the following packages to resolve this vulnerability:

go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp to 0.44.0 or later; go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful to 0.44.0 or later; go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin to 0.44.0 or later; go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux to 0.44.0 or later; go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho to 0.44.0 or later; go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron to 0.44.0 or later; go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace to 0.44.0 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2023-45142? CVE-2023-45142 is a high-severity allocation of resources without limits or throttling vulnerability in go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (go), affecting versions < 0.44.0. It is fixed in 0.44.0. The application allocates resources such as memory, threads, or file descriptors based on untrusted input without enforcing a cap.
  2. How severe is CVE-2023-45142? CVE-2023-45142 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which packages are affected by CVE-2023-45142?
    • go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (go) (versions < 0.44.0)
    • go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful (go) (versions < 0.44.0)
    • go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin (go) (versions < 0.44.0)
    • go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux (go) (versions < 0.44.0)
    • go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho (go) (versions < 0.44.0)
    • go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron (go) (versions < 0.44.0)
    • go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace (go) (versions < 0.44.0)
  4. Is there a fix for CVE-2023-45142? Yes. CVE-2023-45142 is fixed in 0.44.0. Upgrade to this version or later.
  5. Is CVE-2023-45142 exploitable, and should I be worried? Whether CVE-2023-45142 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2023-45142 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2023-45142?
    • Upgrade go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp to 0.44.0 or later
    • Upgrade go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful to 0.44.0 or later
    • Upgrade go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin to 0.44.0 or later
    • Upgrade go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux to 0.44.0 or later
    • Upgrade go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho to 0.44.0 or later
    • Upgrade go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron to 0.44.0 or later
    • Upgrade go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace to 0.44.0 or later

Other vulnerabilities in go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp

Stop the waste.
Protect your environment with Kodem.