Lesson 07 Configuration & Infrastructure Weaknesses
Theme:

Answers

Reference answers for Lesson 07.

Part 1 — Lab Answers

Exercise 1 — Nmap Scan Analysis

Expected findings

Exercise 2 — Kubernetes Pod Spec

Expected findings

A realistic escape primitive: hostPath write to /var/spool/cron or to a kubelet config.

Exercise 3 — Docker Compose

Expected findings

Exercise 4 — Nginx Config

Expected findings

Exercise 5 — AWS IAM Policy

Expected findings

Final Exercise — Kill Chain

Expected chain

External nmap finding → web exploit via nginx misconfig → container access → docker.sock escape OR k8s service account → AWS metadata credentials → IAM privesc via PassRole.


Part 2 — Homework Answers

Task 1 — AWS Privesc Playbook

Expected detections

CloudTrail events like CreateFunction, PassRole, AttachRolePolicy are the defender's best signals. A good runbook notes that attackers who disable CloudTrail leave their own fingerprint via StopLogging.

Task 2 — Hardening Diff

Expected patch quality

Each diff should change the root cause (remove the wildcard, drop the capability, add the Condition) without removing legitimate functionality. Tests: does the app still start? Does traffic still flow?

Task 3 — Policy-as-Code Rule

Expected rule

A Rego rule matching input.spec.containers[_].securityContext.privileged == true or equivalent kube-linter check. Should fire on the lab manifest and ignore compliant ones.