opentelemetry-instrumentation Denial of Service vulnerability due to unbound cardinality metrics
High severity
GitHub Reviewed
Published
Oct 2, 2023
in
open-telemetry/opentelemetry-python-contrib
•
Updated Nov 10, 2023
Description
Published to the GitHub Advisory Database
Oct 2, 2023
Reviewed
Oct 2, 2023
Published by the National Vulnerability Database
Oct 6, 2023
Last updated
Nov 10, 2023
Summary
Autoinstrumentation out of the box adds the label
http_method
that has unbound cardinality. It leads to the server's potential memory exhaustion when many malicious requests are sent.Details
HTTP method for requests can be easily set by an attacker to be random and long.
PoC
Send many requests with long randomly generated HTTP methods and observe how memory consumption increases during it. The app can be like this example from the official docs.
Impact
In order to be affected program has to be instrumented for HTTP handlers and does not filter any unknown HTTP methods on the level of CDN, LB, previous middleware, etc.
Proposed solution
For convenience and safe usage of this library, it should by default mark with the label
UNKNOWN
non-standard HTTP methods to show that such requests were made (and this way does not increase cardinality). In case someone wants to stay with the current behavior, library API should allow it. The mechanism with environment variables can be reused - introduce the variableOTEL_INSTRUMENTATION_HTTP_CAPTURE_ALL_METHODS
that will allow enabling current behavior when someone really wants it.References