🇰🇷 한글 설명
Apache bRPC의 HTTP/2(h2/gRPC) 스택 내 HPACK 헤더 압축 디코더에서 도달 가능한 어설션 결함이 발견되었습니다. 공격자가 조작된 HPACK 헤더 시퀀스를 전송하면 서버 프로세스가 충돌하여 서비스 거부(DoS) 상태가 될 수 있습니다.
💡 쉬운 설명
서버가 헤더 정보를 저장하는 공간을 계산할 때 실제보다 더 크게 계산하여 발생하는 오류입니다. 공격자가 특수한 헤더를 보내면 서버가 계산 오류를 일으키며 갑자기 꺼질 수 있습니다.
🇺🇸 원문 (English)
A reachable-assertion flaw in the HPACK header-compression decoder of the HTTP/2 (h2/gRPC) stack in Apache bRPC (version < 1.18.0) on all platforms allows a remote attacker to crash the server process by sending a crafted sequence of HPACK headers, resulting in a denial of service.
Root Cause:
In src/brpc/details/hpack.cpp, IndexTable::Init sizes the dynamic-table ring buffer as num_headers = max_size / (32 + 2), i.e. it assumes a minimum table entry of 34 bytes (name >= 1 byte + value >= 1 byte + 32 bytes of overhead). However, RFC 7541 section 4.1 specifies that the minimum entry size is 33 bytes, because the value may be empty (name >= 1 byte + value == 0 + 32 bytes). For the default 4096-byte table this allocates only 120 slots (4096/34). Eviction in AddHeader is driven by byte usage (_max_size), not by slot count, so a peer can add 121 minimal 33-byte entries (121*33 = 3993 <= 4096) without triggering eviction. The 121st AddHeader then hits CHECK(!_header_queue.full()), which aborts the process.
Affected Scenarios:
Use a bRPC server that serves HTTP/2 or gRPC requests (e.g. via the h2 protocol) from an untrusted network. The malicious header block is processed during HPACK decoding of incoming requests without authentication.
How to Fix:
(Choose one of the following options)
1. Upgrade bRPC to version 1.18.0, which fixes this issue.
2. Apply this patch: https://github.com/apache/brpc/pull/3462
Note:
The fix sizes the dynamic table for the 33-byte minimum entry (max_size / (32 + 1)) and ensures at least one ring-buffer slot is kept when max_size is smaller than the minimum entry, so that initialization cannot fail on malloc(0).
📍 영향받는 시스템
Apache bRPC version < 1.18.0 (HTTP/2 또는 gRPC 사용 시)
⚔️ 공격 벡터
인증되지 않은 원격 공격자가 조작된 HPACK 헤더 블록을 포함한 HTTP/2 또는 gRPC 요청을 전송
🛡️ 대응 방법
bRPC를 1.18.0 버전 이상으로 업그레이드하거나 제공된 패치(PR #3462)를 적용하십시오.
🔧 검증 코드
출력된 버전이 1.18.0 미만인 경우 해당 취약점에 노출된 상태입니다.
brpc_version_cmd --version 2>/dev/null | grep -E '1\.[0-9]+\.'