🇰🇷 한글 설명
Apache bRPC의 json2pb 컴포넌트에서 제어되지 않는 재귀 호출로 인해 발생하는 취약점입니다. 1.15.0 미만 버전의 bRPC를 사용하는 경우, 공격자가 깊은 재귀 구조를 가진 JSON 데이터를 전송하여 서버를 충돌(Crash)시킬 수 있습니다.
💡 쉬운 설명
복잡하게 꼬인 JSON 데이터를 보내 서버의 메모리 한계를 넘게 만들어 서버를 멈추게 하는 공격입니다. 마치 끝없이 이어지는 질문을 던져 상대방을 당황하게 만드는 것과 비슷합니다.
🇺🇸 원문 (English)
Uncontrolled recursion in the json2pb component in Apache bRPC (version < 1.15.0) on all platforms allows remote attackers to make the server crash via sending deep recursive json data.
Root Cause:
The bRPC json2pb component uses rapidjson to parse json data from the network. The rapidjson parser uses a recursive parsing method by default. If the input json has a large depth of recursive structure, the parser function may run into stack overflow.
Affected Scenarios:
Use bRPC server with protobuf message to serve http+json requests from untrusted network. Or directly use JsonToProtoMessage to convert json from untrusted input.
How to Fix:
(Choose one of the following options)
1. Upgrade bRPC to version 1.15.0, which fixes this issue.
2. Apply this patch: https://github.com/apache/brpc/pull/3099
Note:
No matter which option
you choose, you should know that the fix introduces a recursion depth limit with default value 100. It affects these functions:
ProtoMessageToJson, ProtoMessageToProtoJson, JsonToProtoMessage, and ProtoJsonToProtoMessage.
If your requests contain json or protobuf messages that have a depth exceeding the limit, the request will be failed after applying the fix. You can modify the gflag json2pb_max_recursion_depth to change the limit.
📍 영향받는 시스템
Apache bRPC version < 1.15.0
⚔️ 공격 벡터
신뢰할 수 없는 네트워크로부터 깊은 재귀 구조를 가진 JSON 데이터를 전송하여 서버의 스택 오버플로우 유도
🛡️ 대응 방법
bRPC를 1.15.0 버전으로 업그레이드하거나 제공된 패치를 적용하십시오.
🔧 검증 코드
출력된 bRPC 버전이 1.15.0 미만인지 확인하여 취약 여부를 판단합니다.
brpc_version_check=$(brpc_version_command_here 2>/dev/null); echo $brpc_version_check