

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用遭盜用憑證偵測
<a name="cognito-user-pool-settings-compromised-credentials"></a>

Amazon Cognito 可以偵測出使用者的使用者名稱和密碼是否已於其他位置洩漏。這種問題可能發生在使用者在多個網站上重複使用憑證，或使用者使用不安全的密碼。Amazon Cognito 會在受管登入和 Amazon Cognito API 中檢查使用使用者名稱和密碼登入的[本機使用者](cognito-terms.md#terms-localuser)。

從 Amazon Cognito 主控台**的威脅防護**選單中，您可以設定**遭入侵的登入**資料。設定 **Event detection (事件偵測)** 以選擇您想要監控憑證洩漏的使用者事件。設定 **Compromised credentials responses (憑證洩漏回應)** 以選擇如果偵測到憑證洩漏時，要允許或封鎖該名使用者。Amazon Cognito 可以檢查登入、註冊和密碼變更時期間憑證是否洩漏。

當您選擇 **Allow sign-in (允許登入)** 時，您可以檢閱 Amazon CloudWatch Logs 以監控 Amazon Cognito 對使用者事件進行的評估。如需詳細資訊，請參閱[檢視威脅防護指標](metrics-for-cognito-user-pools.md#user-pool-settings-viewing-threat-protection-metrics)。當您選擇 **Block sign-in** (封鎖登入) 時，Amazon Cognito 可防止使用已洩漏的憑證登入的使用者。Amazon Cognito 封鎖使用者登入時，會將使用者的 [https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UserType.html](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UserType.html) 設定為 `RESET_REQUIRED`。狀態為 `RESET_REQUIRED` 的使用者必須先變更其密碼，才能再次登入。

遭入侵的登入資料可以檢查下列使用者活動的密碼。

**註冊**  
您的使用者集區會檢查使用者在 [SignUp](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SignUp.html) 操作和受管登入的註冊頁面中傳輸的密碼，以找出入侵指標。

**登入**  
您的使用者集區會檢查使用者在密碼型登入中提交的密碼是否有入侵指標。Amazon Cognito 可以檢閱 [AdminInitiateAuth](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminInitiateAuth.html) 中的`ADMIN_USER_PASSWORD_AUTH`流程、[InitiateAuth](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html) 中的`USER_PASSWORD_AUTH`流程，以及兩者中的`USER_AUTH`流程`PASSWORD`選項。  
目前 Amazon Cognito 不會針對使用安全遠端密碼 (SRP) 流程的登入操作，檢查憑證是否洩漏。SRP 會在登入期間傳送密碼雜湊函數。Amazon Cognito 無法從內部存取密碼，因此只能評估用戶端以純文字形式傳遞的密碼。

**密碼重設**  
您的使用者集區會檢查使用 [ConfirmForgotPassword](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ConfirmForgotPassword.html) 自助密碼重設操作設定新使用者密碼的操作中是否有入侵指標。此操作所需的程式碼是由 [ForgotPassword](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ForgotPassword.html) 和 [AdminResetUserPassword](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminResetUserPassword.html) 產生。  
遭入侵的登入資料不會檢查使用 [AdminSetUserPassword](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminSetUserPassword.html) 設定的暫時或永久管理員設定密碼。不過，使用臨時密碼時，您的使用者集區會檢查回應 [RespondToAuthChallenge](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_RespondToAuthChallenge.html) 和 [AdminRespondToAuthChallenge](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminRespondToAuthChallenge.html) 中`NEW_PASSWORD_REQUIRED`挑戰的密碼。

若要將憑證洩漏保護新增到使用者集區，請參閱 [具有威脅防護的進階安全性](cognito-user-pool-settings-threat-protection.md)。