The vulnerability exists in the GrpcStatusDeserializer class of the OpenTelemetry.Exporter.OpenTelemetryProtocol library, which is used to parse gRPC status details during retry operations. The core issue is the failure to validate length fields read from the grpc-status-details-bin trailer before using them for memory allocation or stream manipulation. An attacker-controlled OTLP endpoint can return a retryable status (ResourceExhausted or Unavailable) along with a crafted trailer containing a protobuf message with an excessively large length value for a length-delimited field.
The primary vulnerable function is OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient.Grpc.GrpcStatusDeserializer.DecodeBytes. This function would read the malicious length and attempt to allocate a byte array of that size, directly causing a large memory allocation that could exhaust available memory and crash the process, resulting in a Denial of Service. The fixing commits confirm this by adding strict bounds checking on the decoded length against int.MaxValue and the remaining bytes in the stream.
Further analysis of the patch shows that other functions within the same class (DecodeDuration, DecodeAny, SkipField) that also process length-delimited fields were similarly missing these crucial validation checks. While DecodeBytes presents the most direct path to DoS via memory allocation, these other functions were also patched to prevent potential errors or exceptions from malformed lengths, indicating they were also considered part of the overall security hardening. Therefore, they are included as functions that would be involved in processing the malicious payload.