[하루한줄] CVE-2021-26413: Windows Installer Signature Spoofing 취약점

URL

Uncovering and Disclosing a Signature Spoofing Vulnerability in Windows Installer: CVE-2021-26413

Target

  • Windows Installer

Explain

Windows Installer (MSI) Authenticode 시그니처 유효성 검사를 우회하여 해커에 의해 조작된 패키지를 합법적인 소프트웨어로 위장할 수 있는 취약점이 발견되었습니다.

Windows Installer 파일의 시그니처를 검증하기 위해 OS나 사용자는 WinVerifyTrust 또는 WinVerifyTrustEx 함수를 호출합니다. 이 함수는 파일의 type을 확인하고 Subject Interface Package(SIP, MSI의 경우 MSISIP.dll)를 로드합니다. 그 후 MsiSIPGetSignedDataMsgMsiSIPVerifyIndirectData를 호출하여 레지스트리에서 Signature Data를 검색하고 확인하는 DLL exports의 이름들을 쿼리 합니다.

MSI 파일은 Compound File Binary format을 따릅니다. 이 형식의 파일들은 이 format의 파일들은 Storage object가 디렉터리 역할을 하고 Steam obejct가 파일 역할을 하는 파일 시스템입니다. MsiSIPGetSignedDataMsg 함수는 \\x05DigitalSignature stream에서 signature data를 얻고 MsiSIPVerifyIndirectData 함수는 root directory storage object부터 계산하고 검증합니다.

exploit은 MSISIP.dll에서 할당되지 않은 byte들을 고려하는데 실패해서 일어납니다.

Usually, a compound file includes ranges of bytes that are not allocated for either CFB structures or user-defined data. For instance, each stream whose length is not an exact multiple of the sector size requires a trailing portion of the last sector in the stream’s sector chain to be unused. Implementations that fail to initialize these byte ranges to zero (as recommended in section 2.7) might unintentionally leak user data.

이 할당되지 않은 byte들은 시그니처를 검증하고 계산하는데 고려되지 않습니다. 이를 통해 공격자는 악의적인 데이터를 삽입할 수 있습니다.