Module 10 โ€” Capstone Exercise
๐ŸŽ“
Instructor Guide โ€” Running This Capstone
Recommended format: 60-minute live session with groups of 3โ€“4 students.
Materials needed: Whiteboard (physical or Miro/FigJam), printed system description cards.
Phases: Each phase has a timer badge showing recommended time. Work in groups, compare answers using the "Reveal Answer" buttons for facilitated discussion.
Tip: Don't reveal answers until each group presents โ€” the disagreement and discussion is where the most learning happens.

1FinFlow โ€” System Description

Read the following system description carefully. Your job is to threat model it end to end.

๐Ÿฆ
FinFlow โ€” Fintech Payment Platform
What it does: FinFlow allows businesses (merchants) to accept payments from customers. It provides a merchant dashboard, a payment widget that merchants embed in their websites, and a public REST API.

Key users:
  • Customers: make payments via merchant-embedded widget (not logged in to FinFlow)
  • Merchants: log in to dashboard to manage payments, view analytics, configure webhooks
  • FinFlow Admins: internal team, manage platform via admin portal
Architecture:
  • React SPA dashboard (Vercel hosting)
  • REST API (Node.js on AWS Lambda, behind API Gateway)
  • Merchant authentication via OAuth 2.0 (Auth0)
  • Payment processing via Stripe API (PCI-compliant)
  • Transaction data stored in AWS RDS (PostgreSQL) โ€” VPC, private subnet
  • AI Assistant: merchants can ask "Why did this payment fail?" โ€” uses GPT-4 with access to the merchant's transaction history and the ability to trigger refunds via a tool call
  • Webhook system: FinFlow sends POST requests to merchant-configured URLs on payment events
  • CI/CD: GitHub Actions โ†’ ECR โ†’ Lambda
Sensitive data: Card numbers (handled by Stripe, not stored), transaction amounts, merchant bank account details (for payouts), customer email addresses, merchant API keys.
1

Phase 1: Scope & Asset Identification

Define your scope and identify the crown jewels

โฑ๏ธ 8 min

Answer these questions as a team. Write your answers on the whiteboard.

  1. What are FinFlow's crown jewels โ€” the assets where a breach would be most catastrophic?
  2. What is out of scope for this threat model? (What are we explicitly NOT modeling?)
  3. Who are the threat actors โ€” who would want to attack this system and why?
  4. Which regulatory frameworks apply? (PCI DSS? GDPR? SOC 2?)
๐Ÿ’ก
Suggested Answers
Crown jewels: Merchant bank account details (payout routing), Merchant API keys (direct financial access), Transaction records (payment amounts, customer emails), Admin portal access (full platform control), Stripe integration credentials

Out of scope: Stripe's internal systems (they own that security), Vercel infrastructure, Auth0's identity systems, merchants' own websites where they embed the widget

Threat actors: (1) Financially motivated cybercriminals โ€” redirect payouts, steal merchant bank details; (2) Competing merchants โ€” steal analytics data; (3) Disgruntled insiders โ€” FinFlow admin team; (4) Nation-state actors (unlikely, but possible for financial infrastructure)

Regulations: PCI DSS (card data), GDPR (EU customer emails = personal data), SOC 2 Type II (likely required by enterprise merchants)
2

Phase 2: Draw the Data Flow Diagram

Map the system โ€” every component, flow, and trust boundary

โฑ๏ธ 15 min

Draw the DFD on your whiteboard. Include:

  • All external entities (customers, merchants, FinFlow admins, Stripe, Auth0, merchant webhooks)
  • All processes (API Gateway, Lambda functions, AI Assistant, webhook sender)
  • All data stores (RDS, secrets store)
  • All data flows (label each with what data moves)
  • All trust boundaries (at minimum: Internet / API Zone / DB Zone / External Services)
FinFlow โ€” Reference DFD
๐ŸŒ Internet (Untrusted) ๐Ÿ‘ค Customer via widget ๐Ÿช Merchant dashboard+API ๐Ÿ‘‘ Admin internal portal โœ… AWS โ€” Lambda + API Gateway ๐Ÿšช API Gateway +Auth0 JWT verify 1. Payment Lambda 2. AI Assistant GPT-4 + tools 3. Webhook Sender ๐Ÿ—„๏ธ DB / Secrets Transactions DB RDS PostgreSQL Secrets Manager Stripe key, DB creds ๐Ÿ“ฆ External Services ๐Ÿ’ณ Stripe API ๐Ÿ” Auth0 ๐ŸŒ Merchant Webhooks
FinFlow Reference DFD โ€” compare with your team's diagram. Key differences to discuss: webhook trust boundary, AI assistant tool access, and CI/CD pipeline (not shown โ€” deliberately omitted as a teaching point)
3

Phase 3: STRIDE Threat Identification

Apply STRIDE to the most critical components

โฑ๏ธ 15 min

For each component below, identify at least 2 threats using STRIDE. Fill in the table:

