Skip to content

Commit e41910e

Browse files
authored
Merge pull request #262372 from dcurwin/wi-195472-attack-path-aws-jan4-2024
AWS test attack path
2 parents d92d62b + 0f3e7a6 commit e41910e

File tree

2 files changed

+84
-41
lines changed

2 files changed

+84
-41
lines changed

articles/defender-for-cloud/TOC.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@
302302
items:
303303
- name: Onboard agentless containers for CSPM
304304
href: how-to-enable-agentless-containers.md
305+
- name: Attack path analysis and enhanced risk-hunting for containers
306+
displayName: attack paths, paths, security explorer, test
307+
href: how-to-test-attack-path-and-security-explorer-with-vulnerable-container-image.md
305308
- name: Manage security standards and recommendations
306309
items:
307310
- name: Choose standards for your compliance dashboard
@@ -349,9 +352,6 @@
349352
- name: Build queries with cloud security explorer
350353
displayName: queries, security explorer, explorer, templates, query
351354
href: how-to-manage-cloud-security-explorer.md
352-
- name: Test attack paths and security explorer
353-
displayName: attack paths, paths, security explorer, test
354-
href: how-to-test-attack-path-and-security-explorer-with-vulnerable-container-image.md
355355
- name: Built-in security protections
356356
items:
357357
- name: Use Purview to protect sensitive data
Lines changed: 81 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
11
---
2-
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
44
ms.service: defender-for-cloud
55
ms.topic: how-to
6-
ms.date: 11/08/2023
6+
ms.date: 01/21/2024
77
---
88

9-
# Test attack paths and cloud security explorer
10-
9+
# Attack path analysis and enhanced risk-hunting for containers
1110

1211
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.
1312

1413
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:
1514

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
2019

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
2221

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:
2423

2524
**Requirement:** An instance of Azure Container Registry (ACR) in the tested scope.
2625

27-
1. Import a mock vulnerable image to your Azure Container Registry:
26+
1. Import a mock vulnerable image to your Azure Container Registry:
2827

29-
1. Run the following command in Cloud Shell:
28+
1. Run the following command in Cloud Shell:
3029

31-
```
30+
```azurecli
3231
az acr import --name $MYACR --source DCSPMtesting.azurecr.io/mdc-mock-0001 --image mdc-mock-0001
3332
```
3433
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:
3635
37-
```
36+
```azurecli
3837
az aks create -n myAKSCluster -g myResourceGroup --generate-ssh-keys --attach-acr $MYACR
3938
```
4039
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:
4241
43-
```
42+
```azurecli
4443
az aks update -n myAKSCluster -g myResourceGroup --attach-acr <acr-name>
4544
```
4645
4746
1. Authenticate your Cloud Shell session to work with the cluster:
48-
49-
```
47+
48+
```azurecli
5049
az aks get-credentials --subscription <cluster-suid> --resource-group <your-rg> --name <your-cluster-name>
5150
```
5251
5352
1. Install [ngnix ingress Controller](https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-helm/) :
54-
55-
```
53+
54+
```azurecli
5655
helm install ingress-controller oci://ghcr.io/nginxinc/charts/nginx-ingress --version 1.0.1
5756
```
5857
5958
1. Deploy the mock vulnerable image to expose the vulnerable container to the internet by running the following command:
60-
```
59+
60+
```azurecli
6161
helm install dcspmcharts oci://mcr.microsoft.com/mdc/stable/dcspmcharts --version 1.0.0 --namespace mdc-dcspm-demo --create-namespace --set image=<your-image-uri> --set distribution=AZURE
6262
```
6363
@@ -70,37 +70,80 @@ If there are no entries in the list of attack paths, you can still test this fea
7070
> [!NOTE]
7171
> After completing the above flow, it can take up to 24 hours to see results in the cloud security explorer and attack path.
7272
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).
7474
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
7676
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.
81+
82+
```awscli
83+
aws ecr get-login-password --region <REGION> | docker login --username AWS --password-stdin <ACCOUNT>.dkr.ecr.<REGION>.amazonaws.com
84+
```
85+
86+
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
91+
docker push <ACCOUNT>.dkr.ecr.<REGION>.amazonaws.com/mdc-mock-0001
92+
```
93+
94+
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):
95+
96+
```awscli
97+
aws eks --region <your-region> update-kubeconfig --name <your-cluster-name>
98+
```
99+
100+
1. Verify the configuration. You can check if `kubectl` is correctly configured by running:
101+
102+
```awscli
103+
kubectl get nodes
104+
```
105+
106+
1. Install [ngnix ingress Controller](https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-helm/) :
107+
108+
```azurecli
109+
helm install ingress-controller oci://ghcr.io/nginxinc/charts/nginx-ingress --version 1.0.1
110+
```
111+
112+
1. Install the following Helm chart:
80113
81-
### Find the security issue under attack paths
114+
```awscli
115+
helm install dcspmcharts oci://mcr.microsoft.com/mdc/stable/dcspmcharts --version 1.0.0 --namespace mdc-dcspm-demo --create-namespace --set image=<ACCOUNT>.dkr.ecr.<REGION>.amazonaws.com/mdc-mock-0001 --set distribution=AWS
116+
```
117+
118+
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.
82122
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).
84124
85-
1. Navigate to **Attack path analysis**.
125+
## Find container posture issues with cloud security explorer
86126
87-
1. Select an attack path.
127+
You can build queries in one of the following ways:
88128
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)
90131
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
92135
93136
1. From the Defender for Cloud overview page, open the cloud security explorer.
94137
95138
1. Some out of the box templates for Kubernetes appear. Select one of the templates:
96139
97140
- **Azure Kubernetes pods running images with high severity vulnerabilities**
98-
- **Kubernetes namespaces contain vulnerable pods**
141+
- **Kubernetes namespaces contain vulnerable pods**
99142
100-
:::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":::
101144
102145
1. Select **Open query**; the template builds the query in the upper portion of the screen. Select **Search** to view the results.
103-
146+
104147
:::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":::
105148
106149
### Create custom queries with cloud security explorer
@@ -113,6 +156,6 @@ The results are listed below the query.
113156
114157
:::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":::
115158
116-
## Next steps
159+
## Next steps
117160
118161
- Learn more about the Defender for Cloud [Defender plans](defender-for-cloud-introduction.md#protect-cloud-workloads).

0 commit comments

Comments
 (0)