Capstone: FinFlow Threat Model
Apply everything you've learned to model a real-world fintech application โ FinFlow โ a payment platform with cloud infrastructure, a REST API, OAuth login, and an AI assistant. This is a full end-to-end threat model.
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.
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
- 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
Phase 1: Scope & Asset Identification
Define your scope and identify the crown jewels
Answer these questions as a team. Write your answers on the whiteboard.
- What are FinFlow's crown jewels โ the assets where a breach would be most catastrophic?
- What is out of scope for this threat model? (What are we explicitly NOT modeling?)
- Who are the threat actors โ who would want to attack this system and why?
- Which regulatory frameworks apply? (PCI DSS? GDPR? SOC 2?)
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)
Phase 2: Draw the Data Flow Diagram
Map the system โ every component, flow, and trust boundary
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)
Phase 3: STRIDE Threat Identification
Apply STRIDE to the most critical components
For each component below, identify at least 2 threats using STRIDE. Fill in the table:
| Component | STRIDE Category | Your Threat Description |
|---|---|---|
AI Assistant (Process 2) โ with trigger_refund() tool | Write your threats here... | |
| Webhook Sender (Process 3) โ POST to merchant URLs | Write your threats here... | |
| Transactions DB โ contains all payment records | Write your threats here... | |
| Merchant API Keys โ stored in Secrets Manager | Write your threats here... | |
| OAuth Login (Auth0 flow) | Write your threats here... |
| Component | STRIDE | Threat | Risk |
|---|---|---|---|
AI Assistant + trigger_refund() | T ยท E | Indirect prompt injection via transaction note field tricks AI into triggering unauthorized refunds | Critical |
| I | AI reads transaction history of ALL merchants (missing authorization check in tool call) | Critical | |
| D | Attacker floods AI endpoint with expensive queries, incurring massive GPT-4 API costs | High | |
| Webhook Sender | S | Merchant URL changed to attacker's server โ FinFlow sends payment data (amounts, customer emails) to attacker | Critical |
| T ยท E | SSRF: merchant configures webhook URL as http://169.254.169.254/ โ FinFlow's Lambda fetches AWS metadata | Critical | |
| Transactions DB | T | SQL injection via transaction search endpoint modifies payment amounts retroactively | Critical |
| I | Lambda DB role has SELECT * on all tables โ compromised Lambda exfiltrates all merchant data | Critical | |
| Merchant API Keys | I | API key included in client-side JS bundle โ leaked via browser DevTools | Critical |
| S | Leaked API key used to trigger payments on behalf of merchant without their knowledge | Critical | |
| OAuth / Auth0 Flow | S | Missing state parameter โ CSRF attack logs merchant into attacker-controlled account | High |
| I | Access token stored in localStorage โ XSS in dashboard steals token โ full account takeover | High |
Phase 4: Risk Scoring & Prioritization
Score your top 5 threats using DREAD and build a priority list
Pick your top 5 threats from Phase 3. Score each using DREAD (1โ3 per dimension) and determine priority.
| Threat | D | R | E | A | D | Total | Priority |
|---|---|---|---|---|---|---|---|
| Write your threat 1... | โ | โ | โ | โ | โ | ?/15 | ? |
| Threat | D | R | E | A | D | Total | Priority |
|---|---|---|---|---|---|---|---|
| Prompt injection โ unauthorized refund via AI | 3 | 2 | 2 | 2 | 2 | 11/15 | Critical |
| SSRF via webhook URL โ AWS metadata | 3 | 3 | 2 | 3 | 2 | 13/15 | Critical |
| SQL injection via search โ data exfiltration | 3 | 3 | 3 | 3 | 3 | 15/15 | Critical |
| API key in client JS bundle | 3 | 3 | 3 | 2 | 3 | 14/15 | Critical |
| Missing OAuth state โ CSRF account link | 2 | 3 | 2 | 2 | 3 | 12/15 | Critical |
Phase 5: Mitigation Planning
Design specific mitigations for your highest-priority threats
For each Critical threat, propose a specific, implementable mitigation. Be concrete โ not "add security" but "add X control that does Y."
| Threat | Mitigation | Decision | Owner |
|---|---|---|---|
| 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 |
Phase 6: Debrief & Reflection
Compare findings across groups and extract lessons
Discussion Questions for the Instructor
- Which group found the most threats? What did others miss? Why?
- 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?)
- 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?
- Which threat would have the biggest business impact if exploited? Why?
- What would need to change in FinFlow's architecture to achieve PCI DSS compliance?
๐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.
- 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