Skillpedia
الوكلاء35k · #7861

detecting-privilege-escalation-in-kubernetes-pods

ما الذي تفعله

تساعد هذه المهارة على العثور على البرامج داخل الحاويات (مثل تلك المستخدمة في Kubernetes) التي تكتسب صلاحيات أكبر مما يجب، وعلى إيقافها. تفحص الإعدادات، وتراقب النشاط الفعلي، وتحلل سجلات النشاط.

متى تستخدمها

  • ✓عندما تشك في أن حاوية تعمل بصلاحيات مرتفعة.
  • ✓عند إعداد أنظمة تمنع الحاويات من اكتساب صلاحيات إضافية.
  • ✓عند التحقيق في نشاط مشبوه داخل الحاويات.

رابط المهارة

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-privilege-escalation-in-kubernetes-pods/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-privilege-escalation-in-kubernetes-pods/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“تحقق مما إذا كانت أي حاوية في مجموعة Kubernetes الخاصة بي تحاول اكتساب صلاحيات غير مبررة.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تستخدم هذه المهارة أدوات تتحقق من القواعد قبل بدء الحاوية (التحكم في القبول)، وأدوات أخرى تراقب ما يحدث أثناء تشغيلها (المراقبة أثناء التشغيل). كما تحلل سجلات التدقيق في Kubernetes لرصد الأنشطة المشبوهة.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Detecting Privilege Escalation in Kubernetes Pods

Overview

Privilege escalation in Kubernetes occurs when a pod or container gains elevated permissions beyond its intended scope. This includes running as root, using privileged mode, mounting host filesystems, enabling dangerous Linux capabilities, or exploiting kernel vulnerabilities. Detection combines admission control (prevention), runtime monitoring (detection), and audit logging (investigation).

When to Use

  • When investigating security incidents that require detecting privilege escalation in kubernetes pods
  • 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.25+ (Pod Security Admission support)
  • kubectl with cluster-admin access
  • Falco or similar runtime security tool
  • OPA Gatekeeper or Kyverno for admission policies

Privilege Escalation Vectors in Kubernetes

Vector Risk Detection Method
privileged: true Full host access Admission control + audit
hostPID: true Access host processes Admission control
hostNetwork: true Access host network stack Admission control
hostPath volumes Read/write host filesystem Admission control
SYS_ADMIN capability Near-privileged access Admission + runtime
allowPrivilegeEscalation: true setuid/setgid exploitation Admission control
runAsUser: 0 Container root Admission control
automountServiceAccountToken Token theft for API access Admission control
Writable /proc or /sys Kernel parameter manipulation Runtime monitoring

Detection with Admission Control

Pod Security Admission (Built-in)

# Enforce restricted policy on namespace
apiVersion: v1
kind: Namespace
metadata:
  name: production
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/warn: restricted

OPA Gatekeeper Policies

# Block dangerous capabilities
apiVersion: templates.gatekeeper.sh/v1
kind: ConstraintTemplate
metadata:
  name: k8sdangerouspriv
spec:
  crd:
    spec:
      names:
        kind: K8sDangerousPriv
  targets:
    - target: admission.k8s.gatekeeper.sh
      rego: |
        package k8sdangerouspriv

        dangerous_caps := {"SYS_ADMIN", "SYS_PTRACE", "SYS_MODULE", "DAC_OVERRIDE", "NET_ADMIN", "NET_RAW"}

        violation[{"msg": msg}] {
          container := input.review.object.spec.containers[_]
          cap := container.securityContext.capabilities.add[_]
          dangerous_caps[cap]
          msg := sprintf("Container %v adds dangerous capability: %v", [container.name, cap])
        }

        violation[{"msg": msg}] {
          container := input.review.object.spec.containers[_]
          container.securityContext.privileged == true
          msg := sprintf("Container %v runs in privileged mode", [container.name])
        }

        violation[{"msg": msg}] {
          container := input.review.object.spec.containers[_]
          container.securityContext.allowPrivilegeEscalation == true
          msg := sprintf("Container %v allows privilege escalation", [container.name])
        }

        violation[{"msg": msg}] {
          input.review.object.spec.hostPID == true
          msg := "Pod uses host PID namespace"
        }

        violation[{"msg": msg}] {
          input.review.object.spec.hostNetwork == true
          msg := "Pod uses host network"
        }

Runtime Detection with Falco

# /etc/falco/rules.d/privesc-detection.yaml
- rule: Setuid Binary Execution in Container
  desc: Detect execution of setuid/setgid binaries in a container
  condition: >
    spawned_process and container and
    (proc.name in (su, sudo, newgrp, chsh, passwd) or
     proc.is_exe_upper_layer=true)
  output: >
    Setuid/setgid binary executed in container
    (user=%user.name container=%container.name image=%container.image.repository
     command=%proc.cmdline parent=%proc.pname)
  priority: WARNING
  tags: [container, privilege-escalation, T1548]

- rule: Capability Gained in Container
  desc: Detect when a process gains elevated capabilities
  condition: >
    evt.type = capset and container and
    evt.arg.cap != ""
  output: >

…
الأسئلة الشائعة

ما معنى «تصعيد الصلاحيات» في الحاويات؟

هو أن يحصل برنامج داخل الحاوية على صلاحيات أكثر مما ينبغي له، مثل التشغيل كمسؤول أو الوصول إلى ملفات النظام الرئيسية.

ما الأدوات المستخدمة؟

أهمها OPA Gatekeeper للتحكم في القبول، وFalco للمراقبة أثناء التشغيل، إضافة إلى تحليل سجلات تدقيق Kubernetes.

هل أحتاج إلى صلاحيات خاصة لاستخدامها؟

نعم، عادةً تحتاج إلى صلاحيات مسؤول على مجموعة Kubernetes، ويجب أن تكون أدوات المراقبة والتحكم في القبول مثبتة ومُعدّة مسبقًا.

التفاصيل

الوصف الأصلي من المؤلف

Detects and prevents privilege escalation inside Kubernetes pods by combining admission control (OPA policies), runtime monitoring (Falco), and audit log analysis of security contexts, Linux capabilities, and syscall patterns. Use when investigating a pod running as root or privileged, hardening workloads against in-pod escalation, or hunting for containers exceeding their intended scope. Keywords

repo: mukul975/Anthropic-Cybersecurity-Skills

الشعبية

نجوم GitHub
35k
الترتيب
#7861
الترخيص
Apache-2.0
آخر تحديث
31‏/8‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة