🇰🇷 한글 설명
MongoDB Java 드라이버의 BSON 인코딩 구성요소가 외부에서 주입된 raw 문서의 자체 선언 길이와 실제 바이트 범위의 크기가 일치하는지 검증하지 않고 명령에 복사합니다. 이로 인해 구조적으로 불일치한 메시지가 생성되어, 공격자가 제어하는 후행 데이터가 데이터베이스에서 명령의 추가 필드로 해석될 수 있습니다. 공격 결과 애플리케이션 자격 증명으로 실행되는 명령이 의도치 않게 변경되어 읽기·쓰기 데이터가 바뀔 수 있습니다.
💡 쉬운 설명
MongoDB 자바 드라이버가 외부에서 들어온 데이터의 길이를 제대로 확인하지 않습니다. 공격자가 이 허점을 이용하면 데이터베이스가 실행하는 명령의 내용을 몰래 바꿀 수 있습니다.
🇺🇸 원문 (English)
A BSON encoding component of the MongoDB Java Driver does not verify that an externally supplied raw document's self-declared length agrees with the extent of the byte range it is given before that range is copied into an outgoing database command. An application that wraps untrusted raw bytes in such a document and uses it as part of a command can therefore emit a structurally inconsistent message, causing the database to interpret attacker-supplied trailing content as additional fields of the surrounding command. No authentication to the driver or database is required beyond the ability to influence those bytes through the victim application, and no user interaction is needed. The result is unintended modification of the command actually executed, which can alter the data read or written under the application's credentials.
📍 영향받는 시스템
MongoDB Java Driver (취약 버전 및 정확한 범위는 공식 보안 권고 확인 필요)
⚔️ 공격 벡터
피해 애플리케이션이 신뢰할 수 없는 raw 바이트를 BSON 문서로 감싸 명령에 사용할 때, 공격자가 해당 바이트를 조작해 추가 필드를 주입
🛡️ 대응 방법
MongoDB Java Driver를 패치된 최신 버전으로 업그레이드하고, 외부 입력을 raw BSON으로 직접 전달하지 않도록 코드를 수정
🔧 검증 코드
출력된 jar 파일명과 Implementation-Version 값을 확인하여 공식 권고의 취약 버전 범위에 해당하는지 비교하고, 해당하면 패치 버전으로 업그레이드합니다.
find / -name 'mongodb-driver*.jar' 2>/dev/null | xargs -I{} sh -c 'echo {}; unzip -p {} META-INF/MANIFEST.MF 2>/dev/null | grep -i version'