CVE-2023-43810
OpenTelemetry Memory exhaustion via unbounded http_method cardinality
- CVSS 7.5
- CWE-400 Uncontrolled Resource Consumption
- Resource Management
- Remote
OpenTelemetry, also known as OTel for short, is a vendor-neutral open-source Observability framework for instrumenting, generating, collecting, and exporting telemetry data such as traces, metrics, logs. 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. HTTP method for requests can be easily set by an attacker to be random and long. 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. This issue has been patched in version 0.41b0.
- CVSS base score
- 7.5
- Published
- 2023-10-06
- OWASP
- A09 Security Logging and Monitoring Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- OpenTelemetry
- Fixed by upgrading
- Yes
Solution
Update to OpenTelemetry version 0.41b0 or higher.
Vulnerable code sample
from flask import Flask, request
from opentelemetry import trace
app = Flask(__name__)
# Initialize OpenTelemetry tracing
tracer = trace.get_tracer(__name__)
@app.route('/', methods=['*']) # Allows all HTTP methods
def index():
# Create a span for tracing
with tracer.start_as_current_span("http_request"):
# Automatically adds `http_method` label with unbound cardinality
return 'Hello, World!'
if __name__ == '__main__':
app.run()Patched code sample
from flask import Flask, request, abort
import logging
app = Flask(__name__)
# Define a set of allowed HTTP methods
ALLOWED_HTTP_METHODS = {'GET', 'POST', 'PUT', 'DELETE', 'PATCH'}
@app.before_request
def limit_http_methods():
if request.method not in ALLOWED_HTTP_METHODS:
logging.warning(f"Blocked HTTP method: {request.method}")
abort(405) # Method Not Allowed
@app.route('/', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])
def index():
return 'Hello, World!'
if __name__ == '__main__':
app.run()Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Merge pull request from GHSA-5rv5-6h4r-h22v (open-telemetry/opentelemetry-python-contrib)
instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py,instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py · collect_request_attributes,instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py · get_default_span_name,util/opentelemetry-util-http/src/opentelemetry/util/http/__init__.py
Cite this entry
@misc{vaitp:cve202343810,
title = {{OpenTelemetry Memory exhaustion via unbounded http_method cardinality}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2023},
note = {VAITP Python Vulnerability Dataset, entry CVE-2023-43810},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-43810/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
