Information
Ensure that all Keys in Azure Key Vaults with access policies have an expiration date set.
Note: Using access policies is a legacy method.For improved security, use the Role-Based Access Control (RBAC) permission model instead of access policies when managing Azure Key Vault. RBAC restricts permission management to only the Owner and User Access Administrator roles, ensuring a clear separation between security and administrative tasks.With the Access Policy permission model, users with the Contributor, Key Vault Contributor, or any role that includes Microsoft.KeyVault/vaults/write permissions can grant themselves data plane access by configuring a Key Vault access policy. This can result in unauthorized access and management of your key vaults, keys, secrets, and certificates. To reduce this risk, limit Contributor role access to key vaults when using the Access Policy model.
Azure Key Vault enables users to store and use cryptographic keys within the Microsoft Azure environment. The exp (expiration date) attribute identifies the expiration date on or after which the key MUST NOT be used for a cryptographic operation. By default, keys never expire. It is thus recommended that keys be rotated in the key vault and set an explicit expiration date for all keys. This ensures that the keys cannot be used beyond their assigned lifetimes.
NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance.
Solution
Requisite Access Policy Permissions for Keys - read section overview!
Remediation Permissions = Keys: List, Get, Update
Remediate from Azure Portal
- Go to Key vaults.
- For each Key vault, under Objects, select Keys.
- In the main pane, ensure that the status of the key(s) is Enabled.
- Click on the secret(s) without Expiration date.
- Click on the current version key
- Click the checkbox Set expiration date and set an appropriate Expiration date on the key.
- Click Apply.
Remediate from Azure CLI
Update the Expiration date for the key using the below command:
az keyvault key set-attributes --name <keyName> --vault-name <vaultName> --expires Y-m-d'T'H:M:S'Z'
Remediate from PowerShell
Set-AzKeyVaultKeyAttribute -VaultName <Vault Name> -Name <Key Name> -Expires <DateTime>
Impact:
Keys cannot be used beyond their assigned expiration dates respectively. Keys need to be rotated periodically wherever they are used.