How to Do a Basic Threat Model for Your Web App: A Beginner’s Framework

A basic threat model for your web app is a short, written answer to four questions: what are you building, what can go wrong, what will you do about it, and did it work. You do not need a security team or a formal framework to start. A one-page document, written with your team before a major feature ships, catches risks while they are still cheap to fix. This threat modelling for beginners guide gives you a framework you can finish in an afternoon.

Threat modelling is not about imagining every possible attack. It is about naming the realistic ones for your app, so you spend effort where it matters. A blog with no login has different threats from a SaaS app holding payment data, and a threat model makes that difference explicit instead of leaving it to guesswork.

Step 1: Draw what you are building

Start with a simple diagram: users, your front end, your API, your database, third-party services, and the data that flows between them. Mark where trust changes: a browser talking to your API, your API talking to a payment provider, an admin panel touching user data. Those boundaries are where attacks happen, because data crosses from a place you control to a place you partly control or do not control at all.

List your assets at each point: user passwords, session tokens, API keys, personal data, uploaded files, admin functions, and billing data. Then list who might want each asset: opportunistic bots scanning the internet, a disgruntled former user, a competitor, or a targeted attacker after customer data. You do not need to be exhaustive. The top five assets and the top three attacker types cover most apps.

Step 2: List what can go wrong

Walk each boundary and ask what an attacker could do there. A common shortcut is the stride threat checklist: six threat types: spoofing identity, tampering with data, repudiation (denying an action happened), information disclosure, denial of service, and elevation of privilege. Run through the six at each boundary and note anything plausible.

For a typical web app, the web app security threats list quickly fills with familiar items: stolen session cookies, SQL injection through a search box, broken access control letting one user view another user’s data, file uploads used to store malware, and admin functions exposed without proper checks. A guide to CI/CD pipeline hardening covers threats in the build and deploy path, which belongs in your model too, not just the running app.

Step 3: Rank by impact and likelihood

Score each threat twice, on a simple scale of low, medium, or high: how bad would it be, and how likely is it for your app. A threat with high impact and high likelihood goes first. A low-impact, low-likelihood item goes on a watch list, not into this sprint. This ranking is the whole point of the exercise: it turns a scary list into a work order.

Be honest about likelihood. Internet-facing login forms get attacked constantly, so credential attacks are high likelihood for almost every app. A nation-state attack on a small blog is not. Rank with your real exposure in mind, not with headlines in mind.

Step 4: Choose a mitigation for each top threat

For each top threat, write one mitigation, one owner, and one check that proves it works. Examples that fit most web apps: parameterized queries for injection, authorization checks on every data access for broken access control, secure cookie flags and short session lifetimes for session theft, and a web application firewall in front of public endpoints. A comparison of WAF options for small sites helps if you add that layer.

Mitigations need not be code. Rate limiting, alerting on failed logins, backups tested by restore, and a runbook for incidents are mitigations too. The best mitigation is often the boring one: remove the feature, reduce the data you store, or close the endpoint nobody uses. Less surface means fewer threats to model.

Step 5: Review, update, and keep it short

A threat model rots fast. Review it when you add a feature, change a provider, or learn of an incident, and at least once per quarter. Keep the document to one or two pages: diagram, asset list, ranked threats, mitigations with owners. If it grows into a twenty-page report nobody reads, it has failed, no matter how thorough it looks.

Fold the model into your existing habits. A pre-release checklist that asks “did the threat model change?” costs one line and catches the feature that quietly added a new data flow. Server hardening belongs in the same review: a production server hardening checklist covers the host layer, and a Git repository security checklist covers the code layer, so your model spans the whole stack rather than stopping at the app.

Your basic threat model, kept to one page

Keep the whole document short enough that a new team member can read it in ten minutes. If a section grows beyond a paragraph, split it into an appendix and keep the ranked threat list on page one.

A worked mini-example

Take a small SaaS app with user accounts, file uploads, and a Stripe integration. Assets: passwords, session tokens, uploaded files, billing data. Top threats: credential stuffing against login, broken access control on file downloads, and a leaked Stripe key. Mitigations: rate limiting plus a second factor on login, an ownership check on every file request, and a scoped, rotated key stored in a secret manager. Owners and checks: login metrics reviewed weekly, an automated test that requests another user’s file and expects a denial, and a key rotation reminder every 90 days. That paragraph is a usable threat model. Yours can start that small too.

Threat modelling rewards teams that write things down and revisit them. Start with one app, one diagram, and five ranked threats, and you will already be ahead of most small teams, who discover their threat model only after an incident writes it for them.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.