🇰🇷 한글 설명
Apache Kafka 브로커의 PushTelemetry API(KIP-714)는 압축 크기만 검사하고 압축 해제 후 출력 크기에는 제한이 없어, 작은 압축 페이로드가 수백 MB의 힙 메모리로 확장될 수 있습니다. 인증된 클라이언트가 반복 요청하면 브로커 OutOfMemoryError와 서비스 중단을 유발할 수 있습니다. 4.2.2, 4.3.1, 4.4.0 이상에서 압축 해제 크기 상한(telemetry.max.bytes)이 적용되어 수정되었습니다.
💡 쉬운 설명
카프카 서버가 클라이언트가 보낸 작은 압축 파일을 풀 때 크기 제한이 없어 메모리가 과도하게 사용됩니다. 이로 인해 서버가 멈추거나 다운될 수 있으며, 최신 버전으로 업데이트하면 해결됩니다.
🇺🇸 원문 (English)
The broker-side PushTelemetry API (KIP-714) validates only the compressed size of a client's metrics payload against telemetry.max.bytes (default 1 MB) before decompressing it. ClientTelemetryUtils.decompress() then decompresses the payload with no limit on the decompressed output size, growing a heap buffer until the compressed input is exhausted. A small, highly compressible payload (for example gzip-compressed zeros) can therefore expand to hundreds of megabytes of broker heap.
Impact:
An authenticated client can send a PushTelemetry request with a small compressed payload that decompresses to a very large size, consuming broker heap out of proportion to the request size. Repeated or concurrent requests can exhaust the broker heap and cause an OutOfMemoryError, degrading or crashing the broker; a client that targets multiple brokers can affect cluster availability. PushTelemetry is available to any authenticated client and is not gated by an ACL.
Mitigation:
Upgrade to Apache Kafka 4.2.2, 4.3.1, or 4.4.0. On affected versions there is no configuration that fully prevents the amplification, because telemetry.max.bytes bounds only the compressed size; lowering telemetry.max.bytes reduces the worst-case decompressed size proportionally and is a partial mitigation.
Resolution:
- From Apache Kafka 4.2.2, 4.3.1, and 4.4.0: ClientTelemetryUtils.decompress() enforces a maximum decompressed size equal to telemetry.max.bytes (default 1 MB). Decompression reads in bounded chunks and aborts with a TelemetryTooLargeException once the decompressed total exceeds the limit, so an over-large or highly compressible payload is rejected instead of being fully expanded in heap. The decompressed size is therefore bounded by default.
📍 영향받는 시스템
Apache Kafka 4.2.2 미만, 4.3.1 미만, 4.4.0 미만 버전 (브로커)
⚔️ 공격 벡터
인증된 클라이언트가 PushTelemetry 요청에 고압축 페이로드를 담아 반복 전송하여 브로커 힙 메모리를 고갈시킴
🛡️ 대응 방법
Apache Kafka 4.2.2, 4.3.1 또는 4.4.0 이상으로 업그레이드하고, 임시 완화로 telemetry.max.bytes 값을 낮춤
🔧 검증 코드
출력된 Kafka 버전이 4.2.2, 4.3.1, 4.4.0 이상이면 패치된 것이며, 그 미만이면 취약한 버전이므로 업그레이드가 필요합니다.
kafka-topics.sh --version 2>/dev/null || ls /opt/kafka*/libs/kafka_*.jar 2>/dev/null | head -3