analyzing-kubernetes-audit-logs
Lets your agent read activity logs in Kubernetes systems. It detects dangerous actions and helps create rules to find attacks.
What it does
This tool analyzes Kubernetes audit logs to find suspicious activities. It looks for unauthorized access, privilege escalation, and data theft attempts, helping to identify if your cluster has been compromised.
When to use it
- ✓When you suspect your Kubernetes cluster has been breached.
- ✓To investigate what an attacker did through the API server.
- ✓When creating detection rules to protect your cluster.
Example of what to ask your AI
“Analyze the Kubernetes audit logs and tell me if there were any attempts to access secrets or create privileged pods.”
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 reads log files, which are like records of everything happening in Kubernetes. It looks for specific patterns that indicate dangerous actions, such as someone trying to get into a container or access sensitive information.
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 analyzing-kubernetes-audit-logsOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/analyzing-kubernetes-audit-logs/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Analyzing Kubernetes Audit Logs
When to Use
- When investigating security incidents that require analyzing kubernetes audit logs
- 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
- Familiarity with container security concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
Parse Kubernetes audit log files (JSON lines format) to detect security-relevant events including unauthorized access, privilege escalation, and data exfiltration.
import json
with open("/var/log/kubernetes/audit.log") as f:
for line in f:
event = json.loads(line)
verb = event.get("verb")
resource = event.get("objectRef", {}).get("resource")
user = event.get("user", {}).get("username")
if verb == "create" and resource == "pods/exec":
print(f"Pod exec by {user}")
Key events to detect:
- pods/exec and pods/attach (shell into containers)
- secrets access (get/list/watch)
- clusterrolebindings creation (RBAC escalation)
- Privileged pod creation
- Anonymous or system:unauthenticated access
Examples
# Detect secret enumeration
if verb in ("get", "list") and resource == "secrets":
print(f"Secret access: {user} -> {event['objectRef'].get('name')}")
FAQ
What are Kubernetes audit logs?
These are detailed records of all actions performed in your Kubernetes cluster, like who did what, when, and to which resource.
What is 'exec-into-pod'?
It's when someone uses a command to enter a container running within your cluster, which can be a form of intrusion.
What are SIEM detection rules?
These are configurations in security systems (SIEM) that alert when suspicious activities, identified from logs, occur.
Details
Original description by the author
Parses Kubernetes API server audit logs (JSON lines) to detect exec-into-pod, secret access, RBAC modifications, privileged pod creation, and anonymous API access, and builds SIEM detection rules from the event patterns. Use when investigating a suspected cluster compromise, reconstructing what an attacker did through the API server, or writing Kubernetes-specific detection content. Keywords: audi
Popularity
- GitHub stars
- 35k
- Ranking position
- #5455
- 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
dashboard-builder
Helps your agent create useful monitoring dashboards. It turns data into charts that answer important system questions.
affaan-m/ECC
dev-team
Simulates a collaborative development team where different roles respond to a problem together. It's useful for getting multiple perspectives without manually switching agents.
affaan-m/ECC
ecc-council
Has your agent convene a four-voice council for difficult decisions. It's useful when there are multiple good options and debate is needed before choosing.
affaan-m/ECC