diff --git a/ScoutSuite/output/data/html/partials/azure/services.keyvault.subscriptions.id.vaults.html b/ScoutSuite/output/data/html/partials/azure/services.keyvault.subscriptions.id.vaults.html index 55e5801bf..fc46c6999 100755 --- a/ScoutSuite/output/data/html/partials/azure/services.keyvault.subscriptions.id.vaults.html +++ b/ScoutSuite/output/data/html/partials/azure/services.keyvault.subscriptions.id.vaults.html @@ -8,6 +8,7 @@

Information

ID: {{ id }}
Location: {{value_or_none location}}
Public Access: {{ convert_bool_to_enabled public_access_allowed }}
+
Approved Private Endpoints: {{ private_endpoint_connections.length }}
Vault Recoverable: {{ recovery_protection_enabled }}
RBAC Permission Model: {{ convert_bool_to_enabled rbac_authorization_enabled }}
Tags: diff --git a/ScoutSuite/providers/azure/resources/keyvault/vaults.py b/ScoutSuite/providers/azure/resources/keyvault/vaults.py index 4d5005898..543f39f28 100755 --- a/ScoutSuite/providers/azure/resources/keyvault/vaults.py +++ b/ScoutSuite/providers/azure/resources/keyvault/vaults.py @@ -34,7 +34,14 @@ def _parse_key_vault(self, raw_vault): bool(raw_vault.properties.enable_purge_protection) vault['public_access_allowed'] = self._is_public_access_allowed(raw_vault) vault['rbac_authorization_enabled'] = raw_vault.properties.enable_rbac_authorization + vault['private_endpoint_connections'] = self._get_private_endpoint_connections(raw_vault) return vault['id'], vault def _is_public_access_allowed(self, raw_vault): return raw_vault.properties.network_acls is None or raw_vault.properties.network_acls.default_action == 'Allow' + + def _get_private_endpoint_connections(self, raw_vault): + private_endpoint_connections = getattr(raw_vault.properties, "private_endpoint_connections", None) + if not private_endpoint_connections: + return [] + return [pe.private_endpoint.id for pe in private_endpoint_connections if pe.private_link_service_connection_state.status == 'Approved'] diff --git a/ScoutSuite/providers/azure/rules/findings/keyvault-private-endpoints-not-used.json b/ScoutSuite/providers/azure/rules/findings/keyvault-private-endpoints-not-used.json new file mode 100644 index 000000000..792340f35 --- /dev/null +++ b/ScoutSuite/providers/azure/rules/findings/keyvault-private-endpoints-not-used.json @@ -0,0 +1,27 @@ +{ + "description": "Key Vaults Not Using Private Endpoint Connections", + "rationale": "Private endpoints will keep network requests to Azure Key Vault limited to the endpoints attached to the resources that are whitelisted to communicate with each other. Assigning the Key Vault to a network without an endpoint will allow other resources on that network to view all traffic from the Key Vault to its destination. In spite of the complexity in configuration, this is recommended for high security secrets.", + "remediation": "In the Azure console:
  1. Go to Key Vaults
  2. For each key vault, click on the settings menu called Networking.
  3. Go to the tab named Private Endpoint Connections.
  4. Ensure that a private endpoint entry exists corresponding each Virtual Network that contains resources requiring access to the Key Vault resource.
  5. Click Save to apply your changes.
", + "compliance": [ + { + "name": "CIS Microsoft Azure Foundations", + "version": "2.0.0", + "reference": "8.7" + } + ], + "references": [ + "https://learn.microsoft.com/en-us/azure/key-vault/general/private-link-service", + "https://learn.microsoft.com/en-gb/security/benchmark/azure/baselines/key-vault-security-baseline?context=%2Fazure%2Fkey-vault%2Fgeneral%2Fcontext%2Fcontext#ns-2-secure-cloud-services-with-network-controls" + ], + "dashboard_name": "Key Vaults", + "path": "keyvault.subscriptions.id.vaults.id", + "conditions": [ + "and", + [ + "keyvault.subscriptions.id.vaults.id.private_endpoint_connections", + "empty", + "" + ] + ], + "id_suffix": "private_endpoint_connections" +} \ No newline at end of file diff --git a/ScoutSuite/providers/azure/rules/rulesets/default.json b/ScoutSuite/providers/azure/rules/rulesets/default.json index 464783905..e5873b266 100755 --- a/ScoutSuite/providers/azure/rules/rulesets/default.json +++ b/ScoutSuite/providers/azure/rules/rulesets/default.json @@ -91,6 +91,12 @@ "level": "warning" } ], + "keyvault-private-endpoints-not-used.json": [ + { + "enabled": true, + "level": "warning" + } + ], "keyvault-public-traffic-allowed.json": [ { "enabled": true,