🇰🇷 한글 설명
Apache bRPC(1.11.0~1.17.0)의 스트리밍 RPC 클라이언트에서 경계 외 읽기(Out-of-bounds read) 취약점이 발견되었습니다. 악의적인 서버가 예상보다 적은 수의 스트림 ID를 포함한 응답을 보낼 경우, 클라이언트가 이를 검증 없이 처리하여 프로세스가 충돌하거나 메모리 내용이 유출될 수 있습니다.
💡 쉬운 설명
서버가 약속된 개수보다 적은 정보를 보내더라도 클라이언트가 이를 확인하지 않고 읽으려다 발생하는 문제입니다. 이로 인해 프로그램이 갑자기 꺼지거나 중요한 데이터가 외부로 새 나갈 수 있습니다.
🇺🇸 원문 (English)
An out-of-bounds read vulnerability exists in the streaming RPC client of Apache bRPC (versions 1.11.0 through 1.17.0) on all platforms. A client that creates multiple streams in a single RPC expects the server response to carry exactly one extra_stream_id for every additional stream. The response handling path indexed the returned identifiers using the locally created stream count without first validating the size of the returned list, so a malicious or compromised server (or an on-path attacker) can trigger an out-of-bounds read in the client by returning a malformed StreamSettings response with fewer extra_stream_ids than expected. This may crash the client process (denial of service) or leak unintended memory contents into subsequent stream handling; surplus identifiers have no valid client-stream mapping and are processed inconsistently.
Root Cause:
Since bRPC 1.11.0, a client can create multiple streams in one RPC via batch StreamCreate. The expected behavior is that the server response must return exactly (N-1) extra_stream_ids, where N is the number of locally created streams. In Controller::HandleStreamConnection, the response path reads extra_stream_ids[i-1] for each additional local stream without first comparing the returned list size with (N-1). If the server returns fewer identifiers, the read runs past the end of the returned list (out-of-bounds read); if it returns more, the surplus identifiers have no corresponding client-side stream.
Affected Scenarios:
A bRPC client using multi-stream RPC (creating more than one stream in a single RPC) that connects to an untrusted, malicious, or compromised server or to a server reached through an untrusted network path. The server sends a malformed StreamSettings response to trigger the issue.
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/3485
Note:
The fix makes the client reject responses whose extra_stream_ids count does not exactly match the number of additional client streams. Such mismatched responses now fail the RPC with ERESPONSE and go through the existing stream cleanup path, instead of being partially processed.
📍 영향받는 시스템
Apache bRPC versions 1.11.0 through 1.17.0
⚔️ 공격 벡터
악의적인 서버 또는 중간자 공격자가 조작된 StreamSettings 응답을 클라이언트에 전송
🛡️ 대응 방법
bRPC를 1.18.0 버전으로 업그레이드하거나 제공된 패치(PR #3485)를 적용하십시오.
🔧 검증 코드
출력된 버전이 1.11.0에서 1.17.0 사이라면 취약한 버전이 설치된 것입니다.
brpc_version_check=$(brpc_version_command_here 2>/dev/null); echo $brpc_version_check | grep -E '1(\.(1[1-7]\.[0-9]+)?)?'