ComponentSTRIDE CategoryYour Threat Description
AI Assistant (Process 2) โ€” with trigger_refund() toolWrite your threats here...
Webhook Sender (Process 3) โ€” POST to merchant URLsWrite your threats here...
Transactions DB โ€” contains all payment recordsWrite your threats here...
Merchant API Keys โ€” stored in Secrets ManagerWrite your threats here...
OAuth Login (Auth0 flow)Write your threats here...
ComponentSTRIDEThreatRisk
AI Assistant + trigger_refund()T ยท EIndirect prompt injection via transaction note field tricks AI into triggering unauthorized refundsCritical
IAI reads transaction history of ALL merchants (missing authorization check in tool call)Critical
DAttacker floods AI endpoint with expensive queries, incurring massive GPT-4 API costsHigh
Webhook SenderSMerchant URL changed to attacker's server โ€” FinFlow sends payment data (amounts, customer emails) to attackerCritical
T ยท ESSRF: merchant configures webhook URL as http://169.254.169.254/ โ€” FinFlow's Lambda fetches AWS metadataCritical
Transactions DBTSQL injection via transaction search endpoint modifies payment amounts retroactivelyCritical
ILambda DB role has SELECT * on all tables โ€” compromised Lambda exfiltrates all merchant dataCritical
Merchant API KeysIAPI key included in client-side JS bundle โ€” leaked via browser DevToolsCritical
SLeaked API key used to trigger payments on behalf of merchant without their knowledgeCritical
OAuth / Auth0 FlowSMissing state parameter โ†’ CSRF attack logs merchant into attacker-controlled accountHigh
IAccess token stored in localStorage โ†’ XSS in dashboard steals token โ†’ full account takeoverHigh
4

Phase 4: Risk Scoring & Prioritization

Score your top 5 threats using DREAD and build a priority list

โฑ๏ธ 10 min

Pick your top 5 threats from Phase 3. Score each using DREAD (1โ€“3 per dimension) and determine priority.

ThreatDREADTotalPriority
Write your threat 1... โ€”โ€”โ€” โ€”โ€” ?/15 ?
ThreatDREADTotalPriority
Prompt injection โ†’ unauthorized refund via AI3222211/15Critical
SSRF via webhook URL โ†’ AWS metadata3323213/15Critical
SQL injection via search โ†’ data exfiltration3333315/15Critical
API key in client JS bundle3332314/15Critical
Missing OAuth state โ†’ CSRF account link2322312/15Critical
๐Ÿ’ฌ
Discussion Point
Every top-5 threat scored as Critical. What does this tell us about the current security posture of FinFlow? Is this surprising given the architecture? Which one would you fix first and why?
5

Phase 5: Mitigation Planning

Design specific mitigations for your highest-priority threats

โฑ๏ธ 10 min

For each Critical threat, propose a specific, implementable mitigation. Be concrete โ€” not "add security" but "add X control that does Y."

ThreatMitigationDecisionOwner
Prompt injection โ†’ refund Require human confirmation (merchant clicks "Approve" in dashboard) for ALL refunds triggered by AI. AI can only recommend refunds, not execute them. Separate refund confirmation from AI context. Mitigate AI team
SSRF via webhook URL Validate webhook URLs against allowlist (HTTPS only, no private IP ranges, no AWS metadata). Use egress firewall on Lambda VPC to block 169.254.x.x, 10.x, 172.16.x, 192.168.x. Add delay + retry to webhook delivery to prevent timing attacks. Mitigate Infra team
SQL injection via search Parameterized queries for all DB interactions (enforced via ORM/query builder). Enable pg_audit for query logging. Add integration test that attempts SQL injection and verifies it fails. Mitigate Backend team
API key in client bundle Never expose API keys to frontend. All API calls from merchant dashboard go through FinFlow's own backend (BFF pattern). Merchant-facing API keys are server-side secrets only. Rotate any exposed keys immediately. Mitigate Frontend + Backend
Missing OAuth state Add cryptographically random 256-bit state parameter to Auth0 authorization request. Validate state on callback before exchanging code for token. Auth0 SDK handles this if configured correctly โ€” verify configuration in code review. Mitigate Auth team
6

Phase 6: Debrief & Reflection

Compare findings across groups and extract lessons

โฑ๏ธ 10 min

Discussion Questions for the Instructor

  1. Which group found the most threats? What did others miss? Why?
  2. Did any group find the CI/CD pipeline as a threat vector? (It wasn't in the DFD โ€” what does that tell us about scope?)
  3. The AI assistant has access to all merchants' transaction data via its tool. Is this a design flaw or a configuration problem? How would you redesign it?
  4. Which threat would have the biggest business impact if exploited? Why?
  5. What would need to change in FinFlow's architecture to achieve PCI DSS compliance?
๐Ÿ’ก
Key Insight: Missed Threats Are Normal
Real threat modeling always misses some threats โ€” that's why it's combined with penetration testing and continuous monitoring. The goal isn't perfection: it's dramatically reducing the most likely high-impact attacks before they're discovered by attackers. A threat model that finds and mitigates 80% of Critical threats is enormously valuable.

๐Ÿ†Course Complete!

๐ŸŽ“

You've completed the Threat Modeling Guide

From the basics of what a threat model is, through STRIDE, DFDs, and real-world applications โ€” you can now threat model basic apps, web APIs, cloud architectures, and AI agentic systems.

โœ…
You Can Now:
  • Answer the four questions of threat modeling for any system
  • Draw a Data Flow Diagram with correct elements and trust boundaries
  • Apply STRIDE per element to generate a complete threat list
  • Score threats using DREAD and prioritize with a risk matrix
  • Make explicit mitigation decisions and document residual risk
  • Threat model basic CRUD apps, REST APIs, OAuth flows, and microservices
  • Apply cloud-specific security thinking (shared responsibility, IAM, SSRF)
  • Recognize and defend against prompt injection in agentic AI systems

Recommended Next Steps

๐Ÿ“š
Read
"Threat Modeling: Designing for Security" by Adam Shostack โ€” the definitive book on the topic
๐Ÿ› ๏ธ
Practice
Threat model your current project at work. Start with one feature, not the whole system
๐ŸŒ
Community
OWASP Threat Modeling resources, OWASP Cornucopia cards for threat brainstorming
๐Ÿ†
Certifications
OSCP, AWS Security Specialty, CISSP โ€” all build on what you've learned here
1 / 7