hacktricks/pentesting/pentesting-kubernetes/kubernetes-hardening/monitoring-with-falco.md

4.9 KiB

Support HackTricks and get benefits!

Do you work in a cybersecurity company? Do you want to see your company advertised in HackTricks? or do you want to have access the latest version of the PEASS or download HackTricks in PDF? Check the SUBSCRIPTION PLANS!

Discover The PEASS Family, our collection of exclusive NFTs

Get the official PEASS & HackTricks swag

Join the 💬 Discord group or the telegram group or follow me on Twitter 🐦@carlospolopm.

Share your hacking tricks submitting PRs to the hacktricks github repo.

Monitoring with Falco

This tutorial was taken from https://madhuakula.com/kubernetes-goat/scenarios/scenario-18.html#scenario-information

Scenario Information

This scenario is deploy runtime security monitoring & detection for containers and kubernetes resources.

  • To get started with this scenario you can deploy the below helm chart with version 3

NOTE: Make sure you run the follwing deployment using Helm with v3.

helm repo add falcosecurity https://falcosecurity.github.io/charts
helm repo update
helm install falco falcosecurity/falco

Scenario 18 helm falco setup

Scenario Solution

Falco, the cloud-native runtime security project, is the de facto Kubernetes threat detection engine. Falco was created by Sysdig in 2016 and is the first runtime security project to join CNCF as an incubation-level project. Falco detects unexpected application behavior and alerts on threats at runtime.

Falco uses system calls to secure and monitor a system, by:

  • Parsing the Linux system calls from the kernel at runtime
  • Asserting the stream against a powerful rules engine
  • Alerting when a rule is violated

Falco ships with a default set of rules that check the kernel for unusual behavior such as:

  • Privilege escalation using privileged containers
  • Namespace changes using tools like setns
  • Read/Writes to well-known directories such as /etc, /usr/bin, /usr/sbin, etc
  • Creating symlinks
  • Ownership and Mode changes
  • Unexpected network connections or socket mutations
  • Spawned processes using execve
  • Executing shell binaries such as sh, bash, csh, zsh, etc
  • Executing SSH binaries such as ssh, scp, sftp, etc
  • Mutating Linux coreutils executables
  • Mutating login binaries
  • Mutating shadowutil or passwd executables such as shadowconfig, pwck, chpasswd, getpasswd, change, useradd, etc, and others.
  • Get more details about the falco deployment
kubectl get pods --selector app=falco

Scenario 18 falco get pods

  • Manually obtaining the logs from the falco systems
kubectl logs -f -l app=falco
  • Now, let's spin up a hacker container and read senstive file and see if that detects by Falco
kubectl run --rm --restart=Never -it --image=madhuakula/hacker-container -- bash
  • Read the sensitive file
cat /etc/shadow

Scenario 18 falco detect /etc/shadow

Support HackTricks and get benefits!

Do you work in a cybersecurity company? Do you want to see your company advertised in HackTricks? or do you want to have access the latest version of the PEASS or download HackTricks in PDF? Check the SUBSCRIPTION PLANS!

Discover The PEASS Family, our collection of exclusive NFTs

Get the official PEASS & HackTricks swag

Join the 💬 Discord group or the telegram group or follow me on Twitter 🐦@carlospolopm.

Share your hacking tricks submitting PRs to the hacktricks github repo.