Описание
Denial of Service via Zip/Decompression Bomb sent over HTTP or gRPC
Summary
An unsafe decompression vulnerability allows unauthenticated attackers to crash the collector via excessive memory consumption.
Details
The OpenTelemetry Collector handles compressed HTTP requests by recognizing the Content-Encoding header, rewriting the HTTP request body, and allowing subsequent handlers to process decompressed data. It supports the gzip, zstd, zlib, snappy, and deflate compression algorithms. A "zip bomb" or "decompression bomb" is a malicious archive designed to crash or disable the system reading it. Decompression of HTTP requests is typically not enabled by default in popular server solutions due to associated security risks. A malicious attacker could leverage this weakness to crash the collector by sending a small request that, when uncompressed by the server, results in excessive memory consumption.
During proof-of-concept (PoC) testing, all supported compression algorithms could be abused, with zstd causing the most significant impact. Compressing 10GB of all-zero data reduced it to 329KB. Sending an HTTP request with this compressed data instantly consumed all available server memory (the testing server had 32GB), leading to an out-of-memory (OOM) kill of the collector application instance.
The root cause for this issue can be found in the following code path:
Affected File: https://github.com/open-telemetry/opentelemetry-collector/[...]confighttp/compression.go
Affected Code:
To mitigate this attack vector, it is recommended to either disable support for decompressing client HTTP requests entirely or limit the size of the decompressed data that can be processed. Limiting the decompressed data size can be achieved by wrapping the decompressed data reader inside an io.LimitedReader, which restricts the reading to a specified number of bytes. This approach helps prevent excessive memory usage and potential out-of-memory errors caused by decompression bombs.
PoC
This issue was confirmed as follows:
PoC Commands:
Output:
Server logs:
A similar problem exists for configgrpc when using the zstd compression:
Impact
Unauthenticated attackers can crash the collector via excessive memory consumption, stopping the entire collection of telemetry.
Patches
- The confighttp module version 0.102.0 contains a fix for this problem.
- The configgrpc module version 0.102.1 contains a fix for this problem.
- All official OTel Collector distributions starting with v0.102.1 contain both fixes.
Workarounds
- None.
References
- https://github.com/open-telemetry/opentelemetry-collector/pull/10289
- https://github.com/open-telemetry/opentelemetry-collector/pull/10323
- https://opentelemetry.io/blog/2024/cve-2024-36129/
Credits
This issue was uncovered during a security audit performed by 7ASecurity, facilitated by OSTIF, for the OpenTelemetry project.
Ссылки
- https://github.com/open-telemetry/opentelemetry-collector/security/advisories/GHSA-c74f-6mfw-mm4v
- https://nvd.nist.gov/vuln/detail/CVE-2024-36129
- https://github.com/open-telemetry/opentelemetry-collector/pull/10289
- https://github.com/open-telemetry/opentelemetry-collector/pull/10323
- https://opentelemetry.io/blog/2024/cve-2024-36129
- https://pkg.go.dev/vuln/GO-2024-2900
Пакеты
go.opentelemetry.io/collector/config/confighttp
< 0.102.0
0.102.0
go.opentelemetry.io/collector/config/configgrpc
< 0.102.1
0.102.1
Связанные уязвимости
The OpenTelemetry Collector offers a vendor-agnostic implementation on how to receive, process and export telemetry data. An unsafe decompression vulnerability allows unauthenticated attackers to crash the collector via excessive memory consumption. OTel Collector version 0.102.1 fixes this issue. It is also fixed in the confighttp module version 0.102.0 and configgrpc module version 0.102.1.
The OpenTelemetry Collector offers a vendor-agnostic implementation on how to receive, process and export telemetry data. An unsafe decompression vulnerability allows unauthenticated attackers to crash the collector via excessive memory consumption. OTel Collector version 0.102.1 fixes this issue. It is also fixed in the confighttp module version 0.102.0 and configgrpc module version 0.102.1.
Уязвимость модулей confighttp и configgrpc программного обеспечения обработки данных телеметрии OpenTelemetry Collector, позволяющая нарушителю вызвать отказ в обслуживании