Applies To
Win 10 Ent LTSB 2016 Win 10 Ent LTSC 2019 Windows 10 IoT Enterprise LTSC 2021 Windows 10, version 22H2, all editions Windows 11 Home and Pro, version 22H2 Windows 11 Enterprise Multi-Session, version 22H2 Windows 11 Enterprise and Education, version 22H2 Windows 11 IoT Enterprise, version 22H2 Windows 11 SE, version 23H2 Windows 11 Home and Pro, version 23H2 Windows 11 Enterprise and Education, version 23H2 Windows 11 Enterprise Multi-Session, version 23H2 Windows 11 version 24H2, all editions Windows 11 version 25H2, all editions Windows Server 2012 ESU Windows Server 2012 R2 ESU Windows Server 2016 Windows Server 2019 Windows Server 2022 Windows Server 2025

原始出版日期: 2025年11月21日

KB ID:5073121

簡介

2025 年 10 月 14 日針對 CVE-2024-30098 的 Windows 更新揭露了應用程式中程式碼未能正確識別哪個提供者管理從智慧卡傳播到憑證儲存的憑證金鑰的問題。 這種錯誤識別在某些情況下可能導致密碼學操作失敗。 本文件為應用程式開發者提供如何偵測正確處理器並解決這些問題的指引。

摘要

當憑證從智慧卡傳播到 Windows 憑證儲存時,傳播過程可使用以下任一提供者:

  • 傳統密碼服務提供者 (CSP) ,依賴舊有的密碼學應用程式介面 (CAPI)

  • 鑰儲存提供者 (KSP) ,該系統依賴密碼API:下一代 (CNG) 。 這是 Windows Vista 中引入的現代替代品。

在 CVE-2024-30098 修正之前,傳播演算法使用 CSP 處理基於 RSA 的憑證,其他憑證則使用 KSP。 此方法不安全,因為 CAPI 不支援現代密碼演算法,限制了安全能力。

2025 年 10 月 14 日的安全更新移除了此特殊處理,現在所有憑證皆使用 KSP。

確定要使用的 API 集合

依賴 RSA 金鑰由 CSP 管理的應用程式,當金鑰由 KSP 管理時可能會失敗。 為了解決此問題,應用程式必須偵測由哪個提供者管理金鑰,並使用對應的 API 集合 (CAPI 或 CNG) 。

重要: 請勿使用 CryptAcquireContextWCryptAcquireContextA 函式,因為該 API 已不再被棄用。 相反地,請使用 CryptAcquireCertificatePrivateKey 函式。

CryptAcquireCertificatePrivateKey 函式

呼叫 CryptAcquireCertificatePrivateKey 會回傳一個 phCryptProvOrNCryptKey) (型別為 HCRYPTPROV_OR_NCRYPT_KEY_HANDLE 的句柄。 這個帳號可以是:

  • CSP 處理 (HCRYPTPROV) :使用 CryptoAPI 函式,如 CryptSignHash。

  • CNG 處理 (NCRYPT_KEY_HANDLE) :使用 CNG 函式如 NCryptSignHash。

附註: 呼叫 CryptAcquireCertificatePrivateKey 時,務必將 CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG 包含在 dwFlags 參數中。

要確定句柄類型,請檢查 pdwKeySpec 值:

pdwKeySpec 值

可使用的加密 API

AT_KEYEXCHANGE或AT_SIGNATURE

CAPI

CERT_NCRYPT_KEY_SPEC

CNG

因應措施

對於受此變更強制執行影響的客戶,有臨時的解決方法。 有一個臨時登錄金鑰可用來將行為從 執行 模式切換到 稽核 模式。

重要: 此登錄檔金鑰的支援將於 2026 年 4 月更新中移除。

登錄路徑

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Calais

Type (類型)

REG_DWORD

值名稱

DisableCapiOverrideForRSA

值資料

  • 1 = 啟用修正

  • 0 或 鍵移除 = 停用修正 – 切換到稽核模式

參考資料

金鑰儲存與檢索

CryptAcquireCertificatePrivateKey 函數 (wincrypt.h)

CVE-2024-30098 |Windows 加密服務安全功能繞過漏洞

.

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。