How eBPF Can Detect Kubernetes Container Escapes and Runtime Attacks

· Original article ↗

Summary

A walkthrough shows how eBPF-based runtime monitoring can surface Kubernetes attack activity, including privileged-pod escapes, reverse shells, pod creation, and access to /etc/shadow, alongside prevention measures.

Key points

  • The article demonstrates a privileged Kubernetes pod using host access and nsenter to escape its container and reach host resources.
  • A test web application with missing input validation is used to demonstrate remote command execution and a reverse shell into a Kubernetes node.
  • After gaining cluster access in the scenario, the tester enumerates Kubernetes resources, reads a service-account token, and creates pods.
  • The article says eBPF can capture real-time kernel and container activity for investigation, threat hunting, and security policy creation.
  • Recommended measures include network policies, controls that block privileged pods, and runtime observability.
  • Wiz’s Runtime Sensor is described as using eBPF to monitor activity and detect behaviors including reverse shells, pod creation, and access to /etc/shadow.

Article Details

Defense Focus
Use eBPF-based runtime observability to detect and help prevent Kubernetes container escapes, remote code execution, and suspicious activity in pods and on hosts.
Detection Methods
  • Monitor container runtime and host system activity in real time using eBPF-captured system calls.
  • Inspect process trees and correlate process activity with user sessions and network connections across containers and systems.
  • Detect non-standard socket connections to remote network addresses, including reverse-shell behavior.
  • Alert on unexpected process execution, pod creation, and access to /etc/shadow.
  • Use workload behavior monitoring and anomaly detection to identify new or suspicious activity.
Data Sources
  • eBPF-captured system calls
  • Process activity and process trees
  • User sessions
  • Network connections and socket activity
  • Container and host runtime activity
  • Pod creation events
  • File access events, including access to /etc/shadow
Platforms
  • Kubernetes
Defensive Actions
  • Apply network policies to restrict communication between external hosts and sensitive pods.
  • Use admission controls and security guardrails to block creation of privileged pods.
  • Enable runtime observability and security monitoring across the cluster.
  • Investigate unexpected remote socket connections, privileged pod activity, pod creation, and sensitive-file access.

MITRE ATT&CK

Vendors

Products

Tools

Related Articles