🇰🇷 한글 설명
Apache bRPC 1.18.0 미만 버전의 Discovery 명명 서비스 응답 파서에서 발생하는 취약점입니다. JSON 값이 객체인지 확인하지 않고 RapidJSON의 멤버 접근 함수를 호출하여 메모리 경계를 벗어난 읽기가 발생하며, 이로 인해 클라이언트 프로세스가 충돌할 수 있습니다.
💡 쉬운 설명
프로그램이 데이터를 읽을 때 데이터의 형식을 제대로 확인하지 않아 발생하는 오류입니다. 잘못된 형식의 데이터를 받으면 프로그램이 갑자기 종료될 수 있습니다.
🇺🇸 원문 (English)
The Discovery naming-service reply parser in Apache bRPC (versions < 1.18.0) calls RapidJSON object-only accessors (FindMember) on JSON values without first validating that those values are objects. A malformed Discovery response whose data/service members or instances list contain non-object entries (e.g. a bare integer) triggers the RapidJSON object-access precondition on the client, reading memory out of bounds and potentially crashing the bRPC client.
Root Cause:
In src/brpc/policy/discovery_naming_service.cpp, DiscoveryNamingService::GetServers() and DiscoveryNames::ListDiscoveryNodes() access JSON values with member functions on non-object values. RapidJSON only defines these operations for object types; invoking them on a non-object violates the class invariant and results in undefined behavior (out-of-bounds read), commonly crashing the process.
Affected Scenarios:
An operator-configured (or compromised) Discovery backend returns a malformed /discovery/nodes or /discovery/fetchs response whose data/service/instance entries are not JSON objects, crashing any bRPC client that refreshes its server list.
How to Fix:
1. Upgrade bRPC to version 1.18.0 or later, which fixes this issue.
2. Apply this patch: https://github.com/apache/brpc/pull/3533
The fix validates that the Discovery response data, per-service data, and instance entries are JSON objects (and skips non-object node/instance entries and rejects non-object data/service values) before calling member accessors.
📍 영향받는 시스템
Apache bRPC versions < 1.18.0
⚔️ 공격 벡터
조작된 Discovery 백엔드 응답을 통해 비객체 형식의 JSON 데이터를 전송하여 클라이언트를 충돌시킴
🛡️ 대응 방법
bRPC를 1.18.0 이상 버전으로 업그레이드하거나 제공된 패치를 적용하십시오.
🔧 검증 코드
출력된 bRPC 버전이 1.18.0 미만이면 취약한 상태입니다.
brpc_version_check() { echo "$1"; } # 실제 설치된 bRPC 버전을 확인하는 명령어를 입력하세요 (예: pkg-config --modversion brpc)