detecting-container-drift-at-runtime
Helps your agent find unauthorized changes in running containers, such as file modifications or new binaries.
What it does
This tool helps identify if a container (an isolated software environment) has been unexpectedly changed while running. It checks if new programs were executed, if files were modified, or if configurations were altered, by comparing the container to its original state.
When to use it
- ✓When you suspect a container has been compromised.
- ✓To check if anyone installed unauthorized programs inside a container.
- ✓To ensure containers remain exactly as they were created.
Example of what to ask your AI
“Check for unauthorized changes in the container named 'my-server'.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool compares the container's current state against its original image. It uses other tools (like Falco) to monitor activities such as program execution, file changes, and configuration modifications in real-time.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill detecting-container-drift-at-runtimeOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/detecting-container-drift-at-runtime/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Detecting Container Drift at Runtime
Overview
Container drift occurs when running containers deviate from their original image state through unauthorized file modifications, unexpected binary execution, configuration changes, or package installations. Since containers should be treated as immutable infrastructure, any drift is a potential indicator of compromise. Detection techniques leverage the DIE (Detect, Isolate, Evict) model -- an immutable workload should not change during runtime, so any observed change is potentially evidence of malicious activity.
When to Use
- When investigating security incidents that require detecting container drift at runtime
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Kubernetes cluster v1.24+ with runtime security tooling
- Falco or Sysdig for runtime drift detection
- Container image registry with image manifests available
- Familiarity with Linux filesystem layers and OverlayFS
Core Concepts
Types of Container Drift
- Binary drift: Execution of binaries not present in the original image (downloaded malware, compiled tools)
- File drift: Creation, modification, or deletion of files in the container filesystem
- Configuration drift: Changes to environment variables, mounted secrets, or runtime parameters
- Package drift: Installation of new packages via apt, yum, pip, or npm at runtime
- Network drift: New listening ports or outbound connections not expected for the workload
Detection Methods
Image-Based Comparison: Compare the running container's filesystem against its source image to identify added, modified, or removed files.
Behavioral Monitoring: Use eBPF or kernel-level monitoring to detect process execution, file access, and network activity that deviates from expected behavior.
Digest Verification: Continuously verify that running container image digests match the approved deployment manifests.
Implementation with Falco
Detecting New Binary Execution
- rule: Drift Detected (Container Image Modified Binary)
desc: Detect execution of a binary not present in the original container image
condition: >
spawned_process and
container and
not proc.pname in (container_entrypoint) and
proc.is_exe_upper_layer = true
output: >
Drift detected: new binary executed in container
(user=%user.name command=%proc.cmdline container=%container.name
image=%container.image.repository:%container.image.tag
exe_path=%proc.exepath)
priority: WARNING
tags: [container, drift]
- rule: Container Shell Spawned
desc: Detect interactive shell in a container that should be immutable
condition: >
spawned_process and
container and
proc.name in (bash, sh, dash, zsh, csh, ksh) and
not proc.pname in (container_entrypoint)
output: >
Shell spawned in container (user=%user.name shell=%proc.name
container=%container.name image=%container.image.repository)
priority: WARNING
tags: [container, drift, shell]
Detecting Package Manager Usage
- rule: Package Manager Execution in Container
desc: Detect use of package managers indicating drift
condition: >
spawned_process and
container and
proc.name in (apt, apt-get, yum, dnf, apk, pip, pip3, npm, gem, cargo)
output: >
Package manager executed in container (user=%user.name
command=%proc.cmdline container=%container.name
image=%container.image.repository)
priority: ERROR
tags: [container, drift, package-manager]
Detecting File System Modifications
- rule: Container File System Write
desc: Detect writes to container upper layer filesystem
condition: >
open_write and
container and
fd.typechar = 'f' and
not fd.name startswith /tmp and
not fd.name startswith /var/log and
not fd.name startswith /proc
output: >
File write in container (user=%user.name file=%fd.name
container=%container.name)
priority: NOTICE
tags: [container, drift, filesystem]
Implementation with Kubernetes Enforcement
Read-Only Root Filesystem
Prevent drift by making container filesystems immutable:
apiVersion: apps/v1
kind: Deployment
metadata:
name: immutable-app
spec:
template:
spec:
containers:
…
FAQ
What is container 'drift'?
'Drift' means a container has changed from its original state. Since containers should be immutable (unchangeable), any change could be a sign of a problem.
What kinds of changes can 'drift' detect?
It can detect the execution of programs that shouldn't be there, creation or modification of files, changes to configurations, installation of new packages, or even new network connections.
Do I need to install anything to use this?
Yes, you generally need to have container security tools like Falco or Microsoft Defender for Containers set up in your Kubernetes environment.
Details
Original description by the author
Detects unauthorized runtime drift in containers by monitoring binary execution, filesystem changes, and configuration deviation from the original immutable image, using Falco and Microsoft Defender for Containers. Use when validating immutable-infrastructure controls, hunting for unexpected package installs or binaries written inside a running container, or determining whether a container diverge
Popularity
- GitHub stars
- 35k
- Ranking position
- #5649
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
agent-architecture-audit
Makes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
affaan-m/ECC
agent-eval
Helps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
affaan-m/ECC
agent-harness-construction
Makes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
affaan-m/ECC