RunTime Threat Mapping for AWS EKS using Deepfence ThreatMapper
If we want to unify the development and DevOps perspectives of the application and the environment with the SecOps view, we need to have tools that can observe what's happening...
475
Malware Scans
12K
Vulnerabilities
711
Secrets
Introduction
If we want to unify the development and DevOps perspectives of the application and the environment with the SecOps view, we need to have tools that can observe what's happening, identify threats, and provide security.
Deepfence ThreatMapper:
Deepfence ThreatMapper is an open-source security observability platform that helps teams identify active threats and vulnerability exposure in production, especially in cloud-native environments.
How can Deepfence ThreatMapper help us?
The applications are built on various open-source technology stacks, pulling in third-party modules. With developers constantly pushing the code and images into repositories, and the operations team integrating various agents on the production workload for several purposes like logging, how can we ensure that our applications are protected against vulnerabilities, malware, and exposed secrets?
Deepfence ThreatMapper helps identify these risks and vulnerabilities.
Objective:
Monitor the AWS EKS cluster to uncover vulnerabilities in the software components, malware, and exposed secrets within the environment using ThreatMapper.
Installation:
The core components of ThreatMapper are the management console and sensor agents. ThreatMapper can be deployed as a containerized application on a single Docker host or across a distributed Kubernetes cluster. In this guide, we install ThreatMapper on an Amazon EC2 Ubuntu instance.
System Requirements:
Resources: 4 vCPU, 16GB RAM.
Port configurations: HTTPS (443)
Instance type: t2.xlarge
Docker: Minimum version 18.06.0
Tune the system limits on mmap counts:
sudo systemctl -w vm.max_map_count=262144
Deploy Management console:
Steps:
SSH into an EC2 instance.
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
Install docker:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg |sudo apt-key add sudo add-apt-repository "deb [arch=amd64]https://download.docker.com/linux/ubuntu focal stable"apt-cache policy docker-cesudo apt install -y docker-ce
Check the docker version by using the "docker info" command.
Install docker-compose:
sudo curl -Lhttps://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
Download the docker-compose YAML file from the Deepfence GitHub repository:
sudo wget https://github.com/deepfence/ThreatMapper/raw/master/deployment-scripts/docker-compose.yml
Check that the docker-compose.yml file is available.
Execute the command to install the management console:
sudo docker-compose up --detach
Check whether all the containers are running:
docker ps
Access the Deepfence ThreatMapper management console using the ec2 instance public IP https://X.X.X.X
We will get an invalid certificate error because we have not configured it, then go further.
Sign In With Your Credentials
The console may take one to two minutes to load.
Register and create a new account.
Add and manage new users from the management console. Obtain an API Key for installing sensor agents in the targeted environments.
Deploy sensor agents in the Kubernetes environment:
Using helm chart, we can deploy the agents.
Note down the name of the Kubernetes cluster (CLUSTERNAME), copy the Deepfence Management console url (X.X.X.X) and API key from the Deepfence User Management.
Execute these commands and add the noted down values:
helm repo add deepfencehelm repo add deepfence https://deepfence-helm-charts.s3.amazonaws.com/threatmapperhelm show readme deepfence/deepfence-agenthelm show values deepfence/deepfence-agenthelm install deepfence-agent deepfence/deepfence-agent \--set managementConsoleUrl=X.X.X.X \--set deepfenceKey=APIKEY \--set image.tag=1.5.0 \--set image.clusterAgentImageTag=1.5.0 \--set clusterName=CLUSTERNAME \--set mountContainerRuntimeSocket.containerdSock=true \--set mountContainerRuntimeSocket.dockerSock=false \--set mountContainerRuntimeSocket.crioSock=false \--set mountContainerRuntimeSocket.containerdSockPath="/run/containerd/containerd.sock" \--namespace deepfence \--create-namespace
Check whether the pods are running.
kubectl get pods -n deepfence
After deploying the sensor agents, we can view the details of the K8s environment on the management console. Deepfence provides a feature called "topology-based view" that allows us to visualize the live infrastructure either graphically or through a tabular interface if it is a complex one. We have our workloads in the AWS Cloud, which runs in the ap-south-1 (Mumbai) region. The installed agents are collecting the network traffic coming from the internet to the hosts and the containers.
AWS · ap-south-1 (Mumbai) · Kubernetes cluster nodes streaming traffic to hosts & containers
Now we can run a vulnerability scan, a secret scan, or a malware scan by selecting any of the Kubernetes hosts or specific containers. Also, we can run a one-time scan of our whole Kubernetes cluster. They will scan both the container images for vulnerabilities within a pod and also the host operating system. These scans sit and run in the background, gathering SBOM (software bill of materials) information and reporting back. Finally, we got the scan results for our individual host.
475
Total
283
High
42
Medium
150
Low
No Data Available
Most exploitable vulnerabilities and top attack paths
Most vulnerable attack paths
Paths with direct internet exposure
Paths with indirect internet exposure
218
Total
Most importantly, ThreatMapper has the ability to stack-rank vulnerabilities so that we know what to fix first.
With the ThreatMapper Cloud scanner, we can run a compliance scan on our cloud service account and evaluate results against benchmark controls.
1
Total accounts
39%
Compliance %
1
Total scans
783
Total cloud resources
| Account ID | Cloud Provider | Active | Compliance % | Actions |
|---|---|---|---|---|
| aws | YES | 39% |
Start scanView resultsView inventory
|
We can also use ThreatMapper to perform the same scans against workloads that are hosted in registries.
Please feel free to reach out to me at manigandhan@refactorq.com in case you need any help or have any doubts about integrating ThreatMapper in your cloud setup.
Reference links:
www.deepfence.io/threatmapper
github.com/deepfence/threatmapper
Cloud Security Engineering
Audit cloud attack surfaces, secure Kubernetes workloads, enforce least-privilege IAM, and automate vulnerability remediation.