Lab 15: Capstone — Multi-Vulnerability Attack Chain

Objective

Chain five vulnerability classes against a single target application to capture all five flags:

Flag
Vulnerability
Goal

ADV_FLAG_1_SQLI

Blind SQL Injection

Extract admin password character by character

ADV_FLAG_2_SSTI

Server-Side Template Injection

Achieve RCE — read /etc/passwd

ADV_FLAG_3_CMD

OS Command Injection

Read the secret file /tmp/secret.txt

ADV_FLAG_4_JWT

JWT Algorithm Confusion (alg:none)

Forge an admin JWT token

ADV_FLAG_5_SSRF

Server-Side Request Forgery

Reach internal API and retrieve the SSRF flag


Background

Real penetration tests chain vulnerabilities. An SSRF leads to internal credential exposure; those credentials unlock a JWT secret; the JWT grants admin access that exposes a SSTI endpoint. Understanding multi-step attack chains is essential for both offensive and defensive security.

Real-world chains:

  • Capital One 2019: SSRF → IAM role → S3 data exfiltration (3-step chain)

  • GitLab 2021: SSRF → Kubernetes API → cluster takeover (2-step chain)

  • Shopify 2020: Mass assignment → role escalation → admin panel SSTI (3-step chain)


Architecture

Time

90 minutes


Lab Instructions

Step 1: Setup — Deploy Capstone Target


Step 2: Launch Kali


Step 3: Flag 1 — Blind SQL Injection

📸 Verified Output:


Step 4: Flag 2 — SSTI → RCE

📸 Verified Output:


Step 5: Flag 3 — OS Command Injection

📸 Verified Output:


Step 6: Flag 4 — JWT alg:none Bypass

📸 Verified Output:


Step 7: Flag 5 — SSRF → Internal API

📸 Verified Output:


Step 8: Capture the Flag — Final Report


Remediation Summary

Vulnerability
Fix

Blind SQLi

Parameterised queries: WHERE username=?

SSTI

Use Template(s).substitute() with string.Template (no code execution); never Environment().from_string(user_input)

Command Injection

Remove shell=True; use subprocess.run([cmd, arg]) (list form)

JWT alg:none

Hardcode expected algorithm; reject none at verification

SSRF

Validate against SSRF allowlist; block RFC1918 + loopback ranges

Further Reading

Last updated