惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
有赞技术团队
有赞技术团队
罗磊的独立博客
博客园 - 叶小钗
Jina AI
Jina AI
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
量子位
MyScale Blog
MyScale Blog
V
Visual Studio Blog
博客园 - 聂微东
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
小众软件
小众软件
宝玉的分享
宝玉的分享

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Threat Detection in Kubernetes with Falco
josepraveen · 2026-05-30 · via DEV Community

josepraveen

Finding out there is "suspicious activity" in your infrastructure is enough to make any DevOps engineer's heart rate spike. If you’re running containerized workloads, you need a way to see exactly what’s happening inside those isolated environments in real-time.

Falco, the open-source standard for cloud-native runtime security. In this guide, we'll walk through a hands-on scenario: investigating a suspicious Nginx container by detecting unauthorized spawning processes.


A team member reports odd behavior in a specific container. Our goal is to use Falco to monitor the execve system call—which is triggered whenever a new process is started—and log those events to a report for analysis.

Step 1: Create a Custom Falco Rule

Falco uses a flexible YAML-based syntax for defining security rules. We need to create a rule specifically targeting our Nginx container.

  1. Create a new rules file: vi nginx-rules.yml
  2. Paste the following configuration:
- rule: spawned_process_in_nginx_container
  desc: A process was spawned in the Nginx container.
  condition: container.name = "nginx" and evt.type = execve
  output: "%evt.time,%proc.name,%user.uid,%container.id,%container.name,%container.image"
  priority: WARNING

  1. Save and exit (Esc, :wq, Enter).

rule

Breakdown of the Rule:

  • Condition: We are filtering for events where the container name is exactly "nginx" and the event type is execve (process execution).
  • Output: This defines the format of our log, capturing the timestamp, process name, user ID, and container metadata.

Why is this rule important?
In a secure, production containerized environment, containers should follow the principle of immutability. An Nginx container should only run Nginx.

If a hacker successfully exploits a vulnerability in your Nginx web server, the first thing they will often try to do is open a reverse shell (bash or sh) or run malicious scripts to look around. Because execve catches any new process being spawned, this rule will instantly catch an attacker attempting to run commands inside your container.


Step 2: Run the Analysis

Now, we run Falco using our custom rule. We’ll use the -M flag to run the scan for a set duration (45 seconds) and redirect the output to a log file for further investigation.

Run the following command as root:

sudo falco -r nginx-rules.yml -M 45 > /home/cloud_user/falco-report.log

-M 45: Instructs Falco to run in duration mode for exactly 45 seconds and then gracefully terminate.

falco


Step 3: Audit the Results

Once the run is complete, you can inspect the log file to see every process that was triggered during that window. This is your "paper trail" for the suspicious activity.

cat /home/cloud_user/falco-report.log

log

Summary of What Happened
Look at the timestamps and the repeating process loop:
05:07:16: sh $\rightarrow$ cat $\rightarrow$ sh $\rightarrow$ sleep
05:07:21: sh $\rightarrow$ cat $\rightarrow$ sh $\rightarrow$ sleep (Exactly 5 seconds later)
05:07:26: sh $\rightarrow$ cat $\rightarrow$ sh $\rightarrow$ sleep (Exactly 5 seconds later)

The Verdict: Inside your container named nginx, there is an automated loop script running every 5 seconds. This script spawns a shell, uses cat to read a file, and then executes sleep 5 before repeating.
Because your Falco rule looks for any new process execution (evt.type = execve), it successfully caught all 4 commands running every 5 seconds. Over the 45-second testing period, this loop ran 9 times, resulting in exactly 36 total security alerts (9 loops × 4 commands = 36 events).