🇰🇷 한글 설명
Apache bRPC 1.18.0 미만 버전의 mcpack2pb 구성 요소에서 정수 언더플로우 취약점이 발견되었습니다. 공격자가 value_size가 0인 문자열 필드를 포함한 요청을 보내면, 예외 처리가 되지 않아 bRPC 서버가 비정상 종료(SIGABRT)될 수 있습니다.
💡 쉬운 설명
서버가 데이터를 읽을 때 크기 계산을 잘못하여 발생하는 오류로, 특수한 요청을 보내면 서버를 강제로 꺼뜨릴 수 있습니다. 이는 서비스 중단을 일으키는 공격에 악용될 수 있습니다.
🇺🇸 원문 (English)
An integer underflow in the mcpack2pb component of Apache bRPC (version < 1.18.0) on all platforms allows remote attackers to crash a bRPC server by sending a request containing a string field with a zero value_size. The UnparsedValue::as_string() function computes `_size - 1` without validating `_size`; when value_size is 0 the expression underflows to SIZE_MAX, resize() throws std::length_error, and because the exception is not caught on the request parsing path the process aborts (SIGABRT).
Root Cause:
In src/mcpack2pb/parser.cpp, UnparsedValue::as_string() resizes the output string to `_size - 1`, where `_size` is the value_size of a string field taken directly from the network data. A value_size of 0 underflows the unsigned size_t, and the subsequent resize() throws an exception that is not caught.
Affected Scenarios:
bRPC servers that accept nshead frames wired to the ubrpc mcpack2 adaptor (for example the NsheadService + UbrpcMcpack2Adaptor deployment pattern) can be crashed by a single unauthenticated request. Stock open-source bRPC registers the ubrpc/nshead_mcpack protocols as client-only, so default server configurations are not affected.
How to Fix:
1. Upgrade bRPC to a version that includes this fix.
2. Apply the patch in PR https://github.com/apache/brpc/pull/3450
📍 영향받는 시스템
Apache bRPC versions < 1.18.0
⚔️ 공격 벡터
value_size가 0인 문자열 필드를 포함한 원격 요청 전송
🛡️ 대응 방법
bRPC를 1.18.0 이상 버전으로 업그레이드하거나 제공된 PR 패치를 적용하십시오.
🔧 검증 코드
출력된 버전이 1.18.0 미만인 경우 해당 취약점에 노출된 상태입니다.
brpc_version_cmd --version 2>/dev/null | grep -E '1\.(1[0-7]|1[8-9]|[2-9][0-9])\.'