The vulnerability lies in the parsing of OpenTelemetry propagation headers (baggage, b3, uber-trace-id). Several propagator implementations used string.Split() to parse header values based on delimiters like commas, hyphens, or colons. This approach is inefficient and dangerous when handling untrusted input, as a malicious actor can craft a header with a very large number of delimiters. The string.Split() method would then attempt to allocate an array to hold all the resulting substrings, leading to excessive memory allocation and a potential Denial of Service (DoS) in the application.
The patch addresses this by replacing the calls to string.Split() with manual, iterative parsing loops that process the header string segment by segment. This approach uses ReadOnlySpan<char> for efficient slicing and avoids allocating a large intermediate array, thus mitigating the memory exhaustion risk. Additionally, a related issue in BaggagePropagator.Inject was fixed, where the maximum header length was not always correctly enforced, which could lead to generating non-compliant and overly long headers.