The vulnerability, identified as GHSA-mh2q-q3fh-2475, is a denial-of-service (DoS) weakness in OpenTelemetry-Go caused by excessive resource consumption when parsing W3C baggage headers. The root cause is the amplification of CPU and memory allocation when an HTTP request contains multiple baggage header fields.
The exploitation path begins at propagation.Baggage.Extract, the public entry point for baggage extraction. When multiple baggage headers are present, this function calls the internal propagation.extractMultiBaggage function. In its vulnerable state, extractMultiBaggage would iterate through every single baggage header value provided by the attacker. For each value, it would call baggage.Parse to process the string, and then aggregate the results. There was no mechanism to limit the total number of members collected across all headers, allowing the list of members to grow excessively.
This led to two primary points of resource exhaustion:
- Repeated Parsing: The
baggage.Parse function was called for each header, amplifying the CPU cost.
- Excessive Allocation: After parsing, the
baggage.New function was called with the aggregated list of all members. The vulnerable version of New would create a full string representation of all members in memory to check if it exceeded the size limit, leading to a massive memory allocation that could cause the application to slow down or crash.
The patch mitigates this by introducing checks early in the process. extractMultiBaggage now stops collecting members once the maximum limit (64) is reached. Furthermore, baggage.Parse and baggage.New were updated to incrementally validate limits and truncate data, preventing the large intermediate allocations that were the core of the DoS attack.