🇰🇷 한글 설명
sm-crypto 라이브러리 0.5.0 미만 버전에서 Node.js 환경 사용 시 SM2 키 쌍 생성 과정에 취약점이 존재합니다. Math.random()과 현재 시간을 기반으로 생성된 예측 가능한 난수를 사용하여 암호화 키를 생성하므로, 공격자가 개인키를 복구하거나 서명을 위조할 수 있습니다.
💡 쉬운 설명
암호 키를 만들 때 사용하는 '무작위 숫자 생성기'가 충분히 무작위적이지 않아 공격자가 예측할 수 있는 상태입니다. 이를 통해 해커가 사용자의 비밀번호와 같은 중요한 암호 키를 알아내거나 가짜 서명을 만들 수 있습니다.
🇺🇸 원문 (English)
sm-crypto provides JavaScript implementations of the Chinese cryptographic algorithms SM2, SM3, and SM4. Prior to 0.5.0, the default no-argument sm2.generateKeyPairHex() path in Node.js uses the module-wide SecureRandom instance in src/sm2/utils.js, supplied by
[email protected], which seeds an ARC4 stream from Math.random() and new Date().getTime() because window.crypto.getRandomValues is unavailable even though globalThis.crypto exists. An attacker who can observe the process's Math.random() outputs and estimate the key-generation time can reconstruct the seed, recover generated SM2 private keys, and predict signing ephemeral scalars used to forge signatures. This issue is fixed in version 0.5.0.
📍 영향받는 시스템
sm-crypto versions prior to 0.5.0 (Node.js environment)
⚔️ 공격 벡터
Math.random() 출력값과 키 생성 시간 추정을 통한 난수 시드 재구성 및 개인키 복구
🛡️ 대응 방법
sm-crypto 라이브러리를 0.5.0 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 sm-crypto의 버전이 0.5.0 미만인지 확인하십시오.