Threat Modeling for Testers: STRIDE, DREAD & Test Case Generation
Threat modeling is the process of identifying what can go wrong with your application before attackers do. STRIDE (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege) provides a systematic vocabulary for identifying threats. DREAD scores each threat by Damage, Reproducibility, Exploitability, Affected users, and Discoverability. The output of threat modeling isn't a report—it's a prioritized list of test cases. For each threat identified, you should have at least one test that verifies the threat is mitigated.
Key Takeaways
Threat modeling is design-time security testing. It happens before you write code, not after. The earlier you find design flaws, the cheaper they are to fix.
STRIDE maps directly to test categories. Spoofing threats → authentication tests. Tampering threats → integrity and authorization tests. Information Disclosure → data exposure tests. Each STRIDE category has a corresponding class of security tests.
Data flow diagrams (DFDs) are the input to threat modeling. You can't find threats without a clear map of how data moves through your system: users, processes, data stores, external services, and the trust boundaries between them.
Every threat should become a test case. A threat that isn't tested isn't mitigated—it's just hoped away. The test case documents what attack you're protecting against and verifies the control works.
Threat models become stale. Re-run threat modeling when you add authentication systems, integrate new services, change data flows, or add privileged operations. Tie threat model reviews to architecture decision records (ADRs).
What Is Threat Modeling?
Threat modeling answers four questions:
- What are we building? (system scope and data flows)
- What can go wrong? (threats)
- What are we doing about it? (mitigations)
- Did we do a good job? (validation—testing)
The output of threat modeling is not a risk register or compliance document. It's a set of concrete security requirements and test cases.
Data Flow Diagrams
Before you can identify threats, you need to understand the system. A DFD shows:
- External entities (users, external services) — rectangles
- Processes (your application components) — circles
- Data stores (databases, files, caches) — parallel lines
- Data flows — arrows
- Trust boundaries — dashed lines
[User Browser] ─── HTTPS ──▶ [Web Server]
│
Trust │ Trust
Boundary ───┤ Boundary
│
┌─────────▼──────────┐
│ Application │
│ Server Process │
└────────┬───────────┘
│
┌────────▼───────────┐
│ Database │
│ (User data) │
└────────────────────┘Trust boundaries are where threats concentrate. Data crossing a trust boundary (user input entering your application, your application accessing the database) is where you need the most security controls.
STRIDE Threat Categories
S — Spoofing
Definition: Claiming to be someone or something you're not.
Examples:
- Attacker uses stolen credentials to impersonate a legitimate user
- Attacker forges a JWT token signature
- Phishing attack sends emails appearing to be from your domain
Test cases generated:
Test: Authentication token forgery
Action: Modify a valid JWT payload (change user_id) and re-sign with wrong key
Expected: 401 Unauthorized
Test: Session fixation
Action: Obtain a session ID before login, complete login, use old session ID
Expected: Session ID must change after successful authentication
Test: Password brute force
Action: Attempt 1000 password combinations against an account
Expected: Account lockout after N failed attemptsT — Tampering
Definition: Modifying data without authorization.
Examples:
- Modifying an order total in an HTTP request
- Injecting SQL to update records you shouldn't have access to
- Modifying a signed cookie value
Test cases generated:
Test: Price manipulation
Action: Intercept checkout POST and modify item price to $0.01
Expected: Server validates price from database, not from request
Test: CSRF on state-changing endpoint
Action: Submit a cross-origin form that POSTs to /api/user/settings
Expected: CSRF token validation rejects the request
Test: Signed data integrity
Action: Modify a signed discount voucher and submit
Expected: Signature validation fails, voucher is rejectedR — Repudiation
Definition: Denying that an action was performed when it was.
Examples:
- User denies making a purchase that was legitimately processed
- Admin denies deleting a record that they did delete
- System has no audit trail for privileged operations
Test cases generated:
Test: Audit log completeness
Action: Perform privileged actions (user role change, data deletion)
Expected: All actions logged with user ID, timestamp, action type, target
Test: Audit log immutability
Action: Attempt to delete or modify audit log entries
Expected: Only append-only writes permitted; no delete or update on audit records
Test: Log correlation
Action: Perform a sequence of actions; verify they're traceable in logs
Expected: Request ID ties log entries together into a coherent audit trailI — Information Disclosure
Definition: Exposing data to unauthorized parties.
Examples:
- Error messages revealing stack traces or database schema
- API returning fields the caller shouldn't see (over-fetching)
- Sensitive data in browser logs or localStorage
Test cases generated:
Test: Error message information leakage
Action: Submit invalid input to trigger application errors
Expected: Generic error messages, no stack traces, no internal paths in responses
Test: API over-fetching
Action: Call /api/users/{id} as a non-admin user
Expected: Response excludes password_hash, internal_notes, admin_flags
Test: Sensitive data in client storage
Action: Log in and inspect localStorage, sessionStorage, cookies
Expected: No plaintext passwords, SSNs, or payment data stored client-sideD — Denial of Service
Definition: Making a system unavailable.
Examples:
- Flooding an endpoint with requests exhausting resources
- Uploading a file designed to consume excessive CPU (zip bomb, ReDoS)
- Triggering a database-intensive operation without authentication
Test cases generated:
Test: Rate limiting on authentication endpoint
Action: Send 1000 login requests per second
Expected: Rate limiter returns 429 after threshold; server remains responsive
Test: ReDoS (Regular Expression DoS)
Action: Submit a crafted input that triggers catastrophic backtracking in regex
Expected: Regex evaluation completes within timeout; no CPU spike
Test: Unauthenticated expensive endpoint
Action: Call computationally expensive endpoint without authentication
Expected: Authentication required before any processing occursE — Elevation of Privilege
Definition: Gaining access beyond what's authorized.
Examples:
- Regular user accessing admin endpoints
- Horizontal privilege escalation (accessing another user's data)
- Server-side request forgery allowing access to internal services
Test cases generated:
Test: Horizontal privilege escalation
Action: As user A, request /api/documents/{id} where id belongs to user B
Expected: 403 Forbidden or 404
Test: Admin endpoint access control
Action: As a regular user, call /api/admin/users
Expected: 403 Forbidden
Test: JWT algorithm confusion
Action: Create a JWT signed with "none" algorithm
Expected: Server rejects tokens with algorithm "none"DREAD Risk Scoring
DREAD scores each threat from 1–10 across five dimensions to prioritize testing effort:
| Dimension | Score 1 (Low) | Score 5 (Medium) | Score 10 (High) |
|---|---|---|---|
| Damage | Minor inconvenience | Data exposure | Complete system compromise |
| Reproducibility | Hard to reproduce | Occasional | Always reproducible |
| Exploitability | Expert attacker required | Some skill required | Any script kiddie |
| Affected users | Individual | Some users | All users |
| Discoverability | Hidden internal | Needs analysis | Obvious to observe |
def dread_score(damage, reproducibility, exploitability, affected, discoverability):
return (damage + reproducibility + exploitability + affected + discoverability) / 5
# Example: unauthenticated admin endpoint
score = dread_score(
damage=9, # Full data access
reproducibility=10, # Always works
exploitability=10, # Just visit the URL
affected=10, # All user data
discoverability=5, # Needs to know the URL exists
)
# DREAD score: 8.8 — CRITICAL, test immediatelyAttack Trees
For high-DREAD threats, build an attack tree showing all paths to exploitation:
Goal: Access customer payment data
├── Steal database credentials
│ ├── Find credentials in source code
│ ├── Exploit SQL injection to read credentials table
│ └── Brute-force database login
├── Exploit application to return payment data
│ ├── IDOR: enumerate payment records by ID
│ ├── Over-fetching: payment data in API response
│ └── XSS: steal payment data from DOM
└── Compromise admin account
├── Phishing admin credentials
├── Exploit password reset flow
└── Session hijackingEach leaf node in the attack tree is a test case.
Integrating Threat Modeling into Development
| Phase | Activity |
|---|---|
| Architecture | DFD + STRIDE analysis of new features |
| Development | Security test cases in sprint backlog |
| Code Review | Check mitigations are implemented |
| Testing | Run security test cases; use SAST/DAST |
| Release | Verify all critical threats have passing tests |
Tools for Threat Modeling
- OWASP Threat Dragon — Open source, web-based, creates DFDs and auto-suggests STRIDE threats
- Microsoft Threat Modeling Tool — Free, Windows, mature tooling for enterprise
- IriusRisk — Commercial, integrates with Jira, generates test cases automatically
- draw.io — For DFDs; no automated threat generation, but flexible
Summary
Threat modeling transforms security testing from reactive (find bugs after they're shipped) to proactive (prevent bugs from being shipped). The workflow:
- Draw data flow diagrams
- Identify trust boundaries
- Apply STRIDE to each data flow across each boundary
- Score threats with DREAD
- Generate test cases for each threat
- Verify mitigations in code review and automated tests
The test cases from threat modeling supplement SAST, DAST, and IAST—they test for the specific vulnerabilities relevant to your application's design, not just generic vulnerability patterns.