🇰🇷 한글 설명
Bouncy Castle for Java FIPS(BC-FJA)의 여러 클래스(AES, DESede 엔진, SP 800-90A DRBG, SymmetricSecretKey, PBKD 및 scrypt 파라미터)는 Object.finalize를 통해 가비지 컬렉션 시 민감한 키 자료를 제로화합니다. 그러나 Java 9 이상에서는 finalizer 스레드가 객체를 따라잡지 못해 대기열이 무한정 커질 수 있으며, 이로 인해 메모리 부족 오류와 키 자료의 장기 잔존이 발생할 수 있습니다. 해당 문제는 bc-fips 1.0.2.7, 2.0.2, 2.1.3 이후 버전에서 java.lang.ref.Cleaner로 수정되었습니다.
💡 쉬운 설명
암호화에 쓰는 비밀 키 정보가 프로그램이 지운 뒤에도 메모리에 오래 남아 있을 수 있는 문제입니다. 최신 자바에서 이 정리 작업이 밀리면서 메모리가 부족해져 서비스가 멈출 수 있습니다.
🇺🇸 원문 (English)
In Bouncy Castle for Java FIPS (BC-FJA) before bc-fips 1.0.2.7 (1.0.X series), 2.0.2 (2.0.X series) and 2.1.3 (2.1.X series), sensitive key material held by the AES and DESede engines, the SP 800-90A DRBGs, SymmetricSecretKey and the PBKD and scrypt parameter classes was zeroised on garbage collection by overriding Object.finalize. Finalization runs at an unspecified time and in an unspecified order and is serviced by a single finalizer thread, so where objects carrying a finalizer are allocated faster than that thread retires them the pending-finalization queue grows without bound: disposal falls arbitrarily far behind, which can contribute to an OutOfMemoryError under load, and the key material those objects hold stays resident in the heap for as long as they are queued, defeating the purpose of the zeroisation. The behaviour was not a problem on Java 8 or Java 11; it is later JVMs, on which finalization has been deprecated and progressively de-emphasised, where it becomes one. Disposal of these classes now runs from a java.lang.ref.Cleaner registered in the multi-release jdk1.9 overlay, so on Java 9 and later it no longer depends on the finalizer being scheduled. Bouncy Castle for Java (bcprov) and Bouncy Castle for Java LTS are not affected, as neither implements the finalizer-based zeroisation scheme.
📍 영향받는 시스템
Bouncy Castle for Java FIPS(BC-FJA) bc-fips 1.0.2.7 미만, 2.0.2 미만, 2.1.3 미만 버전을 Java 9 이상에서 사용하는 시스템 (bcprov 및 bcprov LTS는 영향 없음)
⚔️ 공격 벡터
공격자가 대량의 암호 객체 생성을 유도해 finalizer 대기열을 키우고, 힙 메모리에 남은 키 자료를 메모리 덤프 등으로 탈취하거나 OutOfMemoryError로 서비스 거부를 일으킴
🛡️ 대응 방법
bc-fips를 1.0.2.7 이상, 2.0.2 이상, 2.1.3 이상 등 해당 시리즈의 수정 버전으로 업그레이드
🔧 검증 코드
출력된 jar 파일명의 버전이 1.0.2.7, 2.0.2, 2.1.3 이상이면 패치된 것이며, 그보다 낮은 버전이 보이면 업그레이드가 필요합니다.
find / -name 'bc-fips*.jar' 2>/dev/null -exec basename {} \;