跳到正文
Skillpedia
安全35k · #7618

analyzing-kubernetes-audit-logs

它能做什么

这个工具用来分析 Kubernetes 审计日志,帮你找出可疑行为。它会寻找未授权访问、权限提升和数据窃取的尝试,帮助你判断集群是否已经被入侵。

适用场景

  • ✓当你怀疑 Kubernetes 集群遭到入侵时。
  • ✓想调查攻击者通过 API 服务器做了什么时。
  • ✓在编写检测规则、保护集群的时候。

技能链接

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-kubernetes-audit-logs/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-kubernetes-audit-logs/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“分析 Kubernetes 审计日志,告诉我是否有人尝试访问 secrets,或者创建特权 Pod。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会读取日志文件。日志文件就像是 Kubernetes 中所有操作的记录。工具会查找一些特定的模式,这些模式通常意味着危险操作,比如有人试图进入容器,或者访问敏感信息。

技术内容(原始 SKILL.md)

作者在 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:

  1. pods/exec and pods/attach (shell into containers)
  2. secrets access (get/list/watch)
  3. clusterrolebindings creation (RBAC escalation)
  4. Privileged pod creation
  5. 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')}")
常见问题

什么是 Kubernetes 审计日志?

这是详细记录集群中所有操作的文件,包括谁在什么时候对哪个资源做了什么。

什么是 “exec-into-pod”?

指有人通过命令进入集群中正在运行的容器,这可能是一种入侵行为。

什么是 SIEM 检测规则?

这是安全信息与事件管理(SIEM)系统中的配置,当从日志中识别出可疑活动时,系统就会发出告警。

详情

作者的原始描述

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

repo: mukul975/Anthropic-Cybersecurity-Skills

热度

GitHub 星标
35k
排名
#7618
许可证
Apache-2.0
更新时间
2026/8/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能