You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Test attack paths and cloud security explorer in Microsoft Defender for Cloud
3
-
description: Learn how to test attack paths and cloud security explorer in Microsoft Defender for Cloud
2
+
title: Attack path analysis and enhanced risk-hunting for containers
3
+
description: Learn how to test attack paths and perform enhanced risk-hunting for containers with cloud security explorer in Microsoft Defender for Cloud
4
4
ms.service: defender-for-cloud
5
5
ms.topic: how-to
6
-
ms.date: 11/08/2023
6
+
ms.date: 01/21/2024
7
7
---
8
8
9
-
# Test attack paths and cloud security explorer
10
-
9
+
# Attack path analysis and enhanced risk-hunting for containers
11
10
12
11
Attack path analysis is a graph-based algorithm that scans the cloud security graph. The scans expose exploitable paths that attackers might use to breach your environment to reach your high-impact assets. Attack path analysis exposes attack paths and suggests recommendations as to how best remediate issues that break the attack path and prevent successful breach.
13
12
14
13
Explore and investigate [attack paths](how-to-manage-attack-path.md) by sorting them based on risk level, name, environment, and risk factors, entry point, target, affected resources and active recommendations. Explore cloud security graph Insights on the resource. Examples of Insight types are:
15
14
16
-
-Pod exposed to the internet
17
-
-Privileged container
18
-
-Pod uses host network
19
-
-Container image is vulnerable to remote code execution
15
+
-Pod exposed to the internet
16
+
-Privileged container
17
+
-Pod uses host network
18
+
-Container image is vulnerable to remote code execution
20
19
21
-
## Testing the attack path and security explorer using a mock vulnerable container image
20
+
## Azure: Testing the attack path and security explorer using a mock vulnerable container image
22
21
23
-
If there are no entries in the list of attack paths, you can still test this feature by using a mock container image. Use the following steps to set up the test:
22
+
If there are no entries in the list of attack paths, you can still test this feature by using a mock container image. Use the following steps to set up the test:
24
23
25
24
**Requirement:** An instance of Azure Container Registry (ACR) in the tested scope.
26
25
27
-
1.Import a mock vulnerable image to your Azure Container Registry:
26
+
1.Import a mock vulnerable image to your Azure Container Registry:
28
27
29
-
1.Run the following command in Cloud Shell:
28
+
1.Run the following command in Cloud Shell:
30
29
31
-
```
30
+
```azurecli
32
31
az acr import --name $MYACR --source DCSPMtesting.azurecr.io/mdc-mock-0001 --image mdc-mock-0001
33
32
```
34
33
35
-
1. If you don't have an AKS cluster, use the following command to create a new AKS cluster:
34
+
1. If you don't have an AKS cluster, use the following command to create a new AKS cluster:
36
35
37
-
```
36
+
```azurecli
38
37
az aks create -n myAKSCluster -g myResourceGroup --generate-ssh-keys --attach-acr $MYACR
39
38
```
40
39
41
-
1. If your AKS isn't attached to your ACR, use the following Cloud Shell command line to point your AKS instance to pull images from the selected ACR:
40
+
1. If your AKS isn't attached to your ACR, use the following Cloud Shell command line to point your AKS instance to pull images from the selected ACR:
42
41
43
-
```
42
+
```azurecli
44
43
az aks update -n myAKSCluster -g myResourceGroup --attach-acr <acr-name>
45
44
```
46
45
47
46
1. Authenticate your Cloud Shell session to work with the cluster:
48
-
49
-
```
47
+
48
+
```azurecli
50
49
az aks get-credentials --subscription <cluster-suid> --resource-group <your-rg> --name <your-cluster-name>
@@ -70,37 +70,80 @@ If there are no entries in the list of attack paths, you can still test this fea
70
70
> [!NOTE]
71
71
> After completing the above flow, it can take up to 24 hours to see results in the cloud security explorer and attack path.
72
72
73
-
## Investigate internet exposed Kubernetes pods
73
+
After you completed testing the attack path, investigate the created attack path by going to **Attack path analysis**, and search for the attack path you created. For more information, see [Identify and remediate attack paths](how-to-manage-attack-path.md).
74
74
75
-
You can build queries in one of the following ways:
75
+
## AWS: Testing the attack path and security explorer using a mock vulnerable container image
76
76
77
-
- [Find the security issue under attack paths](#find-the-security-issue-under-attack-paths)
78
-
- [Explore risks with built-in cloud security explorer templates](#explore-risks-with-cloud-security-explorer-templates)
79
-
- [Create custom queries with cloud security explorer](#create-custom-queries-with-cloud-security-explorer)
77
+
1. Create ECR repository named *mdc-mock-0001*
78
+
1. Go to your AWS account and choose **Command line or programmatic access**.
79
+
1. Open a command line and choose **Option 1: Set AWS environment variables (Short-term credentials)**. Copy the credentials of the *AWS_ACCESS_KEY_ID*, *AWS_SECRET_ACCESS_KEY*, and *AWS_SESSION_TOKEN* environment variables.
80
+
1. Run the following command to get the authentication token for your Amazon ECR registry. Replace `<REGION>` with the region of your registry. Replace `<ACCOUNT>` with your AWS account ID.
1. Create a Docker image that is tagged as vulnerable by name. The name of the image should contain the string *mdc-mock-0001*. Once you created the image, push it to your ECR registry, with the following command (replace `<ACCOUNT>` and `<REGION>` with your AWS account ID and region):
87
+
88
+
```awscli
89
+
docker pull alpine
90
+
docker tag alpine <ACCOUNT>.dkr.ecr.<REGION>.amazonaws.com/mdc-mock-0001
1. Connect to your EKS cluster and install the provided Helm chart. Configure `kubectl` to work with your EKS cluster. Run this command (replace `<your-region>` and `<your-cluster-name>` with your EKS cluster region and name):
The Helm chart deploys resources onto your cluster that can be used to infer attack paths. It also includes the vulnerable image.
119
+
120
+
> [!NOTE]
121
+
> After completing the above flow, it can take up to 24 hours to see results in the cloud security explorer and attack path.
82
122
83
-
1. Sign in to the [Azure portal](https://portal.azure.com).
123
+
After you completed testing the attack path, investigate the created attack path by going to **Attack path analysis**, and search for the attack path you created. For more information, see [Identify and remediate attack paths](how-to-manage-attack-path.md).
84
124
85
-
1. Navigate to **Attack path analysis**.
125
+
## Find container posture issues with cloud security explorer
86
126
87
-
1. Select an attack path.
127
+
You can build queries in one of the following ways:
88
128
89
-
1. Locate the entry that details this security issue under `Internet exposed Kubernetes pod is running a container with high severity vulnerabilities`.
129
+
- [Explore risks with built-in cloud security explorer templates](#explore-risks-with-cloud-security-explorer-templates)
130
+
- [Create custom queries with cloud security explorer](#create-custom-queries-with-cloud-security-explorer)
90
131
91
-
### Explore risks with cloud security explorer templates
132
+
In the following sections, we present examples of queries you can select or create.
133
+
134
+
### Explore risks with cloud security explorer templates
92
135
93
136
1. From the Defender for Cloud overview page, open the cloud security explorer.
94
137
95
138
1. Some out of the box templates for Kubernetes appear. Select one of the templates:
96
139
97
140
- **Azure Kubernetes pods running images with high severity vulnerabilities**
:::image type="content" source="media/how-to-test-attack-path/select-template.png" alt-text="Screenshot showing where to select templates." lightbox="media/how-to-test-attack-path/select-template.png":::
143
+
:::image type="content" source="media/how-to-test-attack-path/select-template.png" alt-text="Screenshot showing where to select templates." lightbox="media/how-to-test-attack-path/select-template.png":::
101
144
102
145
1. Select **Open query**; the template builds the query in the upper portion of the screen. Select **Search** to view the results.
103
-
146
+
104
147
:::image type="content" source="media/how-to-test-attack-path/query-builder-search.png" alt-text="Screenshot that shows the query built and where to select search." lightbox="media/how-to-test-attack-path/query-builder-search.png":::
105
148
106
149
### Create custom queries with cloud security explorer
@@ -113,6 +156,6 @@ The results are listed below the query.
113
156
114
157
:::image type="content" source="media/how-to-test-attack-path/custom-query-results.png" alt-text="Screenshot that shows the results from a custom query." lightbox="media/how-to-test-attack-path/custom-query-results.png":::
115
158
116
-
## Next steps
159
+
## Next steps
117
160
118
161
- Learn more about the Defender for Cloud [Defender plans](defender-for-cloud-introduction.md#protect-cloud-workloads).
0 commit comments