πŸ”’ Security

Falco

Falco

A Kubernetes runtime security tool. Syscall-based anomaly detection.

πŸ“– Detailed Explanation

Falco is a CNCF project, an open-source tool that detects runtime security events in Kubernetes and container environments. Developed by Sysdig, it monitors kernel-level system calls to detect abnormal behavior in real time.

Falco captures system calls through eBPF or a kernel module. It matches them against predefined rules (YAML) to detect suspicious activity such as shell execution, sensitive file access, and network connections, and sends alerts.

The default rule set detects common attack patterns such as terminal access inside containers, privilege escalation, and cryptocurrency mining attempts. You can add custom rules to respond to organization-specific threats.

Falco alerts are sent through various channels such as stdout, syslog, HTTP webhook, Slack, and PagerDuty. By integrating with Falcosidekick, you can automatically create incidents in SIEM and ticketing systems.

πŸ’» Code Example

# Falco Helm μ„€μΉ˜
helm repo add falcosecurity https://falcosecurity.github.io/charts
helm install falco falcosecurity/falco -n falco --create-namespace \
  --set driver.kind=ebpf \
  --set falcosidekick.enabled=true

# μ»€μŠ€ν…€ λ£° (custom-rules.yaml)
- rule: Detect Outbound Connections to Crypto Mining Pools
  desc: μ•”ν˜Έν™”ν 채꡴ ν’€ μ—°κ²° 탐지
  condition: >
    evt.type=connect and fd.sip.name in (cryptopool.domains) and container
  output: >
    Crypto mining pool connection (container=%container.name connection=%fd.name)
  priority: CRITICAL
  tags: [network, mitre_resource_hijacking]

- rule: Shell Spawned in Container
  desc: μ»¨ν…Œμ΄λ„ˆ λ‚΄ μ‰˜ μ‹€ν–‰ 탐지
  condition: >
    spawned_process and container and shell_procs and
    proc.tty != 0 and not allowed_k8s_containers
  output: >
    Shell spawned (user=%user.name container=%container.name shell=%proc.name
    parent=%proc.pname cmdline=%proc.cmdline)
  priority: WARNING

- macro: allowed_k8s_containers
  condition: k8s.ns.name in ("kube-system", "monitoring")

# Falcosidekick μ„€μ • (Slack μ•Œλ¦Ό)
# values.yaml
falcosidekick:
  config:
    slack:
      webhookurl: "https://hooks.slack.com/services/xxx"
      channel: "#security-alerts"
      minimumpriority: "warning"

# ν…ŒμŠ€νŠΈ: μ»¨ν…Œμ΄λ„ˆμ—μ„œ μ‰˜ μ‹€ν–‰
kubectl exec -it nginx -- /bin/bash
# Falco 둜그: Shell spawned in container...

πŸ—£οΈ How It's Said in Practice

Security team: "We want to understand how kubectl exec is being used in production. If we collect shell execution events with Falco, we can tell who accessed what and when."

Operations team: "Monitoring agents also use shells, so won't that cause false positives?"

Security team: "We can handle exceptions with a macro. For example, by excluding the kube-system namespace."

Interviewer: "How would you implement container runtime security?"

Candidate: "I deploy Falco as a DaemonSet to monitor system calls on every node. It detects shell execution, sensitive file access, and privilege escalation, and sends alerts to Slack and the SIEM via Falcosidekick. I classify threats with MITRE ATT&CK tags and use them in incident response."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

Reviewer: "This rule's condition is too broad. I think it will generate a lot of false positives."

Author: "I'll add an exception condition with a macro, and lower the priority to monitor it first."

⚠️ Cautions

πŸ“š Learn More